From 62c4040a41c903298431445f92d4e846968aab84 Mon Sep 17 00:00:00 2001 From: "KHIYANI, RAHUL (rk0850)" Date: Tue, 30 Jun 2020 00:19:38 -0500 Subject: [PATCH] Implement helm-toolkit snippet to promenade test pods/containers This updates the promenade 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: I688017f329b267e75178053b8e18d56090900f11 --- charts/promenade/templates/tests/test-promenade-api.yaml | 2 ++ charts/promenade/values.yaml | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/charts/promenade/templates/tests/test-promenade-api.yaml b/charts/promenade/templates/tests/test-promenade-api.yaml index 40cb9dd2..e6732476 100644 --- a/charts/promenade/templates/tests/test-promenade-api.yaml +++ b/charts/promenade/templates/tests/test-promenade-api.yaml @@ -30,6 +30,7 @@ metadata: labels: {{ tuple $envAll "promenade" "api-test" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} spec: +{{ dict "envAll" $envAll "application" "api_test" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 2 }} restartPolicy: Never nodeSelector: {{ .Values.labels.test.node_selector_key }}: {{ .Values.labels.test.node_selector_value }} @@ -43,6 +44,7 @@ spec: image: {{ .Values.images.tags.promenade }} imagePullPolicy: {{ .Values.images.pull_policy }} {{ tuple . .Values.pod.resources.test | include "helm-toolkit.snippets.kubernetes_resources" | indent 6 }} +{{ dict "envAll" $envAll "application" "api_test" "container" "promenade_api_test" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 6 }} command: ["/bin/bash", "-c", "curl -v -X GET --fail ${PROM_URL}/api/v1.0/health; exit $?"] ... {{- end }} diff --git a/charts/promenade/values.yaml b/charts/promenade/values.yaml index bc935bfa..6b0d3818 100644 --- a/charts/promenade/values.yaml +++ b/charts/promenade/values.yaml @@ -180,8 +180,15 @@ pod: runAsUser: 65534 container: promenade_api: - allowPrivilegeEscalation: false readOnlyRootFilesystem: true + allowPrivilegeEscalation: false + api_test: + pod: + runAsUser: 65534 + container: + promenade_api_test: + readOnlyRootFilesystem: true + allowPrivilegeEscalation: false mandatory_access_control: type: apparmor promenade-api: