Add missing security context to Cinder pods/containers

This updates the cinder chart to include the pod
security context on the pod template.

This also adds the container security context to set
readOnlyRootFilesystem flag to true

Change-Id: Ia6e3c56087bae6f8c86db688404c6ce3a1d5d99d
This commit is contained in:
PrateekDodda 2020-07-22 14:19:44 -05:00 committed by Prateek Dodda
parent e56deaf464
commit 711631d664
2 changed files with 9 additions and 0 deletions

View File

@ -60,6 +60,7 @@ spec:
{{ tuple $envAll "cinder" "clean" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
spec:
serviceAccountName: {{ $serviceAccountName }}
{{ dict "envAll" $envAll "application" "clean" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }}
restartPolicy: OnFailure
nodeSelector:
{{ .Values.labels.job.node_selector_key }}: {{ .Values.labels.job.node_selector_value }}
@ -70,6 +71,7 @@ spec:
- name: cinder-volume-rbd-secret-clean
{{ tuple $envAll "cinder_storage_init" | include "helm-toolkit.snippets.image" | indent 10 }}
{{ tuple $envAll $envAll.Values.pod.resources.jobs.clean | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
{{ dict "envAll" $envAll "application" "clean" "container" "cinder_volume_rbd_secret_clean" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
env:
- name: NAMESPACE
valueFrom:

View File

@ -151,6 +151,13 @@ pod:
cinder_backup_storage_init:
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
clean:
pod:
runAsUser: 42424
container:
cinder_volume_rbd_secret_clean:
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
create_internal_tenant:
pod:
runAsUser: 42424