Skip to content
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
2 changes: 2 additions & 0 deletions chart/templates/workers/worker-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ spec:
- name: logs
mountPath: {{ template "airflow_logs" . }}
{{- end }}
{{- if .Values.workers.waitForMigrations.enabled }}
- name: wait-for-airflow-migrations
resources: {{- toYaml .Values.workers.resources | nindent 12 }}
image: {{ template "airflow_image_for_migrations" . }}
Expand All @@ -164,6 +165,7 @@ spec:
{{- if .Values.workers.waitForMigrations.env }}
{{- tpl (toYaml .Values.workers.waitForMigrations.env) $ | nindent 12 }}
{{- end }}
{{- end }}
{{- if and (.Values.dags.gitSync.enabled) (not .Values.dags.persistence.enabled) }}
{{- include "git_sync_container" (dict "Values" .Values "is_init" "true") | nindent 8 }}
{{- end }}
Expand Down
5 changes: 5 additions & 0 deletions chart/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1645,6 +1645,11 @@
"type": "object",
"additionalProperties": false,
"properties": {
"enabled": {
"description": "Enable wait-for-airflow-migrations init container.",
"type": "boolean",
"default": true
},
"env": {
"description": "Add additional env vars to wait-for-airflow-migrations init container.",
"type": "array",
Expand Down
2 changes: 2 additions & 0 deletions chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,8 @@ workers:
# memory: 128Mi

waitForMigrations:
# Whether to create init container to wait for db migrations
enabled: true
env: []

env: []
Expand Down
14 changes: 14 additions & 0 deletions tests/charts/airflow_core/test_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,20 @@ def test_should_add_extra_containers(self):
"image": "test-registry/test-repo:test-tag",
} == jmespath.search("spec.template.spec.containers[-1]", docs[0])

def test_disable_wait_for_migration(self):
docs = render_chart(
values={
"workers": {
"waitForMigrations": {"enabled": False},
},
},
show_only=["templates/workers/worker-deployment.yaml"],
)
actual = jmespath.search(
"spec.template.spec.initContainers[?name=='wait-for-airflow-migrations']", docs[0]
)
assert actual is None

def test_should_add_extra_init_containers(self):
docs = render_chart(
values={
Expand Down