-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mirrored release for deployments (#1657)
* mirrored release for deployments 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
4 changed files
with
92 additions
and
1 deletion.
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
74 changes: 74 additions & 0 deletions
74
charts/release/templates/_deployment-istio.mirror.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,74 @@ | ||
{{- define "env.deployment-istio.mirror.routemap" }} | ||
|
||
{{- $APP_NAME := (include "application.name" .) }} | ||
{{- $APP_NAMESPACE := (include "application.namespace" .) }} | ||
{{- $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 }} | ||
- 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: vs | ||
template: | | ||
apiVersion: networking.istio.io/v1beta1 | ||
kind: VirtualService | ||
metadata: | ||
name: {{ $APP_NAME }} | ||
namespace: {{ $APP_NAMESPACE }} | ||
spec: | ||
gateways: | ||
{{- if .Values.gateway }} | ||
- {{ .Values.gateway }} | ||
{{- end }} | ||
- mesh | ||
hosts: | ||
- {{ $APP_NAME }}.{{ $APP_NAMESPACE }} | ||
- {{ $APP_NAME }}.{{ $APP_NAMESPACE }}.svc | ||
- {{ $APP_NAME }}.{{ $APP_NAMESPACE }}.svc.cluster.local | ||
http: | ||
- name: {{ $APP_NAME }} | ||
route: | ||
# primary version | ||
{{- $v := (index $versions 0) }} | ||
- destination: | ||
host: {{ template "svc.name" $v }}.{{ $APP_NAMESPACE }}.svc.cluster.local | ||
port: | ||
number: {{ $v.port }} | ||
{{- if gt (len $versions) 1 }} | ||
{{ `{{- if gt (index .Weights 1) 0 }}` }} | ||
weight: {{ `{{ index .Weights 0 }}` }} | ||
{{ `{{- end }}` }} | ||
{{- end }} | ||
headers: | ||
response: | ||
add: | ||
app-version: {{ template "svc.name" $v }} | ||
# other versions | ||
{{- range $i, $v := (rest $versions) }} | ||
{{ `{{- if gt (index .Weights ` }}{{ print (add1 $i) }}{{ `) 0 }}` }} | ||
mirror: | ||
host: {{ template "svc.name" $v }}.{{ $APP_NAMESPACE }}.svc.cluster.local | ||
port: | ||
number: {{ $v.port }} | ||
mirrorPercentage: | ||
value: {{ `{{ index .Weights ` }}{{ print (add1 $i) }}{{ ` }}` }} | ||
{{ `{{- end }}` }} | ||
{{- end }} | ||
{{- end }} {{- /* define "env.deployment-istio.mirror.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-istio.mirror" }} | ||
|
||
{{- /* prepare versions for simpler processing */}} | ||
{{- $versions := include "normalize.versions.deployment" . | mustFromJson }} | ||
|
||
{{- /* weight-config ConfigMaps except for primary */}} | ||
{{- range $i, $v := (rest $versions) }} | ||
{{ include "configmap.weight-config" $v }} | ||
--- | ||
{{- end }} {{- /* range $i, $v := $versions */}} | ||
|
||
{{- /* routemap */}} | ||
{{ include "env.deployment-istio.mirror.routemap" . }} | ||
|
||
{{- end }} {{- /* define "env.deployment-istio.mirror" */}} |
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