From db37122336a970857d0c0db52b9827e8e349187b Mon Sep 17 00:00:00 2001 From: "KHIYANI, RAHUL (rk0850)" Date: Mon, 6 Jul 2020 17:07:36 -0500 Subject: [PATCH] Implement helm-toolkit snippet to airflow pods/containers This updates the airflow chart to include the pod security context on the pod template. This also adds the container security context to set readOnlyRootFilesystem flag Change-Id: I84cd4581d6ae915e9caf5c50d407dfcc34b962b3 --- charts/shipyard/templates/job-airflow-db-init.yaml | 2 ++ charts/shipyard/templates/job-airflow-db-sync.yaml | 2 ++ charts/shipyard/values.yaml | 6 ++++++ 3 files changed, 10 insertions(+) diff --git a/charts/shipyard/templates/job-airflow-db-init.yaml b/charts/shipyard/templates/job-airflow-db-init.yaml index 9bc9b49d..7353d99e 100644 --- a/charts/shipyard/templates/job-airflow-db-init.yaml +++ b/charts/shipyard/templates/job-airflow-db-init.yaml @@ -36,6 +36,7 @@ spec: configmap-bin-hash: {{ tuple "configmap-airflow-bin.yaml" . | include "helm-toolkit.utils.hash" }} configmap-etc-hash: {{ tuple "configmap-airflow-etc.yaml" . | include "helm-toolkit.utils.hash" }} spec: +{{ dict "envAll" $envAll "application" "db_init" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }} serviceAccountName: {{ $serviceAccountName }} restartPolicy: OnFailure nodeSelector: @@ -47,6 +48,7 @@ spec: image: {{ .Values.images.tags.airflow_db_init | quote }} imagePullPolicy: {{ .Values.images.pull_policy | quote }} {{ tuple $envAll $envAll.Values.pod.resources.jobs.airflow_db_init | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} +{{ dict "envAll" $envAll "application" "db_init" "container" "airflow_db_init" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }} env: - name: DB_HOST valueFrom: diff --git a/charts/shipyard/templates/job-airflow-db-sync.yaml b/charts/shipyard/templates/job-airflow-db-sync.yaml index f6588d5b..fed1a677 100644 --- a/charts/shipyard/templates/job-airflow-db-sync.yaml +++ b/charts/shipyard/templates/job-airflow-db-sync.yaml @@ -36,6 +36,7 @@ spec: configmap-bin-hash: {{ tuple "configmap-airflow-bin.yaml" . | include "helm-toolkit.utils.hash" }} configmap-etc-hash: {{ tuple "configmap-airflow-etc.yaml" . | include "helm-toolkit.utils.hash" }} spec: +{{ dict "envAll" $envAll "application" "db_sync" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }} serviceAccountName: {{ $serviceAccountName }} restartPolicy: OnFailure nodeSelector: @@ -47,6 +48,7 @@ spec: image: {{ .Values.images.tags.airflow_db_sync }} imagePullPolicy: {{ .Values.images.pull_policy }} {{ tuple $envAll $envAll.Values.pod.resources.jobs.airflow_db_sync | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} +{{ dict "envAll" $envAll "application" "db_sync" "container" "airflow_db_sync" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }} command: - /tmp/airflow-db-sync.sh volumeMounts: diff --git a/charts/shipyard/values.yaml b/charts/shipyard/values.yaml index 7cec01b2..17220602 100644 --- a/charts/shipyard/values.yaml +++ b/charts/shipyard/values.yaml @@ -797,6 +797,9 @@ pod: shipyard_db_init: readOnlyRootFilesystem: true allowPrivilegeEscalation: false + airflow_db_init: + readOnlyRootFilesystem: false + allowPrivilegeEscalation: false db_sync: pod: runAsUser: 1000 @@ -804,6 +807,9 @@ pod: shipyard_db_sync: readOnlyRootFilesystem: true allowPrivilegeEscalation: false + airflow_db_sync: + readOnlyRootFilesystem: false + allowPrivilegeEscalation: false api_test: pod: runAsUser: 1000