From ded99204b2d58e92c4b7f051a6d6f6f8ed0c8148 Mon Sep 17 00:00:00 2001 From: Pete Birley Date: Fri, 15 Feb 2019 20:11:04 -0600 Subject: [PATCH] HTK: Update pod security context snippet This PS updates the pod security context snippet to support a more sane values layout. Change-Id: Id25441802a23e2dd00ad656cec2428432359dbe5 Signed-off-by: Pete Birley --- .../snippets/_kubernetes_pod_security_context.tpl | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/helm-toolkit/templates/snippets/_kubernetes_pod_security_context.tpl b/helm-toolkit/templates/snippets/_kubernetes_pod_security_context.tpl index cafb90093..fbf48d6d5 100644 --- a/helm-toolkit/templates/snippets/_kubernetes_pod_security_context.tpl +++ b/helm-toolkit/templates/snippets/_kubernetes_pod_security_context.tpl @@ -22,8 +22,8 @@ values: | user: myApp: uid: 34356 - myApp: - security_context: + security_context: + myApp: readOnlyRootFilesystem: true seLinuxOptions: level: "s0:c123,c456" @@ -42,7 +42,9 @@ return: | {{- $application := index . "application" -}} securityContext: runAsUser: {{ index $envAll.Values.pod.user $application "uid" }} -{{- if hasKey (index $envAll.Values.pod $application) "security_context" }} -{{ toYaml (index $envAll.Values.pod $application "security_context") | indent 2 }} -{{- end }} +{{- if hasKey $envAll.Values.pod "security_context" }} +{{- if hasKey ( index $envAll.Values.pod.security_context ) $application }} +{{ toYaml ( index $envAll.Values.pod.security_context $application ) | indent 2 }} +{{- end -}} +{{- end -}} {{- end -}}