Skip to content

Commit 2ec8a8b

Browse files
waterfoulinteon
authored andcommitted
Added options to override service account information, volumes, securityContext, and resources for all containers
Signed-off-by: Aaron Aichlmayr <[email protected]>
1 parent 0909b8e commit 2ec8a8b

File tree

3 files changed

+91
-25
lines changed

3 files changed

+91
-25
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
bin
22
_artifacts
3+
.idea

deploy/charts/csi-driver/templates/daemonset.yaml

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,17 @@ spec:
1717
imagePullSecrets:
1818
{{- toYaml . | nindent 8 }}
1919
{{- end }}
20+
automountServiceAccountToken: {{ .Values.automountServiceAccountToken }}
2021
serviceAccountName: {{ include "cert-manager-csi-driver.name" . }}
21-
containers:
2222

23+
{{- with .Values.securityContext }}
24+
securityContext:
25+
{{- toYaml . | nindent 12 }}
26+
{{- end }}
27+
containers:
2328
- name: node-driver-registrar
24-
image: "{{ .Values.nodeDriverRegistrarImage.repository }}{{- if (.Values.nodeDriverRegistrarImage.digest) -}} @{{.Values.nodeDriverRegistrarImage.digest}}{{- else -}}:{{ default $.Chart.AppVersion .Values.nodeDriverRegistrarImage.tag }} {{- end -}}"
25-
imagePullPolicy: {{ .Values.image.pullPolicy }}
29+
image: "{{ .Values.nodeDriverRegistrar.image.repository }}{{- if (.Values.nodeDriverRegistrar.image.digest) -}} @{{.Values.nodeDriverRegistrar.image.digest}}{{- else -}}:{{ default $.Chart.AppVersion .Values.nodeDriverRegistrar.image.tag }} {{- end -}}"
30+
imagePullPolicy: {{ .Values.nodeDriverRegistrar.image.pullPolicy }}
2631
args:
2732
- -v={{ .Values.app.logLevel }}
2833
- --csi-address=/plugin/csi.sock
@@ -37,25 +42,42 @@ spec:
3742
mountPath: /plugin
3843
- name: registration-dir
3944
mountPath: /registration
45+
{{- if gt (len .Values.nodeDriverRegistrar.volumeMounts) 0 }}
46+
{{- toYaml .Values.nodeDriverRegistrar.volumeMounts | nindent 12 }}
47+
{{- end }}
48+
{{- with .Values.nodeDriverRegistrar.securityContext }}
49+
securityContext:
50+
{{- toYaml . | nindent 12 }}
51+
{{- end }}
52+
resources:
53+
{{- toYaml .Values.nodeDriverRegistrar.resources | nindent 12 }}
4054

4155
- name: liveness-probe
42-
image: "{{ .Values.livenessProbeImage.repository }}:{{ .Values.livenessProbeImage.tag }}"
56+
image: "{{ .Values.livenessProbe.image.repository }}:{{ .Values.livenessProbe.image.tag }}"
4357
args:
4458
- --csi-address=/plugin/csi.sock
4559
- --probe-timeout=3s
4660
- --health-port={{.Values.app.livenessProbe.port}}
4761
- -v={{ .Values.app.logLevel }}
48-
imagePullPolicy: {{ .Values.livenessProbeImage.pullPolicy }}
62+
imagePullPolicy: {{ .Values.livenessProbe.image.pullPolicy }}
4963
volumeMounts:
5064
- name: plugin-dir
5165
mountPath: /plugin
66+
{{- if gt (len .Values.livenessProbe.volumeMounts) 0 }}
67+
{{- toYaml .Values.livenessProbe.volumeMounts | nindent 12 }}
68+
{{- end }}
69+
{{- with .Values.livenessProbe.securityContext }}
70+
securityContext:
71+
{{- toYaml . | nindent 12 }}
72+
{{- end }}
73+
resources:
74+
{{- toYaml .Values.livenessProbe.resources | nindent 12 }}
5275

