From 8afe46e97a63278bffdc6968b3dab9c8f8de968b Mon Sep 17 00:00:00 2001 From: Vicken Simonian Date: Sun, 12 Jul 2020 01:02:02 -0700 Subject: [PATCH] Enable setting the base url of the website Take into account the path of the base url in liveness and readiness check probes. This introduces `baseUrl` as a value to use for the chart's health checks and also to use to set the AIRFLOW__WEBSERVER__BASE_URL environment variable. --- chart/README.md | 1 + chart/templates/_helpers.yaml | 4 ++++ chart/templates/webserver/webserver-deployment.yaml | 4 ++-- chart/values.yaml | 3 +++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/chart/README.md b/chart/README.md index c0d7847624680..8be25a2a0259f 100644 --- a/chart/README.md +++ b/chart/README.md @@ -181,6 +181,7 @@ The following tables lists the configurable parameters of the Airflow chart and | `scheduler.resources.requests.memory` | Memory Request of scheduler | `~` | | `scheduler.airflowLocalSettings` | Custom Airflow local settings python file | `~` | | `scheduler.safeToEvict` | Allow Kubernetes to evict scheduler pods if needed (node downscaling) | `true` | +| `webserver.baseUrl` | The base url of the website | `~` | | `webserver.livenessProbe.initialDelaySeconds` | Webserver LivenessProbe initial delay | `15` | | `webserver.livenessProbe.timeoutSeconds` | Webserver LivenessProbe timeout seconds | `30` | | `webserver.livenessProbe.failureThreshold` | Webserver LivenessProbe failure threshold | `20` | diff --git a/chart/templates/_helpers.yaml b/chart/templates/_helpers.yaml index 833d6e2072d22..d1fdf8a48beca 100644 --- a/chart/templates/_helpers.yaml +++ b/chart/templates/_helpers.yaml @@ -91,6 +91,10 @@ value: {{ printf "%s=%s" $config.secretName $config.secretKey }} {{- end }} {{ end }} + {{- if .Values.webserver.baseUrl }} + - name: AIRFLOW__WEBSERVER__BASE_URL + value: {{ .Values.webserver.baseUrl }} + {{ end }} {{- end }} {{/* Git ssh key volume */}} diff --git a/chart/templates/webserver/webserver-deployment.yaml b/chart/templates/webserver/webserver-deployment.yaml index fe7dee5ee6b88..cdbb265235688 100644 --- a/chart/templates/webserver/webserver-deployment.yaml +++ b/chart/templates/webserver/webserver-deployment.yaml @@ -121,7 +121,7 @@ spec: containerPort: {{ .Values.ports.airflowUI }} livenessProbe: httpGet: - path: /health + path: {{ if .Values.webserver.baseUrl }}{{ with urlParse .Values.webserver.baseUrl }}{{ index . "path" }}{{ end }}{{ end }}/health port: {{ .Values.ports.airflowUI }} initialDelaySeconds: {{ .Values.webserver.livenessProbe.initialDelaySeconds | default 15 }} timeoutSeconds: {{ .Values.webserver.livenessProbe.timeoutSeconds | default 30 }} @@ -129,7 +129,7 @@ spec: periodSeconds: {{ .Values.webserver.livenessProbe.periodSeconds | default 5 }} readinessProbe: httpGet: - path: /health + path: {{ if .Values.webserver.baseUrl }}{{ with urlParse .Values.webserver.baseUrl }}{{ index . "path" }}{{ end }}{{ end }}/health port: {{ .Values.ports.airflowUI }} initialDelaySeconds: {{ .Values.webserver.readinessProbe.initialDelaySeconds | default 15 }} timeoutSeconds: {{ .Values.webserver.readinessProbe.timeoutSeconds | default 30 }} diff --git a/chart/values.yaml b/chart/values.yaml index f0d5fa4cb9df1..b2e20047de7f3 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -260,6 +260,9 @@ webserver: service: type: ClusterIP + # The base url of the website. Also sets the AIRFLOW__WEBSERVER__BASE_URL variable. + # baseUrl: "" + # Flower settings flower: # Additional network policies as needed