From 3479c06794793796d7dc0bb5061333abcdd8e75f Mon Sep 17 00:00:00 2001 From: omonnier Date: Mon, 18 Nov 2019 16:47:41 +0100 Subject: [PATCH] =?UTF-8?q?[stable/airflow]=20Add=20DAG=20git=20ref=20to?= =?UTF-8?q?=20the=20scheduler=20and=20web=20pod=20annotat=E2=80=A6=20(#189?= =?UTF-8?q?56)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [stable/airflow] Add a flag to disable disruption budget pod Pod Disruptions may be disabled on Kubernetes cluster. Signed-off-by: Olivier Monnier <5500018+omonnier@users.noreply.github.com> * [stable/airflow] Add DAG git ref to the scheduler and web pod annotations This will trigger a pod restart whenever the git ref changes on the git project containing the DAGS. Signed-off-by: Olivier Monnier <5500018+omonnier@users.noreply.github.com> --- stable/airflow/Chart.yaml | 2 +- stable/airflow/README.md | 3 ++- stable/airflow/templates/deployments-scheduler.yaml | 3 +++ stable/airflow/templates/deployments-web.yaml | 3 +++ stable/airflow/templates/poddisruptionbudget.yaml | 2 ++ stable/airflow/values.yaml | 1 + 6 files changed, 12 insertions(+), 2 deletions(-) diff --git a/stable/airflow/Chart.yaml b/stable/airflow/Chart.yaml index 9f3adc50dc..35a98ee751 100644 --- a/stable/airflow/Chart.yaml +++ b/stable/airflow/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v1 description: Airflow is a platform to programmatically author, schedule and monitor workflows name: airflow -version: 4.4.1 +version: 4.4.3 appVersion: 1.10.4 icon: https://airflow.apache.org/_images/pin_large.png home: https://airflow.apache.org/ diff --git a/stable/airflow/README.md b/stable/airflow/README.md index 2400a2bef6..a101561ff4 100644 --- a/stable/airflow/README.md +++ b/stable/airflow/README.md @@ -353,7 +353,8 @@ The following table lists the configurable parameters of the Airflow chart and t | `airflow.schedulerNumRuns` | -1 to loop indefinitively, 1 to restart after each exec | | | `airflow.webReplicas` | how many replicas for web server | `1` | | `airflow.config` | custom airflow configuration env variables | `{}` | -| `airflow.podDisruptionBudget` | control pod disruption budget | `{'maxUnavailable': 1}` | +| `airflow.podDisruptionBudget.enabled` | enable pod disruption budget | `true` | +| `airflow.podDisruptionBudget.maxUnavailable` | control pod disruption budget | `1` | | `airflow.extraEnv` | specify additional environment variables to mount | `{}` | | `airflow.extraConfigmapMounts` | Additional configMap volume mounts on the airflow pods. | `[]` | | `airflow.podAnnotations` | annotations for scheduler, worker and web pods | `{}` | diff --git a/stable/airflow/templates/deployments-scheduler.yaml b/stable/airflow/templates/deployments-scheduler.yaml index f9cddab5db..0542bbdbd4 100644 --- a/stable/airflow/templates/deployments-scheduler.yaml +++ b/stable/airflow/templates/deployments-scheduler.yaml @@ -37,6 +37,9 @@ spec: checksum/config-scripts: {{ include (print $.Template.BasePath "/configmap-scripts.yaml") . | sha256sum }} checksum/config-variables-pools: {{ include (print $.Template.BasePath "/configmap-variables-pools.yaml") . | sha256sum }} checksum/secret-connections: {{ include (print $.Template.BasePath "/secret-connections.yaml") . | sha256sum }} + {{- if and ( .Values.dags.git.url ) ( .Values.dags.git.ref ) }} + checksum/dags-git-ref: {{ .Values.dags.git.ref }} + {{- end }} {{- if .Values.airflow.podAnnotations }} {{ toYaml .Values.airflow.podAnnotations | indent 8 }} {{- end }} diff --git a/stable/airflow/templates/deployments-web.yaml b/stable/airflow/templates/deployments-web.yaml index 8325fe6631..9df687a680 100644 --- a/stable/airflow/templates/deployments-web.yaml +++ b/stable/airflow/templates/deployments-web.yaml @@ -35,6 +35,9 @@ spec: checksum/config-env: {{ include (print $.Template.BasePath "/configmap-env.yaml") . | sha256sum }} checksum/config-git-clone: {{ include (print $.Template.BasePath "/configmap-git-clone.yaml") . | sha256sum }} checksum/config-scripts: {{ include (print $.Template.BasePath "/configmap-scripts.yaml") . | sha256sum }} + {{- if and ( .Values.dags.git.url ) ( .Values.dags.git.ref ) }} + checksum/dags-git-ref: {{ .Values.dags.git.ref }} + {{- end }} {{- if .Values.airflow.podAnnotations }} {{ toYaml .Values.airflow.podAnnotations | indent 8 }} {{- end }} diff --git a/stable/airflow/templates/poddisruptionbudget.yaml b/stable/airflow/templates/poddisruptionbudget.yaml index 116d96b628..0d6290f155 100644 --- a/stable/airflow/templates/poddisruptionbudget.yaml +++ b/stable/airflow/templates/poddisruptionbudget.yaml @@ -1,3 +1,4 @@ +{{- if .Values.airflow.podDisruptionBudget.enabled }} apiVersion: policy/v1beta1 kind: PodDisruptionBudget metadata: @@ -15,3 +16,4 @@ spec: component: scheduler release: {{ .Release.Name }} {{ toYaml .Values.airflow.podDisruptionBudget | indent 2 }} +{{- end }} diff --git a/stable/airflow/values.yaml b/stable/airflow/values.yaml index 7f98e6ebb8..593b487a46 100644 --- a/stable/airflow/values.yaml +++ b/stable/airflow/values.yaml @@ -108,6 +108,7 @@ airflow: ## ## Configure pod disruption budget for the scheduler podDisruptionBudget: + enabled: true maxUnavailable: 1 ## Add custom connections ## Use this to add Airflow connections for operators you use