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

add env support for migratedatabase job #42345

Merged
Merged
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
3 changes: 3 additions & 0 deletions chart/templates/jobs/migrate-database-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ spec:
- name: PYTHONUNBUFFERED
value: "1"
{{- include "standard_airflow_environment" . | indent 10 }}
{{- if .Values.migrateDatabaseJob.env }}
{{- tpl (toYaml .Values.migrateDatabaseJob.env) $ | nindent 12 }}
{{- end }}
resources: {{- toYaml .Values.migrateDatabaseJob.resources | nindent 12 }}
volumeMounts:
{{- include "airflow_config_mount" . | nindent 12 }}
Expand Down
10 changes: 10 additions & 0 deletions chart/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -4651,6 +4651,16 @@
"null"
],
"default": 300
},
"env": {
"description": "Add additional env vars to migrate database job.",
"items": {
"$ref": "#/definitions/io.k8s.api.core.v1.EnvVar"
},
"type": "array",
"default": [],
"x-kubernetes-patch-merge-key": "name",
"x-kubernetes-patch-strategy": "merge"
}
}
},
Expand Down
1 change: 1 addition & 0 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1236,6 +1236,7 @@ migrateDatabaseJob:
# Disable this if you are using ArgoCD for example
useHelmHooks: true
applyCustomEnv: true
env: []

# rpcServer support is experimental / dev purpose only and will later be renamed
_rpcServer:
Expand Down
12 changes: 12 additions & 0 deletions helm_tests/airflow_aux/test_migrate_database_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -455,3 +455,15 @@ def test_overridden_automount_service_account_token(self):
show_only=["templates/jobs/migrate-database-job-serviceaccount.yaml"],
)
assert jmespath.search("automountServiceAccountToken", docs[0]) is False

def test_should_add_component_specific_env(self):
env = {"name": "test_env_key", "value": "test_env_value"}
docs = render_chart(
values={
"migrateDatabaseJob": {
"env": [env],
},
},
show_only=["templates/jobs/migrate-database-job.yaml"],
)
assert env in jmespath.search("spec.template.spec.containers[0].env", docs[0])