Skip to content

Commit f45f453

Browse files
authored
extract probe path from AIRFLOW__WEBSERVER__BASE_URL + ingress path validation (#120)
* extract liveness and readiness path for web container from airflow config setting Signed-off-by: bensta <[email protected]> * improve validation for ingress path values Signed-off-by: Mathew Wicks <[email protected]> * bump chart version Signed-off-by: Mathew Wicks <[email protected]>
1 parent 65d850e commit f45f453

File tree

4 files changed

+16
-9
lines changed

4 files changed

+16
-9
lines changed

charts/airflow/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: v1
22
description: airflow is a platform to programmatically author, schedule, and monitor workflows
33
name: airflow
4-
version: 8.0.4
4+
version: 8.0.5
55
appVersion: 2.0.1
66
icon: https://airflow.apache.org/_images/pin_large.png
77
home: https://airflow.apache.org/

charts/airflow/templates/_helpers/validate-values.tpl

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,14 @@
7373
{{- if .Values.ingress.web.path | hasSuffix "/" }}
7474
{{ required "The `ingress.web.path` should NOT include a trailing '/'!" nil }}
7575
{{- end }}
76+
{{- if .Values.airflow.config.AIRFLOW__WEBSERVER__BASE_URL }}
77+
{{- $webUrl := .Values.airflow.config.AIRFLOW__WEBSERVER__BASE_URL | urlParse }}
78+
{{- if not (eq .Values.ingress.web.path (get $webUrl "path")) }}
79+
{{ required (printf "The `ingress.web.path` must be compatable with `airflow.config.AIRFLOW__WEBSERVER__BASE_URL`! (try setting AIRFLOW__WEBSERVER__BASE_URL to 'http://{HOSTNAME}%s', rather than '%s')" .Values.ingress.web.path .Values.airflow.config.AIRFLOW__WEBSERVER__BASE_URL) nil }}
80+
{{- end }}
81+
{{- else }}
82+
{{ required (printf "If `ingress.web.path` is set, then `airflow.config.AIRFLOW__WEBSERVER__BASE_URL` must be set! (try setting AIRFLOW__WEBSERVER__BASE_URL to 'http://{HOSTNAME}%s')" .Values.ingress.web.path) nil }}
83+
{{- end }}
7684
{{- end }}
7785

7886
{{/* Checks for `ingress.flower.path` */}}
@@ -85,8 +93,10 @@
8593
{{- end }}
8694
{{- if .Values.airflow.config.AIRFLOW__CELERY__FLOWER_URL_PREFIX }}
8795
{{- if not (eq .Values.ingress.flower.path .Values.airflow.config.AIRFLOW__CELERY__FLOWER_URL_PREFIX) }}
88-
{{ required "The `ingress.flower.path` should be the same as `airflow.config.AIRFLOW__CELERY__FLOWER_URL_PREFIX`!" nil }}
96+
{{ required (printf "The `ingress.flower.path` must be compatable with `airflow.config.AIRFLOW__CELERY__FLOWER_URL_PREFIX`! (try setting AIRFLOW__CELERY__FLOWER_URL_PREFIX to '%s', rather than '%s')" .Values.ingress.flower.path .Values.airflow.config.AIRFLOW__CELERY__FLOWER_URL_PREFIX) nil }}
8997
{{- end }}
98+
{{- else }}
99+
{{ required (printf "If `ingress.flower.path` is set, then `airflow.config.AIRFLOW__CELERY__FLOWER_URL_PREFIX` must be set! (try setting AIRFLOW__CELERY__FLOWER_URL_PREFIX to '%s')" .Values.ingress.flower.path) nil }}
90100
{{- end }}
91101
{{- end }}
92102
{{- end }}

charts/airflow/templates/config/secret-config.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,6 @@ stringData:
9595
AIRFLOW__SCHEDULER__DAG_DIR_LIST_INTERVAL: {{ .Values.dags.gitSync.syncWait | quote }}
9696
{{- end }}
9797

98-
{{- if and (.Values.ingress.enabled) (.Values.ingress.flower.path) (not .Values.airflow.config.AIRFLOW__CELERY__FLOWER_URL_PREFIX) }}
99-
## ensuring the ingress path is aligned with flower URL prefix
100-
AIRFLOW__CELERY__FLOWER_URL_PREFIX: {{ .Values.ingress.flower.path | quote }}
101-
{{- end }}
102-
10398
{{- if .Values.airflow.legacyCommands }}
10499
{{- if not .Values.airflow.config.AIRFLOW__WEBSERVER__RBAC }}
105100
## default to the RBAC UI when in legacy mode

charts/airflow/templates/webserver/webserver-deployment.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@ spec:
111111
failureThreshold: {{ .Values.web.livenessProbe.failureThreshold }}
112112
httpGet:
113113
scheme: {{ include "airflow.web.scheme" . }}
114-
path: "/health"
114+
{{- $airflowUrl := .Values.airflow.config.AIRFLOW__WEBSERVER__BASE_URL | default "" | printf "%s/health" | urlParse }}
115+
path: {{ get $airflowUrl "path" }}
115116
port: web
116117
{{- end }}
117118
{{- if .Values.web.readinessProbe.enabled }}
@@ -122,7 +123,8 @@ spec:
122123
failureThreshold: {{ .Values.web.readinessProbe.failureThreshold }}
123124
httpGet:
124125
scheme: {{ include "airflow.web.scheme" . }}
125-
path: "/health"
126+
{{- $airflowUrl := .Values.airflow.config.AIRFLOW__WEBSERVER__BASE_URL | default "" | printf "%s/health" | urlParse }}
127+
path: {{ get $airflowUrl "path" }}
126128
port: web
127129
{{- end }}
128130
{{- $extraVolumeMounts := .Values.web.extraVolumeMounts }}

0 commit comments

Comments
 (0)