5376
- name: cert-manager-csi-driver
77+
{{- with .Values.containerSecurityContext }}
5478
securityContext:
55-
privileged: true
56-
capabilities:
57-
add: ["SYS_ADMIN"]
58-
allowPrivilegeEscalation: true
79+
{{- toYaml . | nindent 12 }}
80+
{{- end }}
5981
image: "{{ .Values.image.repository }}{{- if (.Values.image.digest) -}} @{{.Values.image.digest}}{{- else -}}:{{ default $.Chart.AppVersion .Values.image.tag }} {{- end -}}"
6082
imagePullPolicy: {{ .Values.image.pullPolicy }}
6183
args :
@@ -81,6 +103,9 @@ spec:
81103
- name: csi-data-dir
82104
mountPath: /csi-data-dir
83105
mountPropagation: "Bidirectional"
106+
{{- if gt (len .Values.livenessProbe.volumeMounts) 0 }}
107+
{{- toYaml .Values.volumeMounts | nindent 12 }}
108+
{{- end }}
84109
ports:
85110
- containerPort: {{.Values.app.livenessProbe.port}}
86111
name: healthz
@@ -121,3 +146,6 @@ spec:
121146
path: {{ .Values.app.driver.csiDataDir }}
122147
type: DirectoryOrCreate
123148
name: csi-data-dir
149+
{{- if gt (len .Values.volumes) 0 }}
150+
{{- toYaml .Values.volumes | nindent 8 }}
151+
{{- end }}

deploy/charts/csi-driver/values.yaml

Lines changed: 53 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
automountServiceAccountToken: true
2+
13
image:
24
# -- Target image repository.
35
repository: quay.io/jetstack/cert-manager-csi-driver
@@ -12,23 +14,58 @@ image:
1214
imagePullSecrets: []
1315
#- name: Secret with Registry credentials
1416

15-
nodeDriverRegistrarImage:
16-
# -- Target image repository.
17-
repository: k8s.gcr.io/sig-storage/csi-node-driver-registrar
18-
# -- Target image version tag.
19-
tag: v2.5.0
20-
# -- Kubernetes imagePullPolicy on node-driver.
21-
pullPolicy: IfNotPresent
17+
volumes: []
18+
volumeMounts: []
2219

23-
livenessProbeImage:
24-
# -- Target image repository.
25-
repository: k8s.gcr.io/sig-storage/livenessprobe
26-
# -- Target image version tag.
27-
tag: v2.6.0
28-
# -- Kubernetes imagePullPolicy on liveness probe.
29-
pullPolicy: IfNotPresent
30-
# Setting a digest will override any tag
31-
# digest: sha256:xxxx
20+
# securityContext:
21+
22+
containerSecurityContext:
23+
privileged: true
24+
capabilities:
25+
add: ["SYS_ADMIN"]
26+
allowPrivilegeEscalation: true
27+
28+
nodeDriverRegistrar:
29+
image:
30+
# -- Target image repository.
31+
repository: k8s.gcr.io/sig-storage/csi-node-driver-registrar
32+
# -- Target image version tag.
33+
tag: v2.5.0
34+
# -- Kubernetes imagePullPolicy on node-driver.
35+
pullPolicy: IfNotPresent
36+
volumeMounts: []
37+
# securityContext:
38+
resources: { }
39+
# -- Kubernetes pod resource limits for cert-manager-csi-driver
40+
# limits:
41+
# cpu: 100m
42+
# memory: 128Mi
43+
# -- Kubernetes pod memory resource requests for cert-manager-csi-driver
44+
# requests:
45+
# cpu: 100m
46+
# memory: 128Mi
47+
48+
livenessProbe:
49+
image:
50+
# -- Target image repository.
51+
repository: k8s.gcr.io/sig-storage/livenessprobe
52+
# -- Target image version tag.
53+
tag: v2.6.0
54+
# -- Kubernetes imagePullPolicy on liveness probe.
55+
pullPolicy: IfNotPresent
56+
# Setting a digest will override any tag
57+
# digest: sha256:xxxx
58+
volumeMounts: []
59+
# securityContext:
60+
resources: { }
61+
# -- Kubernetes pod resource limits for cert-manager-csi-driver
62+
# limits:
63+
# cpu: 100m
64+
# memory: 128Mi
65+
# -- Kubernetes pod memory resource requests for cert-manager-csi-driver
66+
# requests:
67+
# cpu: 100m
68+
# memory: 128Mi
3269

3370
app:
3471
# -- Verbosity of cert-manager-csi-driver logging.

0 commit comments

Comments
 (0)