Skip to content

Commit c7b0d54

Browse files
sergelogvinovmandre
authored andcommitted
[helm] occm cinder-csi securityContext (kubernetes#2286)
* Add podSecurityContext, securityContext. * Volumes cosmetic fixes
1 parent a4dfccc commit c7b0d54

File tree

4 files changed

+55
-9
lines changed

4 files changed

+55
-9
lines changed

charts/cinder-csi-plugin/templates/controllerplugin-deployment.yaml

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,12 @@ spec:
3131
{{- end }}
3232
spec:
3333
serviceAccount: csi-cinder-controller-sa
34+
securityContext:
35+
{{- toYaml .Values.csi.plugin.controllerPlugin.podSecurityContext | nindent 8 }}
3436
containers:
3537
- name: csi-attacher
38+
securityContext:
39+
{{- toYaml .Values.csi.plugin.controllerPlugin.securityContext | nindent 12 }}
3640
image: "{{ .Values.csi.attacher.image.repository }}:{{ .Values.csi.attacher.image.tag }}"
3741
imagePullPolicy: {{ .Values.csi.attacher.image.pullPolicy }}
3842
args:
@@ -54,6 +58,8 @@ spec:
5458
mountPath: /var/lib/csi/sockets/pluginproxy/
5559
resources: {{ toYaml .Values.csi.attacher.resources | nindent 12 }}
5660
- name: csi-provisioner
61+
securityContext:
62+
{{- toYaml .Values.csi.plugin.controllerPlugin.securityContext | nindent 12 }}
5763
image: "{{ .Values.csi.provisioner.image.repository }}:{{ .Values.csi.provisioner.image.tag }}"
5864
imagePullPolicy: {{ .Values.csi.provisioner.image.pullPolicy }}
5965
args:
@@ -77,6 +83,8 @@ spec:
7783
mountPath: /var/lib/csi/sockets/pluginproxy/
7884
resources: {{ toYaml .Values.csi.provisioner.resources | nindent 12 }}
7985
- name: csi-snapshotter
86+
securityContext:
87+
{{- toYaml .Values.csi.plugin.controllerPlugin.securityContext | nindent 12 }}
8088
image: "{{ .Values.csi.snapshotter.image.repository }}:{{ .Values.csi.snapshotter.image.tag }}"
8189
imagePullPolicy: {{ .Values.csi.snapshotter.image.pullPolicy }}
8290
args:
@@ -97,6 +105,8 @@ spec:
97105
name: socket-dir
98106
resources: {{ toYaml .Values.csi.snapshotter.resources | nindent 12 }}
99107
- name: csi-resizer
108+
securityContext:
109+
{{- toYaml .Values.csi.plugin.controllerPlugin.securityContext | nindent 12 }}
100110
image: "{{ .Values.csi.resizer.image.repository }}:{{ .Values.csi.resizer.image.tag }}"
101111
imagePullPolicy: {{ .Values.csi.resizer.image.pullPolicy }}
102112
args:
@@ -118,6 +128,8 @@ spec:
118128
mountPath: /var/lib/csi/sockets/pluginproxy/
119129
resources: {{ toYaml .Values.csi.resizer.resources | nindent 12 }}
120130
- name: liveness-probe
131+
securityContext:
132+
{{- toYaml .Values.csi.plugin.controllerPlugin.securityContext | nindent 12 }}
121133
image: "{{ .Values.csi.livenessprobe.image.repository }}:{{ .Values.csi.livenessprobe.image.tag }}"
122134
imagePullPolicy: {{ .Values.csi.livenessprobe.image.pullPolicy }}
123135
args:
@@ -136,6 +148,8 @@ spec:
136148
name: socket-dir
137149
resources: {{ toYaml .Values.csi.livenessprobe.resources | nindent 12 }}
138150
- name: cinder-csi-plugin
151+
securityContext:
152+
{{- toYaml .Values.csi.plugin.controllerPlugin.securityContext | nindent 12 }}
139153
image: "{{ .Values.csi.plugin.image.repository }}:{{ .Values.csi.plugin.image.tag | default .Chart.AppVersion }}"
140154
imagePullPolicy: {{ .Values.csi.plugin.image.pullPolicy }}
141155
args:
@@ -172,7 +186,9 @@ spec:
172186
volumeMounts:
173187
- name: socket-dir
174188
mountPath: /csi
175-
{{- .Values.csi.plugin.volumeMounts | toYaml | trimSuffix "\n" | nindent 12 }}
189+
{{- with .Values.csi.plugin.volumeMounts }}
190+
{{- toYaml . | nindent 12 }}
191+
{{- end }}
176192
resources: {{ toYaml .Values.csi.plugin.resources | nindent 12 }}
177193
volumes:
178194
- name: socket-dir
@@ -181,13 +197,14 @@ spec:
181197
- name: cloud-config
182198
secret:
183199
secretName: {{ .Values.secret.name }}
184-
{{- end }}
185-
{{- if .Values.secret.hostMount }}
200+
{{- else if .Values.secret.hostMount }}
186201
- name: cloud-config
187202
hostPath:
188203
path: /etc/kubernetes
189204
{{- end }}
190-
{{ .Values.csi.plugin.volumes | toYaml | trimSuffix "\n" | nindent 8 }}
205+
{{- with .Values.csi.plugin.volumes }}
206+
{{- toYaml . | nindent 8 }}
207+
{{- end }}
191208
affinity: {{ toYaml .Values.csi.plugin.controllerPlugin.affinity | nindent 8 }}
192209
nodeSelector: {{ toYaml .Values.csi.plugin.controllerPlugin.nodeSelector | nindent 8 }}
193210
tolerations: {{ toYaml .Values.csi.plugin.controllerPlugin.tolerations | nindent 8 }}

charts/cinder-csi-plugin/templates/nodeplugin-daemonset.yaml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ spec:
2626
hostNetwork: true
2727
containers:
2828
- name: node-driver-registrar
29+
securityContext:
30+
{{- toYaml .Values.csi.plugin.nodePlugin.securityContext | nindent 12 }}
2931
image: "{{ .Values.csi.nodeDriverRegistrar.image.repository }}:{{ .Values.csi.nodeDriverRegistrar.image.tag }}"
3032
imagePullPolicy: {{ .Values.csi.nodeDriverRegistrar.image.pullPolicy }}
3133
args:
@@ -53,6 +55,8 @@ spec:
5355
mountPath: /registration
5456
resources: {{ toYaml .Values.csi.nodeDriverRegistrar.resources | nindent 12 }}
5557
- name: liveness-probe
58+
securityContext:
59+
{{- toYaml .Values.csi.plugin.nodePlugin.securityContext | nindent 12 }}
5660
image: "{{ .Values.csi.livenessprobe.image.repository }}:{{ .Values.csi.livenessprobe.image.tag }}"
5761
imagePullPolicy: {{ .Values.csi.livenessprobe.image.pullPolicy }}
5862
args:
@@ -112,7 +116,9 @@ spec:
112116
- name: pods-probe-dir
113117
mountPath: /dev
114118
mountPropagation: "HostToContainer"
115-
{{- .Values.csi.plugin.volumeMounts | toYaml | trimSuffix "\n" | nindent 12 }}
119+
{{- with .Values.csi.plugin.volumeMounts }}
120+
{{- toYaml . | nindent 12 }}
121+
{{- end }}
116122
resources: {{ toYaml .Values.csi.plugin.resources | nindent 12 }}
117123
volumes:
118124
- name: socket-dir
@@ -139,13 +145,14 @@ spec:
139145
- name: cloud-config
140146
secret:
141147
secretName: {{ .Values.secret.name }}
142-
{{- end }}
143-
{{- if .Values.secret.hostMount }}
148+
{{- else if .Values.secret.hostMount }}
144149
- name: cloud-config
145150
hostPath:
146151
path: /etc/kubernetes
147152
{{- end }}
148-
{{ .Values.csi.plugin.volumes | toYaml | trimSuffix "\n" | nindent 8 }}
153+
{{- with .Values.csi.plugin.volumes }}
154+
{{- toYaml . | nindent 8 }}
155+
{{- end }}
149156
affinity: {{ toYaml .Values.csi.plugin.nodePlugin.affinity | nindent 8 }}
150157
nodeSelector: {{ toYaml .Values.csi.plugin.nodePlugin.nodeSelector | nindent 8 }}
151158
tolerations: {{ toYaml .Values.csi.plugin.nodePlugin.tolerations | nindent 8 }}

charts/cinder-csi-plugin/values.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@ csi:
6969
mountPath: /etc/kubernetes
7070
readOnly: true
7171
nodePlugin:
72+
podSecurityContext: {}
73+
securityContext: {}
74+
# capabilities:
75+
# drop:
76+
# - ALL
77+
# seccompProfile:
78+
# type: RuntimeDefault
7279
affinity: {}
7380
nodeSelector: {}
7481
tolerations:
@@ -87,6 +94,19 @@ csi:
8794
# maxSurge is the maximum number of pods that can be
8895
# created over the desired number of pods.
8996
maxSurge: 1
97+
podSecurityContext: {}
98+
# runAsNonRoot: true
99+
# runAsUser: 65532
100+
# runAsGroup: 65532
101+
# fsGroup: 65532
102+
# fsGroupChangePolicy: OnRootMismatch
103+
securityContext: {}
104+
# capabilities:
105+
# drop:
106+
# - ALL
107+
# seccompProfile:
108+
# type: RuntimeDefault
109+
# readOnlyRootFilesystem: true
90110
affinity: {}
91111
nodeSelector: {}
92112
tolerations: []

charts/openstack-cloud-controller-manager/values.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ livenessProbe: {}
3838
readinessProbe: {}
3939

4040
# Set nodeSelector where the controller shut run, i.e. controlplane nodes
41-
nodeSelector: []
41+
nodeSelector: {}
4242
# nodeSelector:
4343
# node-role.kubernetes.io/controlplane: "true"
4444

@@ -59,6 +59,8 @@ tolerations: []
5959
# For all available options, see https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.23/#podsecuritycontext-v1-core
6060
podSecurityContext:
6161
runAsUser: 1001
62+
# seccompProfile:
63+
# type: RuntimeDefault
6264

6365
# List of controllers should be enabled.
6466
# Use '*' to enable all controllers.

0 commit comments

Comments
 (0)