Merge "Add missing security context to Cinder pods/containers"

This commit is contained in:
Zuul 2020-07-13 18:57:50 +00:00 committed by Gerrit Code Review
commit c35a74c729
4 changed files with 31 additions and 3 deletions

View File

@ -45,6 +45,7 @@ spec:
labels:
{{ tuple $envAll "cinder" "volume-usage-audit" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 12 }}
spec:
{{ dict "envAll" $envAll "application" "volume_usage_audit" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 10 }}
serviceAccountName: {{ $serviceAccountName }}
restartPolicy: OnFailure
nodeSelector:
@ -55,6 +56,7 @@ spec:
- name: cinder-volume-usage-audit
{{ tuple $envAll "cinder_volume_usage_audit" | include "helm-toolkit.snippets.image" | indent 14 }}
{{ tuple $envAll $envAll.Values.pod.resources.jobs.volume_usage_audit | include "helm-toolkit.snippets.kubernetes_resources" | indent 14 }}
{{ dict "envAll" $envAll "application" "volume_usage_audit" "container" "cinder_volume_usage_audit" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 14 }}
command:
- /tmp/volume-usage-audit.sh
volumeMounts:

View File

@ -61,7 +61,7 @@ spec:
{{ dict "envAll" $envAll "podName" "cinder-backup-storage-init" "containerNames" (list "cinder-backup-storage-init" "init") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }}
spec:
serviceAccountName: {{ $serviceAccountName }}
{{ dict "envAll" $envAll "application" "cinder" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }}
{{ dict "envAll" $envAll "application" "storage_init" | 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,8 +70,7 @@ spec:
{{- if (contains "cinder.backup.drivers.ceph" .Values.conf.cinder.DEFAULT.backup_driver) }}
- name: ceph-keyring-placement
{{ tuple $envAll "cinder_backup_storage_init" | include "helm-toolkit.snippets.image" | indent 10 }}
securityContext:
runAsUser: 0
{{ dict "envAll" $envAll "application" "storage_init" "container" "ceph_keyring_placement" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
command:
- /tmp/ceph-admin-keyring.sh
volumeMounts:
@ -101,6 +100,7 @@ spec:
- name: cinder-backup-storage-init
{{ tuple $envAll "cinder_backup_storage_init" | include "helm-toolkit.snippets.image" | indent 10 }}
{{ tuple $envAll $envAll.Values.pod.resources.jobs.backup_storage_init | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
{{ dict "envAll" $envAll "application" "storage_init" "container" "cinder_backup_storage_init" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
env:
- name: NAMESPACE
valueFrom:

View File

@ -34,6 +34,7 @@ spec:
labels:
{{ tuple $envAll $serviceName "create-internal-tenant" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
spec:
{{ dict "envAll" $envAll "application" "create_internal_tenant" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }}
serviceAccountName: {{ $serviceAccountName | quote }}
restartPolicy: OnFailure
nodeSelector:
@ -45,6 +46,7 @@ spec:
image: {{ $envAll.Values.images.tags.ks_user }}
imagePullPolicy: {{ $envAll.Values.images.pull_policy }}
{{ tuple $envAll $envAll.Values.pod.resources.jobs.ks_user | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
{{ dict "envAll" $envAll "application" "create_internal_tenant" "container" "create_internal_tenant" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
command:
- /tmp/create-internal-tenant.sh
volumeMounts:

View File

@ -77,6 +77,13 @@ jobs:
pod:
security_context:
volume_usage_audit:
pod:
runAsUser: 42424
container:
cinder_volume_usage_audit:
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
cinder_api:
pod:
runAsUser: 42424
@ -134,6 +141,23 @@ pod:
readOnlyRootFilesystem: true
cinder_volume:
readOnlyRootFilesystem: true
storage_init:
pod:
runAsUser: 42424
container:
ceph_keyring_placement:
runAsUser: 0
readOnlyRootFilesystem: true
cinder_backup_storage_init:
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
create_internal_tenant:
pod:
runAsUser: 42424
container:
create_internal_tenant:
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
affinity:
anti:
type: