From 59069fdb69b05f26af7d15b2109e47a285e73f35 Mon Sep 17 00:00:00 2001 From: Rahul Khiyani Date: Mon, 25 Nov 2019 10:38:55 -0600 Subject: [PATCH] Mysqlclient-utility: Add pod/container security context This updates the Mysqlclient-utility chart to include the pod security context on the pod template. This also adds the container security context to set readOnlyRootFilesystem flag to false Change-Id: I9c434f83cd9f03013f6ab9e3279da35a6d9d3893 --- .../mysqlclient-utility/templates/deployment-utility.yaml | 4 ++-- charts/mysqlclient-utility/values.yaml | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/charts/mysqlclient-utility/templates/deployment-utility.yaml b/charts/mysqlclient-utility/templates/deployment-utility.yaml index 7fb2e63a..575dfbd9 100644 --- a/charts/mysqlclient-utility/templates/deployment-utility.yaml +++ b/charts/mysqlclient-utility/templates/deployment-utility.yaml @@ -68,8 +68,7 @@ spec: labels: {{ tuple $envAll "mysqlclient" "utility" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} spec: - securityContext: - runAsUser: 65534 +{{ dict "envAll" $envAll "application" "mysqlclient" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }} serviceAccountName: {{ $serviceAccountName }} affinity: {{ tuple $envAll "mysqlclient" "utility" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} @@ -79,6 +78,7 @@ spec: - name: {{ printf "%s" $envAll.Release.Name }} {{ tuple $envAll "mysqlclient_utility" | include "helm-toolkit.snippets.image" | indent 10 }} {{ tuple $envAll $envAll.Values.pod.resources.mysql_utility | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} +{{ dict "envAll" $envAll "application" "mysqlclient" "container" "mysqlclient_utility" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }} command: - /tmp/bootstrap.sh readinessProbe: diff --git a/charts/mysqlclient-utility/values.yaml b/charts/mysqlclient-utility/values.yaml index 19ea1d7c..06270863 100644 --- a/charts/mysqlclient-utility/values.yaml +++ b/charts/mysqlclient-utility/values.yaml @@ -39,6 +39,14 @@ labels: node_selector_value: primary pod: + security_context: + mysqlclient: + pod: + runAsUser: 65534 + container: + mysqlclient_utility: + allowPrivilegeEscalation: true + readOnlyRootFilesystem: false dns_policy: "ClusterFirstWithHostNet" replicas: utility: 1