[bitnami/airflow] fix: use loadBalancerIP as a fallback for baseUrl (#4493)

* [bitnami/airflow] fix: use loadBalancerIP as fallback for baseUrl

Signed-off-by: darteaga <darteaga@vmware.com>

* fix: replace baseUrl in NOTES.txt

Signed-off-by: darteaga <darteaga@vmware.com>

* fix: airflow webserver host

Signed-off-by: darteaga <darteaga@vmware.com>
This commit is contained in:
Daniel Arteaga
2020-11-27 17:35:15 +01:00
committed by GitHub
parent 36c62d976c
commit 5d431c8dd6
8 changed files with 60 additions and 13 deletions

View File

@@ -32,4 +32,4 @@ name: airflow
sources:
- https://github.com/bitnami/bitnami-docker-airflow
- https://airflow.apache.org/
version: 7.0.2
version: 7.0.3

View File

@@ -1,7 +1,8 @@
{{- $airflowSecretName := include "airflow.secretName" . -}}
{{- $postgresqlSecretName := include "airflow.postgresql.secretName" . -}}
{{- $redisSecretName := include "airflow.redis.secretName" . -}}
{{- if not .Values.web.baseUrl -}}
{{- $baseUrl := (include "airflow.baseUrl" .) -}}
{{- if not $baseUrl -}}
###############################################################################
### ERROR: You did not provide an external URL in your 'helm install' call ###
###############################################################################
@@ -61,7 +62,7 @@ host. To configure Airflow with the URL of your service:
{{- if .Values.ingress.enabled }}
echo URL : {{ .Values.web.baseUrl }}
echo URL : {{ $baseUrl }}
{{- else if eq .Values.service.type "ClusterIP" }}
@@ -76,7 +77,7 @@ host. To configure Airflow with the URL of your service:
{{- else }}
echo URL : {{ .Values.web.baseUrl }}
echo URL : {{ $baseUrl }}
{{- end }}
2. Get your Airflow login credentials by running:

View File

@@ -276,10 +276,6 @@ Add environmnet variables to configure airflow common values
secretKeyRef:
name: {{ include "airflow.secretName" . }}
key: airflow-fernetKey
- name: AIRFLOW_WEBSERVER_HOST
value: {{ include "common.names.fullname" . }}
- name: AIRFLOW_WEBSERVER_PORT_NUMBER
value: {{ .Values.service.port | quote }}
- name: AIRFLOW_LOAD_EXAMPLES
value: {{ ternary "yes" "no" .Values.loadExamples | quote }}
{{- if .Values.web.image.debug }}
@@ -318,6 +314,39 @@ Add environmnet variables to configure airflow kubernetes executor
{{- end }}
{{- end -}}
{{/*
Get the user defined LoadBalancerIP for this release.
Note, returns 127.0.0.1 if using ClusterIP.
*/}}
{{- define "airflow.serviceIP" -}}
{{- if eq .Values.service.type "ClusterIP" -}}
127.0.0.1
{{- else -}}
{{- .Values.service.loadBalancerIP | default "" -}}
{{- end -}}
{{- end -}}
{{/*
Gets the host to be used for this application.
If not using ClusterIP, or if a host or LoadBalancerIP is not defined, the value will be empty.
*/}}
{{- define "airflow.baseUrl" -}}
{{- $host := include "airflow.serviceIP" . -}}
{{- $port := "" -}}
{{- $servicePortString := printf "%v" .Values.service.port -}}
{{- if and (not (eq $servicePortString "80")) (not (eq $servicePortString "443")) -}}
{{- $port = printf ":%s" $servicePortString -}}
{{- end -}}
{{- $defaultUrl := "" -}}
{{- if $host -}}
{{- $defaultUrl = printf "http://%s%s" $host $port -}}
{{- end -}}
{{- default $defaultUrl .Values.web.baseUrl -}}
{{- end -}}
{{/*
Compile all warnings into a single message, and call fail.
*/}}

View File

@@ -102,6 +102,10 @@ data:
{{- include "airflow.configure.airflow.common" . | nindent 12 }}
{{- include "airflow.configure.database" . | nindent 12 }}
{{- include "airflow.configure.redis" . | nindent 12 }}
- name: AIRFLOW_WEBSERVER_HOST
value: {{ include "common.names.fullname" . }}
- name: AIRFLOW_WEBSERVER_PORT_NUMBER
value: {{ .Values.service.port | quote }}
{{- if .Values.extraEnvVars }}
{{- include "common.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 12 }}
{{- end }}

View File

@@ -74,6 +74,10 @@ spec:
{{- include "airflow.configure.database" . | nindent 12 }}
{{- include "airflow.configure.redis" . | nindent 12 }}
{{- include "airflow.configure.airflow.kubernetesExecutor" . | nindent 12 }}
- name: AIRFLOW_WEBSERVER_HOST
value: {{ include "common.names.fullname" . }}
- name: AIRFLOW_WEBSERVER_PORT_NUMBER
value: {{ .Values.service.port | quote }}
{{- if .Values.extraEnvVars }}
{{- include "common.tplvalues.render" (dict "value" .Values.extraEnvVars "context" $) | nindent 12 }}
{{- end }}

View File

@@ -73,6 +73,10 @@ spec:
{{- include "airflow.configure.database" . | nindent 12 }}
{{- include "airflow.configure.redis" . | nindent 12 }}
{{- include "airflow.configure.airflow.kubernetesExecutor" . | nindent 12 }}
- name: AIRFLOW_WEBSERVER_HOST
value: '0.0.0.0'
- name: AIRFLOW_WEBSERVER_PORT_NUMBER
value: {{ .Values.web.containerPort | quote }}
- name: AIRFLOW_USERNAME
value: {{ .Values.auth.username }}
- name: AIRFLOW_PASSWORD
@@ -80,9 +84,10 @@ spec:
secretKeyRef:
name: {{ include "airflow.secretName" . }}
key: airflow-password
{{- if .Values.web.baseUrl }}
{{- $baseUrl := include "airflow.baseUrl" . }}
{{- if $baseUrl }}
- name: AIRFLOW_BASE_URL
value: {{ .Values.web.baseUrl }}
value: {{ $baseUrl }}
{{- end }}
- name: AIRFLOW_LDAP_ENABLE
value: {{ ternary "yes" "no" .Values.ldap.enabled | quote }}
@@ -138,7 +143,7 @@ spec:
containerPort: {{ .Values.web.containerPort }}
{{- if .Values.web.livenessProbe.enabled }}
livenessProbe:
{{- if .Values.web.baseUrl }}
{{- if $baseUrl }}
tcpSocket:
port: http
{{- else }}
@@ -153,7 +158,7 @@ spec:
{{- end }}
{{- if .Values.web.readinessProbe.enabled }}
readinessProbe:
{{- if .Values.web.baseUrl }}
{{- if $baseUrl }}
tcpSocket:
port: http
{{- else }}

View File

@@ -17,7 +17,7 @@ spec:
type: {{ .Values.service.type }}
{{- if eq .Values.service.type "LoadBalancer" }}
{{- if .Values.service.loadBalancerIP }}
loadBalancerIP: {{ .Values.service.loadBalancerIP }}
loadBalancerIP: {{ default "" .Values.service.loadBalancerIP | quote }}
{{- end }}
{{- end }}
ports:

View File

@@ -88,6 +88,10 @@ spec:
{{- include "airflow.configure.airflow.common" . | nindent 12 }}
{{- include "airflow.configure.database" . | nindent 12 }}
{{- include "airflow.configure.redis" . | nindent 12 }}
- name: AIRFLOW_WEBSERVER_HOST
value: {{ include "common.names.fullname" . }}
- name: AIRFLOW_WEBSERVER_PORT_NUMBER
value: {{ .Values.service.port | quote }}
{{- if .Values.extraEnvVars }}
{{ toYaml .Values.extraEnvVars | nindent 12 }}
{{- end }}