-
Notifications
You must be signed in to change notification settings - Fork 476
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 dag processor deployment #577
Open
karakanb
wants to merge
7
commits into
airflow-helm:main
Choose a base branch
from
karakanb:feature/add-new-deployment-for-dag-processor
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
7f22e7e
feat: introduce a new deployment for the new standalone dag processor
karakanb 59919c6
feat: introduce the new values for the dag processor deployment in th…
karakanb 7e0a4a6
docs: add documentation for the new dag processor deployment to the r…
karakanb e241f8e
refactor: get rid of the unnecessary should_use for dagProcessor
karakanb 1572aaa
feat: add liveness probe for dagProcessor deployment
karakanb a82d3ab
revert: make dagProcessor disabled by default
karakanb c5a8b70
docs: remove the warning about legacyCommands, stopped checking that
karakanb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
137 changes: 137 additions & 0 deletions
137
charts/airflow/templates/dag-processor/dag-processor-deployment.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
{{- if .Values.dagProcessor.enabled }} | ||
{{- $podNodeSelector := include "airflow.podNodeSelector" (dict "Release" .Release "Values" .Values "nodeSelector" .Values.dagProcessor.nodeSelector) }} | ||
{{- $podAffinity := include "airflow.podAffinity" (dict "Release" .Release "Values" .Values "affinity" .Values.dagProcessor.affinity) }} | ||
{{- $podTolerations := include "airflow.podTolerations" (dict "Release" .Release "Values" .Values "tolerations" .Values.dagProcessor.tolerations) }} | ||
{{- $podSecurityContext := include "airflow.podSecurityContext" (dict "Release" .Release "Values" .Values "securityContext" .Values.dagProcessor.securityContext) }} | ||
{{- $extraPipPackages := concat .Values.airflow.extraPipPackages .Values.dagProcessor.extraPipPackages }} | ||
{{- $extraVolumeMounts := .Values.dagProcessor.extraVolumeMounts }} | ||
{{- $volumeMounts := include "airflow.volumeMounts" (dict "Release" .Release "Values" .Values "extraPipPackages" $extraPipPackages "extraVolumeMounts" $extraVolumeMounts) }} | ||
{{- $extraVolumes := .Values.dagProcessor.extraVolumes }} | ||
{{- $volumes := include "airflow.volumes" (dict "Release" .Release "Values" .Values "extraPipPackages" $extraPipPackages "extraVolumes" $extraVolumes) }} | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "airflow.fullname" . }}-dag-processor | ||
{{- if .Values.dagProcessor.annotations }} | ||
annotations: | ||
{{- toYaml .Values.dagProcessor.annotations | nindent 4 }} | ||
{{- end }} | ||
labels: | ||
app: {{ include "airflow.labels.app" . }} | ||
component: dag-processor | ||
chart: {{ include "airflow.labels.chart" . }} | ||
release: {{ .Release.Name }} | ||
heritage: {{ .Release.Service }} | ||
{{- if .Values.dagProcessor.labels }} | ||
{{- toYaml .Values.dagProcessor.labels | nindent 4 }} | ||
{{- end }} | ||
spec: | ||
replicas: {{ .Values.dagProcessor.replicas }} | ||
strategy: | ||
type: RollingUpdate | ||
rollingUpdate: | ||
## multiple dag-processor pods can run concurrently | ||
maxSurge: 25% | ||
maxUnavailable: 0 | ||
selector: | ||
matchLabels: | ||
app: {{ include "airflow.labels.app" . }} | ||
component: dag-processor | ||
release: {{ .Release.Name }} | ||
template: | ||
metadata: | ||
annotations: | ||
checksum/secret-config-envs: {{ include (print $.Template.BasePath "/config/secret-config-envs.yaml") . | sha256sum }} | ||
checksum/secret-local-settings: {{ include (print $.Template.BasePath "/config/secret-local-settings.yaml") . | sha256sum }} | ||
{{- if .Values.airflow.podAnnotations }} | ||
{{- toYaml .Values.airflow.podAnnotations | nindent 8 }} | ||
{{- end }} | ||
{{- if .Values.dagProcessor.podAnnotations }} | ||
{{- toYaml .Values.dagProcessor.podAnnotations | nindent 8 }} | ||
{{- end }} | ||
{{- if .Values.dagProcessor.safeToEvict }} | ||
cluster-autoscaler.kubernetes.io/safe-to-evict: "true" | ||
{{- end }} | ||
labels: | ||
app: {{ include "airflow.labels.app" . }} | ||
component: dag-processor | ||
release: {{ .Release.Name }} | ||
{{- if .Values.dagProcessor.podLabels }} | ||
{{- toYaml .Values.dagProcessor.podLabels | nindent 8 }} | ||
{{- end }} | ||
spec: | ||
restartPolicy: Always | ||
{{- if .Values.airflow.image.pullSecret }} | ||
imagePullSecrets: | ||
- name: {{ .Values.airflow.image.pullSecret }} | ||
{{- end }} | ||
{{- if $podNodeSelector }} | ||
nodeSelector: | ||
{{- $podNodeSelector | nindent 8 }} | ||
{{- end }} | ||
{{- if $podAffinity }} | ||
affinity: | ||
{{- $podAffinity | nindent 8 }} | ||
{{- end }} | ||
{{- if $podTolerations }} | ||
tolerations: | ||
{{- $podTolerations | nindent 8 }} | ||
{{- end }} | ||
serviceAccountName: {{ include "airflow.serviceAccountName" . }} | ||
{{- if $podSecurityContext }} | ||
securityContext: | ||
{{- $podSecurityContext | nindent 8 }} | ||
{{- end }} | ||
initContainers: | ||
{{- if $extraPipPackages }} | ||
{{- include "airflow.init_container.install_pip_packages" (dict "Release" .Release "Values" .Values "extraPipPackages" $extraPipPackages) | indent 8 }} | ||
{{- end }} | ||
{{- if and (.Values.dags.gitSync.enabled) (not .Values.dags.persistence.enabled) }} | ||
{{- include "airflow.container.git_sync" (dict "Release" .Release "Values" .Values "sync_one_time" "true") | indent 8 }} | ||
{{- end }} | ||
{{- include "airflow.init_container.check_db" (dict "Release" .Release "Values" .Values "volumeMounts" $volumeMounts) | indent 8 }} | ||
{{- include "airflow.init_container.wait_for_db_migrations" (dict "Release" .Release "Values" .Values "volumeMounts" $volumeMounts) | indent 8 }} | ||
containers: | ||
- name: airflow-dag-processor | ||
{{- include "airflow.image" . | indent 10 }} | ||
resources: | ||
{{- toYaml .Values.dagProcessor.resources | nindent 12 }} | ||
envFrom: | ||
{{- include "airflow.envFrom" . | indent 12 }} | ||
env: | ||
{{- include "airflow.env" . | indent 12 }} | ||
command: | ||
{{- include "airflow.command" . | indent 12 }} | ||
args: | ||
- "bash" | ||
- "-c" | ||
- "exec airflow dag-processor" | ||
{{- if .Values.dagProcessor.livenessProbe.enabled }} | ||
livenessProbe: | ||
initialDelaySeconds: {{ .Values.dagProcessor.livenessProbe.initialDelaySeconds }} | ||
periodSeconds: {{ .Values.dagProcessor.livenessProbe.periodSeconds }} | ||
failureThreshold: {{ .Values.dagProcessor.livenessProbe.failureThreshold }} | ||
timeoutSeconds: {{ .Values.dagProcessor.livenessProbe.timeoutSeconds }} | ||
exec: | ||
command: | ||
{{- include "airflow.command" . | indent 4 }} | ||
args: | ||
- "bash" | ||
- "-c" | ||
- CONNECTION_CHECK_MAX_COUNT=0 AIRFLOW__LOGGING__LOGGING_LEVEL=ERROR exec airflow jobs check | ||
{{- end }} | ||
{{- if $volumeMounts }} | ||
volumeMounts: | ||
{{- $volumeMounts | indent 12 }} | ||
{{- end }} | ||
{{- if and (.Values.dags.gitSync.enabled) (not .Values.dags.persistence.enabled) }} | ||
{{- include "airflow.container.git_sync" . | indent 8 }} | ||
{{- end }} | ||
{{- if .Values.airflow.extraContainers }} | ||
{{- toYaml .Values.airflow.extraContainers | nindent 8 }} | ||
{{- end }} | ||
{{- if $volumes }} | ||
volumes: | ||
{{- $volumes | indent 8 }} | ||
{{- end }} | ||
{{- end }} |
24 changes: 24 additions & 0 deletions
24
charts/airflow/templates/dag-processor/dag-processor-pdb.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{{- if and (.Values.dagProcessor.enabled) (.Values.dagProcessor.podDisruptionBudget.enabled) }} | ||
apiVersion: policy/v1beta1 | ||
kind: PodDisruptionBudget | ||
metadata: | ||
name: {{ include "airflow.fullname" . }}-dag-processor | ||
labels: | ||
app: {{ include "airflow.labels.app" . }} | ||
component: dag-processor | ||
chart: {{ include "airflow.labels.chart" . }} | ||
release: {{ .Release.Name }} | ||
heritage: {{ .Release.Service }} | ||
spec: | ||
{{- if .Values.dagProcessor.podDisruptionBudget.maxUnavailable }} | ||
maxUnavailable: {{ .Values.dagProcessor.podDisruptionBudget.maxUnavailable }} | ||
{{- end }} | ||
{{- if .Values.dagProcessor.podDisruptionBudget.minAvailable }} | ||
minAvailable: {{ .Values.dagProcessor.podDisruptionBudget.minAvailable }} | ||
{{- end }} | ||
selector: | ||
matchLabels: | ||
app: {{ include "airflow.labels.app" . }} | ||
component: dag-processor | ||
release: {{ .Release.Name }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1077,6 +1077,115 @@ triggerer: | |
## | ||
extraVolumes: [] | ||
|
||
################################### | ||
## COMPONENT | Dag Processor | ||
################################### | ||
dagProcessor: | ||
## if the airflow dag processor should be deployed | ||
## - [WARNING] the dag processor component was added in airflow 2.3.0 | ||
## | ||
enabled: false | ||
|
||
## the number of dag processor Pods to run | ||
## - if you set this >1 we recommend defining a `dagProcessor.podDisruptionBudget` | ||
## | ||
replicas: 1 | ||
|
||
## resource requests/limits for the dag processor Pods | ||
## - spec for ResourceRequirements: | ||
## https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#resourcerequirements-v1-core | ||
## | ||
resources: {} | ||
|
||
## the nodeSelector configs for the dag processor Pods | ||
## - docs for nodeSelector: | ||
## https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#nodeselector | ||
## | ||
nodeSelector: {} | ||
|
||
## the affinity configs for the dag processor Pods | ||
## - spec for Affinity: | ||
## https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#affinity-v1-core | ||
## | ||
affinity: {} | ||
|
||
## the toleration configs for the dag processor Pods | ||
## - spec for Toleration: | ||
## https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#toleration-v1-core | ||
## | ||
tolerations: [] | ||
|
||
## the security context for the dag processor Pods | ||
## - spec for PodSecurityContext: | ||
## https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#podsecuritycontext-v1-core | ||
## | ||
securityContext: {} | ||
|
||
## labels for the dag processor Deployment | ||
## | ||
labels: {} | ||
|
||
## Pod labels for the dag processor Deployment | ||
## | ||
podLabels: {} | ||
|
||
## annotations for the dag processor Deployment | ||
## | ||
annotations: {} | ||
|
||
## Pod annotations for the dag processor Deployment | ||
## | ||
podAnnotations: {} | ||
|
||
## if we add the annotation: "cluster-autoscaler.kubernetes.io/safe-to-evict" = "true" | ||
## | ||
safeToEvict: true | ||
|
||
## configs for the PodDisruptionBudget of the dag processor Deployment | ||
## | ||
podDisruptionBudget: | ||
## if a PodDisruptionBudget resource is created for the dag processor Deployment | ||
## | ||
enabled: false | ||
|
||
## the maximum unavailable pods/percentage for the dag processor Deployment | ||
## | ||
maxUnavailable: "" | ||
|
||
## the minimum available pods/percentage for the dag processor Deployment | ||
## | ||
minAvailable: "" | ||
|
||
## configs for the dag processor Pods' liveness probe | ||
## | ||
livenessProbe: | ||
enabled: true | ||
initialDelaySeconds: 10 | ||
periodSeconds: 30 | ||
timeoutSeconds: 60 | ||
failureThreshold: 5 | ||
Comment on lines
+1161
to
+1166
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should not have these values if we don't actually use them. |
||
|
||
## extra pip packages to install in the dag processor Pod | ||
## | ||
## ____ EXAMPLE _______________ | ||
## extraPipPackages: | ||
## - "SomeProject==1.0.0" | ||
## | ||
extraPipPackages: [] | ||
|
||
## extra VolumeMounts for the dag processor Pods | ||
## - spec for VolumeMount: | ||
## https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#volumemount-v1-core | ||
## | ||
extraVolumeMounts: [] | ||
|
||
## extra Volumes for the dag processor Pods | ||
## - spec for Volume: | ||
## https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#volume-v1-core | ||
## | ||
extraVolumes: [] | ||
|
||
|
||
################################### | ||
## COMPONENT | Flower | ||
################################### | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there is no
livenessProbe
we should remove this.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added a liveness probe, please give it a look