Skip to content
Closed
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
3 changes: 3 additions & 0 deletions chart/templates/configmaps/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ data:
airflow_local_settings.py: |
{{- if .Values.scheduler.airflowLocalSettings }}
{{ .Values.scheduler.airflowLocalSettings | nindent 4 }}
{{- else if .Values.podMutation.enabled }}
airflow_local_settings.py: |
{{ tpl .Values.podMutation.podMutationHookTpl . | nindent 4 }}
{{- end }}
{{- if and .Values.dags.gitSync.enabled .Values.dags.gitSync.knownHosts }}
known_hosts: |
Expand Down
2 changes: 1 addition & 1 deletion chart/templates/scheduler/scheduler-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ spec:
mountPath: {{ template "airflow_config_path" . }}
subPath: airflow.cfg
readOnly: true
{{- if .Values.scheduler.airflowLocalSettings }}
{{- if or ( .Values.scheduler.airflowLocalSettings ) ( .Values.podMutation.enabled ) }}
- name: config
mountPath: {{ template "airflow_local_setting_path" . }}
subPath: airflow_local_settings.py
Expand Down
36 changes: 36 additions & 0 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,42 @@ quotas: {}
# Define default/max/min values for pods and containers in namespace
limits: []

# Config Settings for pod_mutation_hook
# podMutation values will not apply if `scheduler.airflowLocalSettings` have been modified
podMutation:
enabled: false
# You can just add `tolerations` and `affinity` below
# or define this podMutationHookTpl however you like.
# Anything can be templated here since it is using `tpl` helm function
# If using Airflow < 2.0.0 use following mutation hook:
# from airflow.contrib.kubernetes.pod import Pod
# def pod_mutation_hook(pod: Pod):
# pod.tolerations += {{ toJson .Values.podMutation.tolerations }}
# pod.affinity.update({{ toJson .Values.podMutation.affinity }})
podMutationHookTpl: |
# Airflow >= 2.0.0 pod_mutation_hook
def pod_mutation_hook(pod): # type pod: k8s.V1Pod
pod.spec.tolerations = {{ toJson .Values.podMutation.tolerations }}
pod.spec.affinity = {{ toJson .Values.podMutation.affinity }}

# Any pods spun up using KubernetesExecutor or KubernetesPodOperator will contain these tolerations.
tolerations: []
# - key: "dynamic-pods"
# operator: "Equal"
# value: "true"
# effect: "NoSchedule"

# Pods spun up would land in the node that matches the affinity
affinity: {}
# nodeAffinity:
# requiredDuringSchedulingIgnoredDuringExecution:
# nodeSelectorTerms:
# - matchExpressions:
# - key: "company.io/dynamic-pods"
# operator: In
# values:
# - "true"

# This runs as a CronJob to cleanup old pods.
cleanup:
enabled: false
Expand Down