Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: properly template extraEnv values #874

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion charts/airflow/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ Parameter | Description | Default
`airflow.podAnnotations` | extra annotations for airflow Pods | `{}`
`airflow.extraPipPackages` | extra pip packages to install in airflow Pods | `[]`
`airflow.protectedPipPackages` | pip packages that are protected from upgrade/downgrade by `extraPipPackages` | `["apache-airflow"]`
`airflow.extraEnv` | extra environment variables for the airflow Pods | `[]`
`airflow.extraEnv` | extra environment variables for the airflow Pods (will be templated) | `[]`
`airflow.extraContainers` | extra containers for the airflow Pods | `[]`
`airflow.extraInitContainers` | extra init-containers for the airflow Pods | `[]`
`airflow.extraVolumeMounts` | extra VolumeMounts for the airflow Pods | `[]`
Expand Down
4 changes: 3 additions & 1 deletion charts/airflow/docs/faq/configuration/airflow-configs.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ airflow:

> 🟦 __Tip__ 🟦
>
> To store sensitive configs in Kubernetes secrets, you may use the `airflow.extraEnv` value.
> To store sensitive configs in Kubernetes secrets, you may use the `airflow.extraEnv` value to mount extra environment variables
> with the same structure as [EnvVar in ContainerSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.29/#envvar-v1-core).
> These values will be templated by Helm, so you can use variables or template functions.
>
> For example, to set `AIRFLOW__CORE__FERNET_KEY` from a Secret called `airflow-fernet-key` containing a key called `value`:
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# Mount Environment Variables from Secrets/ConfigMaps

You may use the `airflow.extraEnv` value to mount extra environment variables with the same structure as [EnvVar in ContainerSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.29/#envvar-v1-core).
You may use the `airflow.extraEnv` value to mount extra environment variables with the same structure as [EnvVar in ContainerSpec](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.29/#envvar-v1-core). These values will be templated by Helm, so you can use variables or template functions.

> 🟦 __Tip__ 🟦
>
Expand All @@ -20,4 +20,13 @@ airflow:
secretKeyRef:
name: airflow-fernet-key
key: value
```

Here is an example which sets `AIRFLOW__LOGGING__REMOTE_BASE_LOG_FOLDER` with a templated value:

```yaml
airflow:
extraEnv:
- name: AIRFLOW__LOGGING__REMOTE_BASE_LOG_FOLDER
value: "s3://{{ .Release.Namespace }}-airflow/logs"
```
2 changes: 1 addition & 1 deletion charts/airflow/templates/_helpers/pods.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,6 @@ EXAMPLE USAGE: {{ include "airflow.env" (dict "Release" .Release "Values" .Value

{{- /* user-defined environment variables */ -}}
{{- if .Values.airflow.extraEnv }}
{{ toYaml .Values.airflow.extraEnv }}
{{ tpl (toYaml .Values.airflow.extraEnv) . }}
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion charts/airflow/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ airflow:
protectedPipPackages:
- "apache-airflow"

## extra environment variables for the airflow Pods
## extra environment variables for the airflow Pods (will be templated)
## - spec for EnvVar:
## https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.29/#envvar-v1-core
##
Expand Down
Loading