Add missing security context for Keystone rally tests

Change-Id: I29a432f28a4d8dd57341152d60b34c5a391e872f
This commit is contained in:
DODDA, PRATEEK REDDY (pd2839) 2020-07-16 13:11:49 -05:00
parent 8c9b9a63bf
commit 2eaa98ecf1
2 changed files with 18 additions and 0 deletions

View File

@ -33,6 +33,7 @@ metadata:
{{ dict "envAll" $envAll "podName" "keystone-test" "containerNames" (list "init" "keystone-test" "keystone-test-ks-user") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 4 }}
spec:
restartPolicy: Never
{{ dict "envAll" $envAll "application" "test" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 2 }}
nodeSelector:
{{ .Values.labels.test.node_selector_key }}: {{ .Values.labels.test.node_selector_value }}
serviceAccountName: {{ $serviceAccountName }}
@ -41,6 +42,7 @@ spec:
- name: keystone-test-ks-user
{{ tuple $envAll "ks_user" | include "helm-toolkit.snippets.image" | indent 6 }}
{{ tuple $envAll $envAll.Values.pod.resources.jobs.ks_user | include "helm-toolkit.snippets.kubernetes_resources" | indent 6 }}
{{ dict "envAll" $envAll "application" "test" "container" "keystone_test_ks_user" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 6 }}
command:
- /tmp/ks-user.sh
volumeMounts:
@ -66,6 +68,7 @@ spec:
- name: keystone-test
{{ tuple $envAll "test" | include "helm-toolkit.snippets.image" | indent 6 }}
{{ tuple $envAll $envAll.Values.pod.resources.jobs.tests | include "helm-toolkit.snippets.kubernetes_resources" | indent 6 }}
{{ dict "envAll" $envAll "application" "test" "container" "keystone_test" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 6}}
env:
{{- with $env := dict "ksUserSecret" .Values.secrets.identity.admin "useCA" .Values.manifests.certificates }}
{{- include "helm-toolkit.snippets.keystone_openrc_env_vars" $env | indent 8 }}
@ -90,6 +93,8 @@ spec:
readOnly: true
- name: rally-db
mountPath: /var/lib/rally
- name: rally-work
mountPath: /home/rally/.rally
{{- dict "enabled" .Values.manifests.certificates "name" .Values.secrets.tls.identity.api.internal | include "helm-toolkit.snippets.tls_volume_mount" | indent 8 }}
{{ if $mounts_tests.volumeMounts }}{{ toYaml $mounts_tests.volumeMounts | indent 8 }}{{ end }}
volumes:
@ -105,6 +110,8 @@ spec:
defaultMode: 0555
- name: rally-db
emptyDir: {}
- name: rally-work
emptyDir: {}
{{- dict "enabled" .Values.manifests.certificates "name" .Values.secrets.tls.identity.api.internal | include "helm-toolkit.snippets.tls_volume" | indent 4 }}
{{ if $mounts_tests.volumes }}{{ toYaml $mounts_tests.volumes | indent 4 }}{{ end }}
{{- end }}

View File

@ -193,6 +193,17 @@ pod:
keystone_domain_manage:
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
test:
pod:
runAsUser: 42424
container:
keystone_test_ks_user:
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
keystone_test:
runAsUser: 65500
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
affinity:
anti:
type: