Skip to content

Commit 215e33e

Browse files
committed
feat: add missing fields to values
modify serviceAccount to be able to use externally created SA Signed-off-by: David Sabatie <[email protected]>
1 parent fe94e7c commit 215e33e

27 files changed

+267
-102
lines changed

examples/app/templates/_helpers.tpl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,12 @@ app.kubernetes.io/instance: {{ .Release.Name }}
5454
Create the name of the service account to use
5555
*/}}
5656
{{- define "app.serviceAccountName" -}}
57-
{{- if .Values.serviceAccount.create }}
58-
{{- default (include "app.fullname" .) .Values.serviceAccount.name }}
57+
{{- $default := (include "app.fullname" .) }}
58+
{{- with .Values.serviceAccount }}
59+
{{- if .create }}
60+
{{- default $default .name }}
5961
{{- else }}
60-
{{- default "default" .Values.serviceAccount.name }}
62+
{{- default "default" .name }}
63+
{{- end }}
6164
{{- end }}
6265
{{- end }}

examples/app/templates/batch-job.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,10 @@ spec:
2121
| default .Chart.AppVersion }}
2222
name: pi
2323
resources: {}
24+
nodeSelector: {{- toYaml .Values.batchJob.nodeSelector | nindent 8 }}
2425
restartPolicy: Never
26+
serviceAccountName: {{ default "default" (include "app.serviceAccountName"
27+
.) }}
28+
tolerations: {{- toYaml .Values.batchJob.tolerations | nindent 8 }}
29+
topologySpreadConstraints: {{- toYaml .Values.batchJob.topologySpreadConstraints
30+
| nindent 8 }}

examples/app/templates/cron-job.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,11 @@ spec:
2222
imagePullPolicy: {{ .Values.cronJob.hello.imagePullPolicy }}
2323
name: hello
2424
resources: {}
25+
nodeSelector: {{- toYaml .Values.cronJob.nodeSelector | nindent 12 }}
2526
restartPolicy: OnFailure
27+
serviceAccountName: {{ default "default" (include "app.serviceAccountName"
28+
.) }}
29+
tolerations: {{- toYaml .Values.cronJob.tolerations | nindent 12 }}
30+
topologySpreadConstraints: {{- toYaml .Values.cronJob.topologySpreadConstraints
31+
| nindent 12 }}
2632
schedule: {{ .Values.cronJob.schedule | quote }}

examples/app/templates/daemonset.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,12 @@ spec:
3232
- mountPath: /var/lib/docker/containers
3333
name: varlibdockercontainers
3434
readOnly: true
35+
nodeSelector: {{- toYaml .Values.fluentdElasticsearch.nodeSelector | nindent 8 }}
36+
serviceAccountName: {{ default "default" (include "app.serviceAccountName" .) }}
3537
terminationGracePeriodSeconds: 30
36-
tolerations:
37-
- effect: NoSchedule
38-
key: node-role.kubernetes.io/master
39-
operator: Exists
38+
tolerations: {{- toYaml .Values.fluentdElasticsearch.tolerations | nindent 8 }}
39+
topologySpreadConstraints: {{- toYaml .Values.fluentdElasticsearch.topologySpreadConstraints
40+
| nindent 8 }}
4041
volumes:
4142
- hostPath:
4243
path: /var/log

examples/app/templates/deployment.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,11 @@ spec:
9696
resources: {}
9797
nodeSelector: {{- toYaml .Values.myapp.nodeSelector | nindent 8 }}
9898
securityContext: {{- toYaml .Values.myapp.podSecurityContext | nindent 8 }}
99+
serviceAccountName: {{ default "default" (include "app.serviceAccountName" .) }}
99100
terminationGracePeriodSeconds: 10
101+
tolerations: {{- toYaml .Values.myapp.tolerations | nindent 8 }}
102+
topologySpreadConstraints: {{- toYaml .Values.myapp.topologySpreadConstraints | nindent
103+
8 }}
100104
volumes:
101105
- configMap:
102106
name: {{ include "app.fullname" . }}-my-config

