Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 21 additions & 9 deletions chart/templates/_helpers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,24 +60,36 @@ If release name contains chart name it will be used as a full name.

{{/* Standard Airflow environment variables */}}
{{- define "standard_airflow_environment" }}
# Resolve env var overrides from component-level config (e.g.
# workers.celery.enableBuiltInSecretEnvVars, scheduler.enableBuiltInSecretEnvVars)
{{- $envOverrides := .envOverrides | default dict }}
{{- $fernetKeyEnabled := hasKey $envOverrides "AIRFLOW__CORE__FERNET_KEY" | ternary (index $envOverrides "AIRFLOW__CORE__FERNET_KEY") .Values.enableBuiltInSecretEnvVars.AIRFLOW__CORE__FERNET_KEY }}
{{- $dbConnEnabled := hasKey $envOverrides "AIRFLOW__DATABASE__SQL_ALCHEMY_CONN" | ternary (index $envOverrides "AIRFLOW__DATABASE__SQL_ALCHEMY_CONN") .Values.enableBuiltInSecretEnvVars.AIRFLOW__DATABASE__SQL_ALCHEMY_CONN }}
{{- $airflowDbEnabled := hasKey $envOverrides "AIRFLOW_CONN_AIRFLOW_DB" | ternary (index $envOverrides "AIRFLOW_CONN_AIRFLOW_DB") .Values.enableBuiltInSecretEnvVars.AIRFLOW_CONN_AIRFLOW_DB }}
{{- $apiSecretKeyEnabled := hasKey $envOverrides "AIRFLOW__API__SECRET_KEY" | ternary (index $envOverrides "AIRFLOW__API__SECRET_KEY") .Values.enableBuiltInSecretEnvVars.AIRFLOW__API__SECRET_KEY }}
{{- $jwtSecretEnabled := hasKey $envOverrides "AIRFLOW__API_AUTH__JWT_SECRET" | ternary (index $envOverrides "AIRFLOW__API_AUTH__JWT_SECRET") .Values.enableBuiltInSecretEnvVars.AIRFLOW__API_AUTH__JWT_SECRET }}
{{- $celeryResultBackendEnabled := hasKey $envOverrides "AIRFLOW__CELERY__RESULT_BACKEND" | ternary (index $envOverrides "AIRFLOW__CELERY__RESULT_BACKEND") .Values.enableBuiltInSecretEnvVars.AIRFLOW__CELERY__RESULT_BACKEND }}
{{- $celeryBrokerEnabled := hasKey $envOverrides "AIRFLOW__CELERY__BROKER_URL" | ternary (index $envOverrides "AIRFLOW__CELERY__BROKER_URL") .Values.enableBuiltInSecretEnvVars.AIRFLOW__CELERY__BROKER_URL }}
{{- $esHostEnabled := hasKey $envOverrides "AIRFLOW__ELASTICSEARCH__HOST" | ternary (index $envOverrides "AIRFLOW__ELASTICSEARCH__HOST") .Values.enableBuiltInSecretEnvVars.AIRFLOW__ELASTICSEARCH__HOST }}
{{- $osHostEnabled := hasKey $envOverrides "AIRFLOW__OPENSEARCH__HOST" | ternary (index $envOverrides "AIRFLOW__OPENSEARCH__HOST") .Values.enableBuiltInSecretEnvVars.AIRFLOW__OPENSEARCH__HOST }}
# Hard Coded Airflow Envs
- name: AIRFLOW_HOME
value: {{ .Values.airflowHome }}
{{- if .Values.enableBuiltInSecretEnvVars.AIRFLOW__CORE__FERNET_KEY }}
{{- if $fernetKeyEnabled }}
- name: AIRFLOW__CORE__FERNET_KEY
valueFrom:
secretKeyRef:
name: {{ template "fernet_key_secret" . }}
key: fernet-key
{{- end }}
{{- if .Values.enableBuiltInSecretEnvVars.AIRFLOW__DATABASE__SQL_ALCHEMY_CONN }}
{{- if $dbConnEnabled }}
- name: AIRFLOW__DATABASE__SQL_ALCHEMY_CONN
valueFrom:
secretKeyRef:
name: {{ template "airflow_metadata_secret" . }}
key: connection
{{- end }}
{{- if .Values.enableBuiltInSecretEnvVars.AIRFLOW_CONN_AIRFLOW_DB }}
{{- if $airflowDbEnabled }}
- name: AIRFLOW_CONN_AIRFLOW_DB
valueFrom:
secretKeyRef:
Expand All @@ -94,44 +106,44 @@ If release name contains chart name it will be used as a full name.
name: {{ template "airflow_metadata_secret" . }}
key: kedaConnection
{{- end }}
{{- if .Values.enableBuiltInSecretEnvVars.AIRFLOW__API__SECRET_KEY }}
{{- if $apiSecretKeyEnabled }}
- name: AIRFLOW__API__SECRET_KEY
valueFrom:
secretKeyRef:
name: {{ template "api_secret_key_secret" . }}
key: api-secret-key
{{- end }}
{{- if and .IncludeJwtSecret .Values.enableBuiltInSecretEnvVars.AIRFLOW__API_AUTH__JWT_SECRET }}
{{- if and .IncludeJwtSecret $jwtSecretEnabled }}
- name: AIRFLOW__API_AUTH__JWT_SECRET
valueFrom:
secretKeyRef:
name: {{ template "jwt_secret" . }}
key: jwt-secret
{{- end }}
{{- if contains "CeleryExecutor" .Values.executor }}
{{- if and .Values.enableBuiltInSecretEnvVars.AIRFLOW__CELERY__RESULT_BACKEND (or .Values.data.resultBackendSecretName .Values.data.resultBackendConnection) }}
{{- if and $celeryResultBackendEnabled (or .Values.data.resultBackendSecretName .Values.data.resultBackendConnection) }}
- name: AIRFLOW__CELERY__RESULT_BACKEND
valueFrom:
secretKeyRef:
name: {{ template "airflow_result_backend_secret" . }}
key: connection
{{- end }}
{{- if .Values.enableBuiltInSecretEnvVars.AIRFLOW__CELERY__BROKER_URL }}
{{- if $celeryBrokerEnabled }}
- name: AIRFLOW__CELERY__BROKER_URL
valueFrom:
secretKeyRef:
name: {{ template "airflow_broker_url_secret" . }}
key: connection
{{- end }}
{{- end }}
{{- if and .Values.elasticsearch.enabled .Values.enableBuiltInSecretEnvVars.AIRFLOW__ELASTICSEARCH__HOST }}
{{- if and .Values.elasticsearch.enabled $esHostEnabled }}
- name: AIRFLOW__ELASTICSEARCH__HOST
valueFrom:
secretKeyRef:
name: {{ template "elasticsearch_secret" . }}
key: connection
{{- end }}
{{- if and .Values.opensearch.enabled .Values.enableBuiltInSecretEnvVars.AIRFLOW__OPENSEARCH__HOST }}
{{- if and .Values.opensearch.enabled $osHostEnabled }}
- name: AIRFLOW__OPENSEARCH__HOST
valueFrom:
secretKeyRef:
Expand Down
4 changes: 2 additions & 2 deletions chart/templates/scheduler/scheduler-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ spec:
envFrom: {{- include "custom_airflow_environment_from" . | default "\n []" | indent 10 }}
env:
{{- include "custom_airflow_environment" . | indent 10 }}
{{- include "standard_airflow_environment" (merge (dict "IncludeJwtSecret" false) .) | indent 10 }}
{{- include "standard_airflow_environment" (merge (dict "IncludeJwtSecret" false "envOverrides" .Values.scheduler.enableBuiltInSecretEnvVars) .) | indent 10 }}
{{- if .Values.scheduler.waitForMigrations.env }}
{{- tpl (toYaml .Values.scheduler.waitForMigrations.env) $ | nindent 12 }}
{{- end }}
Expand Down Expand Up @@ -192,7 +192,7 @@ spec:
envFrom: {{- include "custom_airflow_environment_from" . | default "\n []" | indent 10 }}
env:
{{- include "custom_airflow_environment" . | indent 10 }}
{{- include "standard_airflow_environment" (merge (dict "IncludeJwtSecret" true) .) | indent 10 }}
{{- include "standard_airflow_environment" (merge (dict "IncludeJwtSecret" true "envOverrides" .Values.scheduler.enableBuiltInSecretEnvVars) .) | indent 10 }}
{{- include "container_extra_envs" (list . .Values.scheduler.env) | indent 10 }}
livenessProbe:
initialDelaySeconds: {{ .Values.scheduler.livenessProbe.initialDelaySeconds }}
Expand Down
8 changes: 4 additions & 4 deletions chart/templates/workers/worker-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ spec:
- name: KRB5CCNAME
value: {{ include "kerberos_ccache_path" . | quote }}
{{- include "custom_airflow_environment" . | indent 10 }}
{{- include "standard_airflow_environment" (merge (dict "IncludeJwtSecret" false) .) | indent 10 }}
{{- include "standard_airflow_environment" (merge (dict "IncludeJwtSecret" false "envOverrides" .Values.workers.celery.enableBuiltInSecretEnvVars) .) | indent 10 }}
{{- end }}
{{- if .Values.workers.celery.waitForMigrations.enabled }}
- name: wait-for-airflow-migrations
Expand All @@ -242,7 +242,7 @@ spec:
envFrom: {{- include "custom_airflow_environment_from" . | default "\n []" | indent 10 }}
env:
{{- include "custom_airflow_environment" . | indent 10 }}
{{- include "standard_airflow_environment" (merge (dict "IncludeJwtSecret" false) .) | indent 10 }}
{{- include "standard_airflow_environment" (merge (dict "IncludeJwtSecret" false "envOverrides" .Values.workers.celery.enableBuiltInSecretEnvVars) .) | indent 10 }}
{{- if .Values.workers.celery.waitForMigrations.env }}
{{- tpl (toYaml .Values.workers.celery.waitForMigrations.env) $ | nindent 12 }}
{{- end }}
Expand Down Expand Up @@ -325,7 +325,7 @@ spec:
- name: DUMB_INIT_SETSID
value: "0"
{{- include "custom_airflow_environment" . | indent 10 }}
{{- include "standard_airflow_environment" (merge (dict "IncludeJwtSecret" false) .) | indent 10 }}
{{- include "standard_airflow_environment" (merge (dict "IncludeJwtSecret" false "envOverrides" .Values.workers.celery.enableBuiltInSecretEnvVars) .) | indent 10 }}
{{- include "container_extra_envs" (list . .Values.workers.celery.env) | indent 10 }}
{{- if .Values.workers.celery.kerberosSidecar.enabled }}
- name: KRB5_CONFIG
Expand Down Expand Up @@ -431,7 +431,7 @@ spec:
- name: KRB5CCNAME
value: {{ include "kerberos_ccache_path" . | quote }}
{{- include "custom_airflow_environment" . | indent 10 }}
{{- include "standard_airflow_environment" (merge (dict "IncludeJwtSecret" false) .) | indent 10 }}
{{- include "standard_airflow_environment" (merge (dict "IncludeJwtSecret" false "envOverrides" .Values.workers.celery.enableBuiltInSecretEnvVars) .) | indent 10 }}
{{- end }}
{{- if .Values.workers.celery.extraContainers }}
{{- tpl (toYaml .Values.workers.celery.extraContainers) . | nindent 8 }}
Expand Down
Loading
Loading