Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add airflow.defaultContainerSecurityContext value #624

Merged
merged 3 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions charts/airflow/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ Parameter | Description | Default
`airflow.defaultAffinity` | default affinity configs for airflow Pods (is overridden by pod-specific values) | `{}`
`airflow.defaultTolerations` | default toleration configs for airflow Pods (is overridden by pod-specific values) | `[]`
`airflow.defaultSecurityContext` | default securityContext configs for Pods (is overridden by pod-specific values) | `{fsGroup: 0}`
`airflow.defaultContainerSecurityContext` | default securityContext for Containers in airflow Pods | `{}`
`airflow.podAnnotations` | extra annotations for airflow Pods | `{}`
`airflow.extraPipPackages` | extra pip packages to install in airflow Pods | `[]`
`airflow.protectedPipPackages` | pip packages that are protected from upgrade/downgrade by `extraPipPackages` | `["apache-airflow"]`
Expand Down
6 changes: 6 additions & 0 deletions charts/airflow/templates/_helpers/pods.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ imagePullPolicy: {{ .Values.airflow.image.pullPolicy }}
securityContext:
runAsUser: {{ .Values.airflow.image.uid }}
runAsGroup: {{ .Values.airflow.image.gid }}
{{- if .Values.airflow.defaultContainerSecurityContext }}
{{- omit .Values.airflow.defaultContainerSecurityContext "runAsUser" "runAsGroup" | toYaml | nindent 2 }}
{{- end }}
{{- end }}

{{/*
Expand Down Expand Up @@ -199,6 +202,9 @@ EXAMPLE USAGE: {{ include "airflow.container.git_sync" (dict "Release" .Release
securityContext:
runAsUser: {{ .Values.dags.gitSync.image.uid }}
runAsGroup: {{ .Values.dags.gitSync.image.gid }}
{{- if .Values.airflow.defaultContainerSecurityContext }}
{{- omit .Values.airflow.defaultContainerSecurityContext "runAsUser" "runAsGroup" | toYaml | nindent 4 }}
{{- end }}
resources:
{{- toYaml .Values.dags.gitSync.resources | nindent 4 }}
envFrom:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ spec:
securityContext:
runAsUser: {{ .Values.pgbouncer.image.uid }}
runAsGroup: {{ .Values.pgbouncer.image.gid }}
{{- if .Values.airflow.defaultContainerSecurityContext }}
{{- omit .Values.airflow.defaultContainerSecurityContext "runAsUser" "runAsGroup" | toYaml | nindent 12 }}
{{- end }}
resources:
{{- toYaml .Values.pgbouncer.resources | nindent 12 }}
envFrom:
Expand Down
10 changes: 9 additions & 1 deletion charts/airflow/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,14 @@ airflow:
## this does NOT give root permissions to Pods, only the "root" group
fsGroup: 0

## default securityContext for Containers in airflow Pods
## - spec for SecurityContext:
## https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#securitycontext-v1-core
## - `runAsUser` is ignored, please set with per-image `*.image.uid`
## - `runAsGroup` is ignored, please set with per-image `*.image.gid`
##
defaultContainerSecurityContext: {}

## extra annotations for airflow Pods
##
podAnnotations: {}
Expand Down Expand Up @@ -2029,7 +2037,7 @@ redis:
## the access mode of the PVC
##
accessModes:
- ReadWriteOnce
- ReadWriteOnce

## the size of PVC to request
##
Expand Down
Loading