examples/app/templates/statefulset.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ spec:
2929
volumeMounts:
3030
- mountPath: /usr/share/nginx/html
3131
name: www
32+
nodeSelector: {{- toYaml .Values.web.nodeSelector | nindent 8 }}
33+
serviceAccountName: {{ default "default" (include "app.serviceAccountName" .)
34+
}}
35+
tolerations: {{- toYaml .Values.web.tolerations | nindent 8 }}
36+
topologySpreadConstraints: {{- toYaml .Values.web.topologySpreadConstraints |
37+
nindent 8 }}
3238
updateStrategy: {}
3339
volumeClaimTemplates:
3440
- metadata:

examples/app/values.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
batchJob:
22
backoffLimit: 4
3+
nodeSelector: {}
34
pi:
45
image:
56
repository: perl
67
tag: 5.34.0
8+
tolerations: []
9+
topologySpreadConstraints: []
710
cronJob:
811
hello:
912
image:
1013
repository: busybox
1114
tag: "1.28"
1215
imagePullPolicy: IfNotPresent
16+
nodeSelector: {}
1317
schedule: '* * * * *'
18+
tolerations: []
19+
topologySpreadConstraints: []
1420
fluentdElasticsearch:
1521
fluentdElasticsearch:
1622
image:
@@ -22,6 +28,12 @@ fluentdElasticsearch:
2228
requests:
2329
cpu: 100m
2430
memory: 200Mi
31+
nodeSelector: {}
32+
tolerations:
33+
- effect: NoSchedule
34+
key: node-role.kubernetes.io/master
35+
operator: Exists
36+
topologySpreadConstraints: []
2537
kubernetesClusterDomain: cluster.local
2638
myConfig:
2739
dummyconfigmapkey: dummyconfigmapvalue
@@ -89,6 +101,8 @@ myapp:
89101
tag: v0.8.0
90102
replicas: 3
91103
revisionHistoryLimit: 5
104+
tolerations: []
105+
topologySpreadConstraints: []
92106
myappLbService:
93107
loadBalancerSourceRanges:
94108
- 10.0.0.0/8
@@ -121,7 +135,10 @@ web:
121135
image:
122136
repository: registry.k8s.io/nginx-slim
123137
tag: "0.8"
138+
nodeSelector: {}
124139
replicas: 2
140+
tolerations: []
141+
topologySpreadConstraints: []
125142
volumeClaims:
126143
www:
127144
requests:

examples/operator/templates/deployment.yaml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,15 +96,12 @@ spec:
9696
nodeSelector: {{- toYaml .Values.controllerManager.nodeSelector | nindent 8 }}
9797
securityContext: {{- toYaml .Values.controllerManager.podSecurityContext | nindent
9898
8 }}
99-
serviceAccountName: {{ include "operator.fullname" . }}-controller-manager
99+
serviceAccountName: {{ default "default" (include "operator.serviceAccountName" .)
100+
}}
100101
terminationGracePeriodSeconds: 10
101-
topologySpreadConstraints:
102-
- matchLabelKeys:
103-
- app
104-
- pod-template-hash
105-
maxSkew: 1
106-
topologyKey: kubernetes.io/hostname
107-
whenUnsatisfiable: DoNotSchedule
102+
tolerations: {{- toYaml .Values.controllerManager.tolerations | nindent 8 }}
103+
topologySpreadConstraints: {{- toYaml .Values.controllerManager.topologySpreadConstraints
104+
| nindent 8 }}
108105
volumes:
109106
- configMap:
110107
name: {{ include "operator.fullname" . }}-manager-config

examples/operator/templates/leader-election-rbac.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,5 @@ roleRef:
4949
name: '{{ include "operator.fullname" . }}-leader-election-role'
5050
subjects:
5151
- kind: ServiceAccount
52-
name: '{{ include "operator.fullname" . }}-controller-manager'
52+
name: '{{ include "operator.serviceAccountName" . }}'
5353
namespace: '{{ .Release.Namespace }}'

examples/operator/templates/manager-rbac.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,5 +98,5 @@ roleRef:
9898
name: '{{ include "operator.fullname" . }}-manager-role'
9999
subjects:
100100
- kind: ServiceAccount
101-
name: '{{ include "operator.fullname" . }}-controller-manager'
101+
name: '{{ include "operator.serviceAccountName" . }}'
102102
namespace: '{{ .Release.Namespace }}'

0 commit comments

Comments
 (0)