Skip to content

Commit 77cd6bb

Browse files
(helm/v2alpha): ensure properly customization of the manager values
Ensure that specs are obtained from input ( kustomize / install.yaml ) and parsed to the helm values. Also, that the chart/manager/manager.yaml properly consume those from the helm values
1 parent 045b3e1 commit 77cd6bb

File tree

14 files changed

+664
-104
lines changed

14 files changed

+664
-104
lines changed

docs/book/src/cronjob-tutorial/testdata/project/dist/chart/templates/manager/manager.yaml

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,16 @@ spec:
2323
spec:
2424
containers:
2525
- args:
26+
{{- if .Values.metrics.enable }}
2627
- --metrics-bind-address=:8443
27-
- --leader-elect
28+
{{- else }}
29+
# Bind to :0 to disable metrics server
30+
- --metrics-bind-address=:0
31+
{{- end }}
2832
- --health-probe-bind-address=:8081
33+
{{- range .Values.controllerManager.args }}
34+
- {{ . }}
35+
{{- end }}
2936
{{- if and .Values.certManager.enable .Values.metrics.enable }}
3037
- --metrics-cert-path=/tmp/k8s-metrics-server/metrics-certs
3138
{{- end }}
@@ -53,18 +60,17 @@ spec:
5360
initialDelaySeconds: 5
5461
periodSeconds: 10
5562
resources:
56-
limits:
57-
cpu: 500m
58-
memory: 128Mi
59-
requests:
60-
cpu: 10m
61-
memory: 64Mi
63+
{{- if .Values.controllerManager.resources }}
64+
{{- toYaml .Values.controllerManager.resources | nindent 20 }}
65+
{{- else }}
66+
{}
67+
{{- end }}
6268
securityContext:
63-
allowPrivilegeEscalation: false
64-
capabilities:
65-
drop:
66-
- ALL
67-
readOnlyRootFilesystem: true
69+
{{- if .Values.controllerManager.securityContext }}
70+
{{- toYaml .Values.controllerManager.securityContext | nindent 20 }}
71+
{{- else }}
72+
{}
73+
{{- end }}
6874
volumeMounts:
6975
{{- if and .Values.certManager.enable .Values.metrics.enable }}
7076
- mountPath: /tmp/k8s-metrics-server/metrics-certs
@@ -77,9 +83,11 @@ spec:
7783
readOnly: true
7884
{{- end }}
7985
securityContext:
80-
runAsNonRoot: true
81-
seccompProfile:
82-
type: RuntimeDefault
86+
{{- if .Values.controllerManager.podSecurityContext }}
87+
{{- toYaml .Values.controllerManager.podSecurityContext | nindent 14 }}
88+
{{- else }}
89+
{}
90+
{{- end }}
8391
serviceAccountName: project-controller-manager
8492
terminationGracePeriodSeconds: 10
8593
volumes:

docs/book/src/cronjob-tutorial/testdata/project/dist/chart/values.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ controllerManager:
77
tag: latest
88
pullPolicy: IfNotPresent
99

10+
# Arguments
11+
args:
12+
- --leader-elect
13+
1014
# Environment variables
1115
env: []
1216

docs/book/src/getting-started/testdata/project/dist/chart/templates/manager/manager.yaml

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,16 @@ spec:
2323
spec:
2424
containers:
2525
- args:
26+
{{- if .Values.metrics.enable }}
2627
- --metrics-bind-address=:8443
27-
- --leader-elect
28+
{{- else }}
29+
# Bind to :0 to disable metrics server
30+
- --metrics-bind-address=:0
31+
{{- end }}
2832
- --health-probe-bind-address=:8081
33+
{{- range .Values.controllerManager.args }}
34+
- {{ . }}
35+
{{- end }}
2936
command:
3037
- /manager
3138
image: "{{ .Values.controllerManager.image.repository }}:{{ .Values.controllerManager.image.tag }}"
@@ -44,23 +51,24 @@ spec:
4451
initialDelaySeconds: 5
4552
periodSeconds: 10
4653
resources:
47-
limits:
48-
cpu: 500m
49-
memory: 128Mi
50-
requests:
51-
cpu: 10m
52-
memory: 64Mi
54+
{{- if .Values.controllerManager.resources }}
55+
{{- toYaml .Values.controllerManager.resources | nindent 20 }}
56+
{{- else }}
57+
{}
58+
{{- end }}
5359
securityContext:
54-
allowPrivilegeEscalation: false
55-
capabilities:
56-
drop:
57-
- ALL
58-
readOnlyRootFilesystem: true
60+
{{- if .Values.controllerManager.securityContext }}
61+
{{- toYaml .Values.controllerManager.securityContext | nindent 20 }}
62+
{{- else }}
63+
{}
64+
{{- end }}
5965
volumeMounts: []
6066
securityContext:
61-
runAsNonRoot: true
62-
seccompProfile:
63-
type: RuntimeDefault
67+
{{- if .Values.controllerManager.podSecurityContext }}
68+
{{- toYaml .Values.controllerManager.podSecurityContext | nindent 14 }}
69+
{{- else }}
70+
{}
71+
{{- end }}
6472
serviceAccountName: project-controller-manager
6573
terminationGracePeriodSeconds: 10
6674
volumes: []

docs/book/src/getting-started/testdata/project/dist/chart/values.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ controllerManager:
77
tag: latest
88
pullPolicy: IfNotPresent
99

10+
# Arguments
11+
args:
12+
- --leader-elect
13+
1014
# Environment variables
1115
env: []
1216

docs/book/src/multiversion-tutorial/testdata/project/dist/chart/templates/manager/manager.yaml

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,16 @@ spec:
2323
spec:
2424
containers:
2525
- args:
26+
{{- if .Values.metrics.enable }}
2627
- --metrics-bind-address=:8443
27-
- --leader-elect
28+
{{- else }}
29+
# Bind to :0 to disable metrics server
30+
- --metrics-bind-address=:0
31+
{{- end }}
2832
- --health-probe-bind-address=:8081
33+
{{- range .Values.controllerManager.args }}
34+
- {{ . }}
35+
{{- end }}
2936
{{- if and .Values.certManager.enable .Values.metrics.enable }}
3037
- --metrics-cert-path=/tmp/k8s-metrics-server/metrics-certs
3138
{{- end }}
@@ -53,18 +60,17 @@ spec:
5360
initialDelaySeconds: 5
5461
periodSeconds: 10
5562
resources:
56-
limits:
57-
cpu: 500m
58-
memory: 128Mi
59-
requests:
60-
cpu: 10m
61-
memory: 64Mi
63+
{{- if .Values.controllerManager.resources }}
64+
{{- toYaml .Values.controllerManager.resources | nindent 20 }}
65+
{{- else }}
66+
{}
67+
{{- end }}
6268
securityContext:
63-
allowPrivilegeEscalation: false
64-
capabilities:
65-
drop:
66-
- ALL
67-
readOnlyRootFilesystem: true
69+
{{- if .Values.controllerManager.securityContext }}
70+
{{- toYaml .Values.controllerManager.securityContext | nindent 20 }}
71+
{{- else }}
72+
{}
73+
{{- end }}
6874
volumeMounts:
6975
{{- if and .Values.certManager.enable .Values.metrics.enable }}
7076
- mountPath: /tmp/k8s-metrics-server/metrics-certs
@@ -77,9 +83,11 @@ spec:
7783
readOnly: true
7884
{{- end }}
7985
securityContext:
80-
runAsNonRoot: true
81-
seccompProfile:
82-
type: RuntimeDefault
86+
{{- if .Values.controllerManager.podSecurityContext }}
87+
{{- toYaml .Values.controllerManager.podSecurityContext | nindent 14 }}
88+
{{- else }}
89+
{}
90+
{{- end }}
8391
serviceAccountName: project-controller-manager
8492
terminationGracePeriodSeconds: 10
8593
volumes:

docs/book/src/multiversion-tutorial/testdata/project/dist/chart/values.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ controllerManager:
77
tag: latest
88
pullPolicy: IfNotPresent
99

10+
# Arguments
11+
args:
12+
- --leader-elect
13+
1014
# Environment variables
1115
env: []
1216

0 commit comments

Comments
 (0)