Skip to content

Commit

Permalink
test env overrides for k8s executors
Browse files Browse the repository at this point in the history
  • Loading branch information
razvan committed Aug 26, 2024
1 parent 59327bc commit 275109d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions tests/templates/kuttl/overrides/10-install-airflow.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ spec:
envOverrides:
COMMON_VAR: role-value # overridden by role group below
ROLE_VAR: role-value # only defined here at role level
credentialsSecret: test-override
roleGroups:
default:
replicas: 1
Expand Down
2 changes: 2 additions & 0 deletions tests/templates/kuttl/overrides/11-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ commands:
kubectl -n $NAMESPACE get sts airflow-celery-webserver-default -o yaml | yq -e '.spec.template.spec.containers[] | select (.name == "airflow") | .env[] | select (.name == "COMMON_VAR" and .value == "group-value")'
kubectl -n $NAMESPACE get sts airflow-celery-webserver-default -o yaml | yq -e '.spec.template.spec.containers[] | select (.name == "airflow") | .env[] | select (.name == "GROUP_VAR" and .value == "group-value")'
kubectl -n $NAMESPACE get sts airflow-celery-webserver-default -o yaml | yq -e '.spec.template.spec.containers[] | select (.name == "airflow") | .env[] | select (.name == "ROLE_VAR" and .value == "role-value")'
kubectl -n $NAMESPACE get sts airflow-celery-webserver-default -o yaml | yq -e '.spec.template.spec.containers[] | select (.name == "airflow") | .env[] | select (.name == "credentialsSecret" and .value == "test-override")'
- script: |
kubectl -n $NAMESPACE get sts airflow-celery-worker-default -o yaml | yq -e '.spec.template.spec.containers[] | select (.name == "airflow") | .env[] | select (.name == "COMMON_VAR" and .value == "group-value")'
Expand Down
3 changes: 3 additions & 0 deletions tests/templates/kuttl/overrides/20-install-airflow2.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ spec:
resources:
limits:
cpu: 750m
envOverrides:
ROLE_VAR: role-value # there are no role groups for kubernetes executors
AIRFLOW__METRICS__STATSD_ON: "False" # also set by the operator
schedulers:
roleGroups:
default:
Expand Down
4 changes: 3 additions & 1 deletion tests/templates/kuttl/overrides/21-assert.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ apiVersion: kuttl.dev/v1beta1
kind: TestAssert
timeout: 30
commands:
- script: kubectl -n $NAMESPACE get cm airflow-kubernetes-executor-pod-template -o json | jq -r '.data."airflow_executor_pod_template.yaml"' | yq '.spec.containers.[0].resources.limits.cpu' | grep 750m
- script: |
kubectl -n $NAMESPACE get cm airflow-executor-pod-template -o json | jq -r '.data."airflow_executor_pod_template.yaml"' | yq -e '.spec.containers.[0].resources.limits | select (.cpu == "750m")'
kubectl -n $NAMESPACE get cm airflow-executor-pod-template -o json | jq -r '.data."airflow_executor_pod_template.yaml"' | yq -e '.spec.containers[] | select (.name == "base") | .env[] | select (.name == "AIRFLOW__METRICS__STATSD_ON" and .value == "False")'

0 comments on commit 275109d

Please sign in to comment.