forked from iter8-tools/iter8
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add release templates for gateway api (iter8-tools#1652)
* add release templates for gateway api Signed-off-by: Michael Kalantar <[email protected]> * bump chart version Signed-off-by: Michael Kalantar <[email protected]> --------- Signed-off-by: Michael Kalantar <[email protected]>
- Loading branch information
Showing
12 changed files
with
245 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
charts/release/templates/_deployment-gtw.blue-green.routemap.tpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
{{- define "env.deployment-gtw.blue-green.routemap" }} | ||
|
||
{{- $APP_NAME := (include "application.name" .) }} | ||
{{- $APP_NAMESPACE := (include "application.namespace" .) }} | ||
{{- $versions := include "normalize.versions.deployment" . | mustFromJson }} | ||
{{- $APP_PORT := pluck "port" (dict "port" 80) $.Values.application | first }} | ||
|
||
apiVersion: v1 | ||
kind: ConfigMap | ||
{{- template "routemap.metadata" . }} | ||
data: | ||
strSpec: | | ||
versions: | ||
{{- range $i, $v := $versions }} | ||
- resources: | ||
- gvrShort: svc | ||
name: {{ template "svc.name" $v }} | ||
namespace: {{ template "svc.namespace" $v }} | ||
- gvrShort: deploy | ||
name: {{ template "deploy.name" $v }} | ||
namespace: {{ template "deploy.namespace" $v }} | ||
- gvrShort: cm | ||
name: {{ $v.VERSION_NAME }}-weight-config | ||
namespace: {{ $v.VERSION_NAMESPACE }} | ||
weight: {{ $v.weight }} | ||
{{- end }} {{- /* range $i, $v := $versions */}} | ||
routingTemplates: | ||
{{ .Values.application.strategy }}: | ||
gvrShort: httproute | ||
template: | | ||
apiVersion: gateway.networking.k8s.io/v1beta1 | ||
kind: HTTPRoute | ||
metadata: | ||
name: {{ $APP_NAME }} | ||
namespace: {{ $APP_NAMESPACE }} | ||
spec: | ||
hostnames: | ||
- {{ $APP_NAME }} | ||
- {{ $APP_NAME }}.{{ $APP_NAMESPACE }} | ||
- {{ $APP_NAME }}.{{ $APP_NAMESPACE }}.svc.cluster.local | ||
parentRefs: | ||
- group: "" | ||
kind: Service | ||
name: {{ $APP_NAME }} | ||
port: {{ $APP_PORT }} | ||
{{- if .Values.gateway }} | ||
- name: {{ .Values.gateway }} | ||
{{- end }} | ||
rules: | ||
- backendRefs: | ||
{{- range $i, $v := $versions }} | ||
- group: "" | ||
kind: Service | ||
name: {{ template "svc.name" $v }} | ||
port: {{ $v.port }} | ||
{{- if gt (len $versions) 1 }} | ||
{{ `{{- if gt (index .Weights 1) 0 }}` }} | ||
weight: {{ `{{ index .Weights ` }}{{ print $i }}{{ ` }}` }} | ||
{{ `{{- end }}` }} | ||
{{- end }} | ||
filters: | ||
- type: ResponseHeaderModifier | ||
responseHeaderModifier: | ||
add: | ||
- name: app-version | ||
value: {{ template "svc.name" $v }} | ||
{{- end }} {{- /* range $i, $v := $versions */}} | ||
{{- end }} {{- /* define "env.deployment-gtw.blue-green.routemap" */}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{{- define "env.deployment-gtw.blue-green" }} | ||
|
||
{{- /* prepare versions for simpler processing */}} | ||
{{- $versions := include "normalize.versions.deployment" . | mustFromJson }} | ||
|
||
{{- /* weight-config ConfigMaps */}} | ||
{{- range $i, $v := $versions }} | ||
{{ include "configmap.weight-config" $v }} | ||
--- | ||
{{- end }} {{- /* range $i, $v := $versions */}} | ||
|
||
{{- /* routemap */}} | ||
{{ include "env.deployment-gtw.blue-green.routemap" . }} | ||
|
||
{{- end }} {{- /* define "env.deployment-gtw.blue-green" */}} |
75 changes: 75 additions & 0 deletions
75
charts/release/templates/_deployment-gtw.canary.routemap.tpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
{{- define "env.deployment-gtw.canary.routemap" }} | ||
|
||
{{- $APP_NAME := (include "application.name" .) }} | ||
{{- $APP_NAMESPACE := (include "application.namespace" .) }} | ||
{{- $versions := include "normalize.versions.deployment" . | mustFromJson }} | ||
{{- $APP_PORT := pluck "port" (dict "port" 80) $.Values.application | first }} | ||
|
||
apiVersion: v1 | ||
kind: ConfigMap | ||
{{- template "routemap.metadata" . }} | ||
data: | ||
strSpec: | | ||
versions: | ||
{{- range $i, $v := $versions }} | ||
- resources: | ||
- gvrShort: svc | ||
name: {{ template "svc.name" $v }} | ||
namespace: {{ template "svc.namespace" $v }} | ||
- gvrShort: deploy | ||
name: {{ template "deploy.name" $v }} | ||
namespace: {{ template "deploy.namespace" $v }} | ||
{{- end }} {{- /* range $i, $v := $versions */}} | ||
routingTemplates: | ||
{{ .Values.application.strategy }}: | ||
gvrShort: httproute | ||
template: | | ||
apiVersion: gateway.networking.k8s.io/v1beta1 | ||
kind: HTTPRoute | ||
metadata: | ||
name: {{ $APP_NAME }} | ||
namespace: {{ $APP_NAMESPACE }} | ||
spec: | ||
hostnames: | ||
- {{ $APP_NAME }}.{{ $APP_NAMESPACE }} | ||
- {{ $APP_NAME }}.{{ $APP_NAMESPACE }}.svc | ||
- {{ $APP_NAME }}.{{ $APP_NAMESPACE }}.svc.cluster.local | ||
parentRefs: | ||
- group: "" | ||
kind: Service | ||
name: {{ $APP_NAME }} | ||
port: {{ $APP_PORT }} | ||
{{- if .Values.gateway }} | ||
- name: {{ .Values.gateway }} | ||
{{- end }} | ||
rules: | ||
# non-primary versions | ||
{{- range $i, $v := (rest $versions) }} | ||
- matches: | ||
{{- toYaml $v.matches | nindent 14 }} | ||
backendRefs: | ||
- group: "" | ||
kind: Service | ||
name: {{ template "svc.name" $v }} | ||
port: {{ $v.port }} | ||
filters: | ||
- type: ResponseHeaderModifier | ||
responseHeaderModifier: | ||
add: | ||
- name: app-version | ||
value: {{ template "svc.name" $v }} | ||
{{- end }} {{- /* range $i, $v := (rest $versions) */}} | ||
# primary version (default) | ||
{{- $v := (index $versions 0) }} | ||
- backendRefs: | ||
- group: "" | ||
kind: Service | ||
name: {{ template "svc.name" $v }} | ||
port: {{ $v.port }} | ||
filters: | ||
- type: ResponseHeaderModifier | ||
responseHeaderModifier: | ||
add: | ||
- name: app-version | ||
value: {{ template "svc.name" $v }} | ||
{{- end }} {{- /* define "env.deployment-gtw.canary.routemap" */}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{{- define "env.deployment-gtw.canary" }} | ||
|
||
{{- /* routemap */}} | ||
{{ include "env.deployment-gtw.canary.routemap" . }} | ||
|
||
{{- end }} {{- /* define "env.deployment-gtw.canary" */}} |
21 changes: 21 additions & 0 deletions
21
charts/release/templates/_deployment-gtw.none.routemap.tpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{{- define "env.deployment-gtw.none.routemap" }} | ||
|
||
{{- $versions := include "normalize.versions.deployment" . | mustFromJson }} | ||
|
||
apiVersion: v1 | ||
kind: ConfigMap | ||
{{- template "routemap.metadata" . }} | ||
data: | ||
strSpec: | | ||
versions: | ||
{{- range $i, $v := $versions }} | ||
- resources: | ||
- gvrShort: svc | ||
name: {{ template "svc.name" $v }} | ||
namespace: {{ template "svc.namespace" $v }} | ||
- gvrShort: deploy | ||
name: {{ template "deploy.name" $v }} | ||
namespace: {{ template "deploy.namespace" $v }} | ||
{{- end }} | ||
|
||
{{- end }} {{- /* define "env.deployment-gtw.none.routemap" */}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{{- define "env.deployment-gtw.none" }} | ||
|
||
{{- /* routemap */}} | ||
{{ include "env.deployment-gtw.none.routemap" . }} | ||
|
||
{{- end }} {{- /* define "env.deployment-gtw.none" */}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{{- define "env.deployment-gtw.service" }} | ||
|
||
{{- $APP_NAME := (include "application.name" .) }} | ||
{{- $APP_NAMESPACE := (include "application.namespace" .) }} | ||
|
||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ $APP_NAME }} | ||
namespace: {{ $APP_NAMESPACE }} | ||
spec: | ||
selector: | ||
app: {{ $APP_NAME }} | ||
ports: | ||
- port: 80 | ||
{{- end }} {{- /* define "env.deployment-gtw.service" */}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{{- define "env.deployment-gtw" }} | ||
|
||
{{- /* Prepare versions for simpler processing */}} | ||
{{- $versions := include "normalize.versions.deployment" . | mustFromJson }} | ||
|
||
{{- range $i, $v := $versions }} | ||
{{- /* Deployment */}} | ||
{{ include "env.deployment.version.deployment" $v }} | ||
--- | ||
{{- /* Service */}} | ||
{{ include "env.deployment.version.service" $v }} | ||
--- | ||
{{- end }} {{- /* range $i, $v := $versions */}} | ||
|
||
{{- /* Service */}} | ||
{{ include "env.deployment-gtw.service" . }} | ||
--- | ||
|
||
{{- /* routemap (and other strategy specific objects) */}} | ||
{{- if not .Values.application.strategy }} | ||
{{ include "env.deployment-gtw.none" . }} | ||
{{- else if eq "none" .Values.application.strategy }} | ||
{{ include "env.deployment-gtw.none" . }} | ||
{{- else if eq "blue-green" .Values.application.strategy }} | ||
{{ include "env.deployment-gtw.blue-green" . }} | ||
{{- else if eq "canary" .Values.application.strategy }} | ||
{{ include "env.deployment-gtw.canary" . }} | ||
{{- end }} {{- /* if eq ... .Values.application.strategy */}} | ||
|
||
{{- end }} {{- /* define "env.deployment-gtw" */}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters