Skip to content

Commit 1dc8ffe

Browse files
authored
release chart (#1646)
* release chart Signed-off-by: Michael Kalantar <[email protected]> * update chart version Signed-off-by: Michael Kalantar <[email protected]> * update release chart Signed-off-by: Michael Kalantar <[email protected]> * helper for metadata Signed-off-by: Michael Kalantar <[email protected]> * kserve canary routemap template Signed-off-by: Michael Kalantar <[email protected]> * update release templates Signed-off-by: Michael Kalantar <[email protected]> * canary for deployment-istio Signed-off-by: Michael Kalantar <[email protected]> * add comment Signed-off-by: Michael Kalantar <[email protected]> * remove commented out code Signed-off-by: Michael Kalantar <[email protected]> --------- Signed-off-by: Michael Kalantar <[email protected]>
1 parent bf13530 commit 1dc8ffe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1571
-807
lines changed

charts/controller/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apiVersion: v2
22
name: controller
3-
version: 0.18.1
3+
version: 0.18.2
44
description: Iter8 controller controller
55
type: application
66
keywords:

charts/controller/templates/roles.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ rules:
1414
{{- end }}
1515
- apiGroups: ["{{- $type.Group -}}"]
1616
resources: ["{{- $type.Resource -}}"]
17-
verbs: ["get", "list", "watch", "patch", "update"]
17+
verbs: ["get", "list", "watch", "patch", "update", "create"]
1818
{{- end }}
1919
- apiGroups: [""]
2020
resources: ["events"]

charts/release/.helmignore

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*.orig
18+
*~
19+
# Various IDEs
20+
.project
21+
.idea/
22+
*.tmproj
23+
.vscode/
24+
25+
# generated files need to be ignored
26+
experiment.yaml

charts/release/Chart.yaml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
apiVersion: v2
2+
name: release
3+
version: 0.18.1
4+
description: Iter8 supported application release
5+
type: application
6+
keywords:
7+
- Iter8
8+
- traffic
9+
- blue-green
10+
- canary
11+
- mirroring
12+
home: https://iter8.tools
13+
sources:
14+
- https://github.com/iter8-tools/iter8
15+
maintainers:
16+
- name: Michael Kalantar
17+
18+
- name: Iter8
19+
20+
icon: https://github.com/iter8-tools/iter8/raw/master/mkdocs/docs/images/favicon.png
21+
appVersion: v0.18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{{- define "configmap.weight-config" }}
2+
apiVersion: v1
3+
kind: ConfigMap
4+
metadata:
5+
name: {{ .VERSION_NAME }}-weight-config
6+
labels:
7+
iter8.tools/watch: "true"
8+
{{- if .weight }}
9+
annotations:
10+
iter8.tools/weight: "{{ .weight }}"
11+
{{- end }} {{- /* if .weight */}}
12+
{{- end }} {{- /* define "configmap.weight-config" */}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
{{- define "env.deployment-istio.blue-green.routemap" }}
2+
3+
{{- $APP_NAME := (include "application.name" .) }}
4+
{{- $APP_NAMESPACE := (include "application.namespace" .) }}
5+
{{- $versions := include "normalize.versions.deployment" . | mustFromJson }}
6+
7+
apiVersion: v1
8+
kind: ConfigMap
9+
{{- template "routemap.metadata" . }}
10+
data:
11+
strSpec: |
12+
versions:
13+
{{- range $i, $v := $versions }}
14+
- resources:
15+
- gvrShort: svc
16+
name: {{ template "svc.name" $v }}
17+
namespace: {{ template "svc.namespace" $v }}
18+
- gvrShort: deploy
19+
name: {{ template "deploy.name" $v }}
20+
namespace: {{ template "deploy.namespace" $v }}
21+
- gvrShort: cm
22+
name: {{ $v.VERSION_NAME }}-weight-config
23+
namespace: {{ $v.VERSION_NAMESPACE }}
24+
weight: {{ $v.weight }}
25+
{{- end }} {{- /* range $i, $v := $versions */}}
26+
routingTemplates:
27+
{{ .Values.application.strategy }}:
28+
gvrShort: vs
29+
template: |
30+
apiVersion: networking.istio.io/v1beta1
31+
kind: VirtualService
32+
metadata:
33+
name: {{ $APP_NAME }}
34+
namespace: {{ $APP_NAMESPACE }}
35+
spec:
36+
gateways:
37+
{{- if .Values.gateway }}
38+
- {{ .Values.gateway }}
39+
{{- end }}
40+
- mesh
41+
hosts:
42+
- {{ $APP_NAME }}.{{ $APP_NAMESPACE }}
43+
- {{ $APP_NAME }}.{{ $APP_NAMESPACE }}.svc
44+
- {{ $APP_NAME }}.{{ $APP_NAMESPACE }}.svc.cluster.local
45+
http:
46+
- name: {{ $APP_NAME }}
47+
route:
48+
# primary version
49+
{{- $v := (index $versions 0) }}
50+
- destination:
51+
host: {{ template "svc.name" $v }}.{{ $APP_NAMESPACE }}.svc.cluster.local
52+
port:
53+
number: {{ $v.port }}
54+
{{- if gt (len $versions) 1 }}
55+
{{ `{{- if gt (index .Weights 1) 0 }}` }}
56+
weight: {{ `{{ index .Weights 0 }}` }}
57+
{{ `{{- end }}` }}
58+
{{- end }}
59+
headers:
60+
response:
61+
add:
62+
app-version: {{ template "svc.name" $v }}
63+
# other versions
64+
{{- range $i, $v := (rest $versions) }}
65+
{{ `{{- if gt (index .Weights ` }}{{ print (add1 $i) }}{{ `) 0 }}` }}
66+
- destination:
67+
host: {{ template "svc.name" $v }}.{{ $APP_NAMESPACE }}.svc.cluster.local
68+
port:
69+
number: {{ $v.port }}
70+
weight: {{ `{{ index .Weights ` }}{{ print (add1 $i) }}{{ ` }}` }}
71+
headers:
72+
response:
73+
add:
74+
app-version: {{ template "svc.name" $v }}
75+
{{ `{{- end }}` }}
76+
{{- end }}
77+
{{- end }} {{- /* define "env.deployment-istio.blue-green.routemap" */}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{{- define "env.deployment-istio.blue-green" }}
2+
3+
{{- /* prepare versions for simpler processing */}}
4+
{{- $versions := include "normalize.versions.deployment" . | mustFromJson }}
5+
6+
{{- /* weight-config ConfigMaps */}}
7+
{{- range $i, $v := $versions }}
8+
{{ include "configmap.weight-config" $v }}
9+
---
10+
{{- end }} {{- /* range $i, $v := $versions */}}
11+
12+
{{- /* routemap */}}
13+
{{ include "env.deployment-istio.blue-green.routemap" . }}
14+
15+
{{- end }} {{- /* define "env.deployment-istio.blue-green" */}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
{{- define "env.deployment-istio.canary.routemap" }}
2+
3+
{{- $APP_NAME := (include "application.name" .) }}
4+
{{- $APP_NAMESPACE := (include "application.namespace" .) }}
5+
{{- $versions := include "normalize.versions.deployment" . | mustFromJson }}
6+
7+
apiVersion: v1
8+
kind: ConfigMap
9+
{{- template "routemap.metadata" . }}
10+
data:
11+
strSpec: |
12+
versions:
13+
{{- range $i, $v := $versions }}
14+
- resources:
15+
- gvrShort: svc
16+
name: {{ template "svc.name" $v }}
17+
namespace: {{ template "svc.namespace" $v }}
18+
- gvrShort: deploy
19+
name: {{ template "deploy.name" $v }}
20+
namespace: {{ template "deploy.namespace" $v }}
21+
{{- end }}
22+
routingTemplates:
23+
{{ .Values.application.strategy }}:
24+
gvrShort: vs
25+
template: |
26+
apiVersion: networking.istio.io/v1beta1
27+
kind: VirtualService
28+
metadata:
29+
name: {{ $APP_NAME }}
30+
namespace: {{ $APP_NAMESPACE }}
31+
spec:
32+
gateways:
33+
{{- if .Values.gateway }}
34+
- {{ .Values.gateway }}
35+
{{- end }}
36+
- mesh
37+
hosts:
38+
- {{ $APP_NAME }}.{{ $APP_NAMESPACE }}
39+
- {{ $APP_NAME }}.{{ $APP_NAMESPACE }}.svc
40+
- {{ $APP_NAME }}.{{ $APP_NAMESPACE }}.svc.cluster.local
41+
http:
42+
# non-primary versions
43+
{{- range $i, $v := (rest $versions) }}
44+
{{- /* continue only if candidate is ready (weight > 0) */}}
45+
{{ `{{- if gt (index .Weights ` }}{{ print (add1 $i) }}{{ `) 0 }}` }}
46+
- name: {{ template "svc.name" $v }}
47+
match:
48+
{{- /* A match may have several ORed clauses */}}
49+
{{- range $j, $m := $v.match }}
50+
{{- /* include any other header requirements */}}
51+
{{- if (hasKey $m "headers") }}
52+
- headers:
53+
{{ toYaml (pick $m "headers").headers | indent 18 }}
54+
{{- end }} {{- /* if (hasKey $m "headers") */}}
55+
{{- /* include any other (non-header) requirements */}}
56+
{{- if gt (omit $m "headers" | keys | len) 0 }}
57+
{{ toYaml (omit $m "headers") | indent 16 }}
58+
{{- end }} {{- /* if gt (omit $m "headers" | keys | len) 0 */}}
59+
{{- end }} {{- /* range $j, $m := $v.match */}}
60+
route:
61+
- destination:
62+
host: {{ template "svc.name" $v }}.{{ $APP_NAMESPACE }}.svc.cluster.local
63+
port:
64+
number: {{ $v.port }}
65+
headers:
66+
response:
67+
add:
68+
app-version: {{ template "svc.name" $v }}
69+
{{ `{{- end }}` }}
70+
{{- end }} {{- /* range $i, $v := (rest $versions) */}}
71+
# primary version (default)
72+
{{- $v := (index $versions 0) }}
73+
- name: {{ template "svc.name" $v }}
74+
route:
75+
- destination:
76+
host: {{ template "svc.name" $v }}.{{ $APP_NAMESPACE }}.svc.cluster.local
77+
port:
78+
number: {{ $v.port }}
79+
headers:
80+
response:
81+
add:
82+
app-version: {{ template "svc.name" $v }}
83+
84+
{{- end }} {{- /* define "env.deployment-istio.canary.routemap" */}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{{- define "env.deployment-istio.canary" }}
2+
3+
{{- /* routemap */}}
4+
{{ include "env.deployment-istio.canary.routemap" . }}
5+
6+
{{- end }} {{- /* define "env.deployment-istio.canary" */}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{{- define "env.deployment-istio.none.routemap" }}
2+
3+
{{- $versions := include "normalize.versions.deployment" . | mustFromJson }}
4+
5+
apiVersion: v1
6+
kind: ConfigMap
7+
{{- template "routemap.metadata" . }}
8+
data:
9+
strSpec: |
10+
versions:
11+
{{- range $i, $v := $versions }}
12+
- resources:
13+
- gvrShort: svc
14+
name: {{ template "svc.name" $v }}
15+
namespace: {{ template "svc.namespace" $v }}
16+
- gvrShort: deploy
17+
name: {{ template "deploy.name" $v }}
18+
namespace: {{ template "deploy.namespace" $v }}
19+
{{- end }}
20+
21+
{{- end }} {{- /* define "env.deployment-istio.none.routemap" */}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{{- define "env.deployment-istio.none" }}
2+
3+
{{- /* routemap */}}
4+
{{ include "env.deployment-istio.none.routemap" . }}
5+
6+
{{- end }} {{- /* define "env.deployment-istio.none" */}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{{- define "env.deployment-istio.service" }}
2+
3+
{{- $APP_NAME := (include "application.name" .) }}
4+
{{- $APP_NAMESPACE := (include "application.namespace" .) }}
5+
6+
apiVersion: v1
7+
kind: Service
8+
metadata:
9+
name: {{ $APP_NAME }}
10+
namespace: {{ $APP_NAMESPACE }}
11+
spec:
12+
externalName: istio-ingressgateway.istio-system.svc.cluster.local
13+
sessionAffinity: None
14+
type: ExternalName
15+
{{- end }} {{- /* define "env.deployment-istio.service" */}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{{- define "env.deployment-istio" }}
2+
3+
{{- /* Prepare versions for simpler processing */}}
4+
{{- $versions := include "normalize.versions.deployment" . | mustFromJson }}
5+
6+
{{- range $i, $v := $versions }}
7+
{{- /* Deployment */}}
8+
{{ include "env.deployment.version.deployment" $v }}
9+
---
10+
{{- /* Service */}}
11+
{{ include "env.deployment.version.service" $v }}
12+
---
13+
{{- end }} {{- /* range $i, $v := $versions */}}
14+
15+
{{- /* Service */}}
16+
{{ include "env.deployment-istio.service" . }}
17+
---
18+
19+
{{- /* routemap (and other strategy specific objects) */}}
20+
{{- if not .Values.application.strategy }}
21+
{{ include "env.deployment-istio.none" . }}
22+
{{- else if eq "none" .Values.application.strategy }}
23+
{{ include "env.deployment-istio.none" . }}
24+
{{- else if eq "blue-green" .Values.application.strategy }}
25+
{{ include "env.deployment-istio.blue-green" . }}
26+
{{- else if eq "canary" .Values.application.strategy }}
27+
{{ include "env.deployment-istio.canary" . }}
28+
{{- end }} {{- /* if eq ... .Values.application.strategy */}}
29+
30+
{{- end }} {{- /* define "env.deployment-istio" */}}
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{{- define "env.deployment" }}
2+
3+
{{- /* Prepare versions for simpler processing */}}
4+
{{- $versions := include "normalize.versions.deployment" . | mustFromJson }}
5+
6+
{{- range $i, $v := $versions }}
7+
8+
{{- /* Deployment */}}
9+
{{ include "env.deployment.version.deployment" $v }}
10+
---
11+
{{- /* Service */}}
12+
{{ include "env.deployment.version.service" $v }}
13+
---
14+
{{- end }} {{- /* range $i, $v := $versions */}}
15+
16+
{{- /* routemap (and other strategy specific objects) */}}
17+
{{- if not .Values.application.strategy }}
18+
{{ include "env.deployment-istio.none" . }}
19+
{{- else if eq "none" .Values.application.strategy }}
20+
{{ include "env.deployment-istio.none" . }}
21+
{{- else }}
22+
{{- printf "unknown or invalid application strategy (%s) for environment (%s)" .Values.application.strategy .Values.environment | fail }}
23+
{{- end }} {{- /* if eq ... .Values.application.strategy */}}
24+
25+
{{- end }} {{- /* define "env.deployment" */}}

0 commit comments

Comments
 (0)