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

Unusable airflow.variables and airflow.extraVar #890

Open
2 tasks done
JulienDelavande opened this issue Sep 23, 2024 · 0 comments
Open
2 tasks done

Unusable airflow.variables and airflow.extraVar #890

JulienDelavande opened this issue Sep 23, 2024 · 0 comments
Labels
kind/bug kind - things not working properly

Comments

@JulienDelavande
Copy link

Checks

Chart Version

8.9.0

Kubernetes Version

Client Version: v1.29.2
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: v1.30.4+k3s1

Helm Version

version.BuildInfo{Version:"v3.16.0-rc.1", GitCommit:"0d439e1a09683f21a0ab9401eb661401f185b00b", GitTreeState:"clean", GoVersion:"go1.22.6"}

Description

Title: airflow.variables and extraEnv not applied in env and envFrom sections from values.yaml

Description:

According to the documentation, it should be possible to define environment variables and other settings in the values.yaml file through the airflow.variables and airflow.extraEnv fields. However, these fields do not seem to be used or referenced within the Helm templates under the env and envFrom sections for Airflow pods.

For example, in values.yaml:

airflow:
  variables:
    - key: "VAR_TEST_KEY"
      value: "VAR_TEST_VALUE"
  extraEnv:
    - ConfigMapKeySelector: "global-config"

Expected Behavior:

  • The variables defined in airflow.variables should be loaded as environment variables in the pods.
  • The airflow.extraEnv field should allow the user to specify extra environment variables using ConfigMapKeySelector or SecretKeySelector.

For example:

airflow:
  extraEnv:
    - name: CUSTOM_VAR
      valueFrom:
        configMapKeyRef:
          name: global-config
          key: CUSTOM_VAR

These settings should then be applied under the env and envFrom sections of the Airflow deployment templates.

Actual Behavior:

Currently, the fields airflow.variables and airflow.extraEnv are not referenced or applied in the env or envFrom sections of the webserver, scheduler, or worker pods.

Steps to Reproduce:

  1. Define variables and extra environment settings in values.yaml as follows:
airflow:
  variables:
    - key: "VAR_TEST_KEY"
      value: "VAR_TEST_VALUE"
  extraEnv:
    - name: CUSTOM_VAR
      valueFrom:
        configMapKeyRef:
          name: global-config
          key: CUSTOM_VAR
  1. Deploy the chart with Helm:
helm upgrade --install my-airflow-release apache-airflow/airflow -f values.yaml
  1. Check the environment variables in the Airflow pods:
kubectl describe pod <pod-name>

The expected variables (VAR_TEST_KEY and CUSTOM_VAR) will not be present in the pod's environment.

Proposed Solution:

Update the Helm chart templates to properly reference and apply airflow.variables and airflow.extraEnv fields in the env and envFrom sections. This will ensure that variables and extra environment configurations specified in values.yaml are correctly injected into the Airflow pods.

For example, the webserver deployment template could be updated as follows:

containers:
  - name: airflow-web
    env:
      {{- include "airflow.env" . | indent 8 }}
      {{- toYaml .Values.airflow.variables | indent 8 }}
    envFrom:
      {{- toYaml .Values.airflow.extraEnv | indent 8 }}

This will allow for the proper inclusion of environment variables defined in airflow.variables and extraEnv.

Relevant Logs

kubectl exec -it optimsportbets-web-69f9c7d8d5-4ntr5 -- env | grep VAR_TEST_KEY

output: None

Custom Helm Values

airflow:
  variables:
    - key: "VAR_TEST_KEY"
      value: "VAR_TEST_VALUE"
  extraEnv:
    - name: CUSTOM_VAR
      valueFrom:
        configMapKeyRef:
          name: global-config
          key: CUSTOM_VAR
@JulienDelavande JulienDelavande added the kind/bug kind - things not working properly label Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug kind - things not working properly
Projects
None yet
Development

No branches or pull requests

1 participant