Skip to content

Commit

Permalink
fix: template extraEnv
Browse files Browse the repository at this point in the history
Signed-off-by: Jesse Bye <[email protected]>
Signed-off-by: jessebye <[email protected]>
  • Loading branch information
jessebye committed Aug 22, 2024
1 parent a5e146b commit b3995ee
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 5 deletions.
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

0 comments on commit b3995ee

Please sign in to comment.