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
This commit is contained in:
KHIYANI, RAHUL (rk0850) 2020-07-06 17:07:36 -05:00 committed by Rahul Khiyani
parent 66d410779c
commit db37122336
3 changed files with 10 additions and 0 deletions

View File

@ -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:

View File

@ -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:

View File

@ -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