diff --git a/chart/newsfragments/64982.significant.rst b/chart/newsfragments/64982.significant.rst new file mode 100644 index 0000000000000..d850632175130 --- /dev/null +++ b/chart/newsfragments/64982.significant.rst @@ -0,0 +1 @@ +``workers.annotations`` field is now deprecated in favor of ``workers.celery.annotations``. Please update your configuration accordingly. diff --git a/chart/templates/NOTES.txt b/chart/templates/NOTES.txt index 5273e167bad77..ae4c13bc8e760 100644 --- a/chart/templates/NOTES.txt +++ b/chart/templates/NOTES.txt @@ -781,6 +781,14 @@ DEPRECATION WARNING: {{- end }} +{{- if not (empty .Values.workers.annotations) }} + + DEPRECATION WARNING: + `workers.annotations` has been renamed to `workers.celery.annotations`. + Please change your values as support for the old name will be dropped in a future release. + +{{- end }} + {{- if not (empty .Values.workers.volumeClaimTemplates) }} DEPRECATION WARNING: diff --git a/chart/values.schema.json b/chart/values.schema.json index 404a90e2649ca..6b2a25511af39 100644 --- a/chart/values.schema.json +++ b/chart/values.schema.json @@ -2403,7 +2403,7 @@ ] }, "annotations": { - "description": "Annotations to add to the Airflow Celery worker deployment.", + "description": "Annotations to add to the Airflow Celery worker deployment (deprecated, use ``workers.celery.annotations`` instead).", "type": "object", "default": {}, "additionalProperties": { @@ -3482,6 +3482,14 @@ } ] }, + "annotations": { + "description": "Annotations to add to the Airflow Celery worker deployment.", + "type": "object", + "default": {}, + "additionalProperties": { + "type": "string" + } + }, "waitForMigrations": { "description": "Configuration of wait-for-airflow-migration init container for Airflow Celery workers.", "type": "object", diff --git a/chart/values.yaml b/chart/values.yaml index 3096e73b2b87a..1552e25e1cbcd 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -1127,6 +1127,7 @@ workers: # - "test.hostname.two" # Annotations for the Airflow Celery worker resource + # (deprecated, use `workers.celery.annotations` instead) annotations: {} # Pod annotations for the Airflow Celery workers and pods created with pod-template-file (templated) @@ -1513,6 +1514,9 @@ workers: # hostnames: # - "test.hostname.two" + # Annotations for the Airflow Celery worker resource + annotations: {} + # Configuration of wait-for-airflow-migration init container for Airflow Celery workers waitForMigrations: # Whether to create init container to wait for db migrations diff --git a/helm-tests/tests/helm_tests/airflow_core/test_worker.py b/helm-tests/tests/helm_tests/airflow_core/test_worker.py index 6c2a5a9ab40df..810e56e3967b6 100644 --- a/helm-tests/tests/helm_tests/airflow_core/test_worker.py +++ b/helm-tests/tests/helm_tests/airflow_core/test_worker.py @@ -1472,17 +1472,34 @@ def test_persistence_volume_annotations(self, workers_values): ) assert jmespath.search("spec.volumeClaimTemplates[0].metadata.annotations", docs[0]) == {"foo": "bar"} - def test_should_add_component_specific_annotations(self): - docs = render_chart( - values={ - "workers": { + @pytest.mark.parametrize( + "workers_values", + [ + { + "annotations": {"test_annotation": "test_annotation_value"}, + }, + { + "celery": { + "annotations": {"test_annotation": "test_annotation_value"}, + } + }, + { + "annotations": {"test": "test"}, + "celery": { "annotations": {"test_annotation": "test_annotation_value"}, }, }, + ], + ) + def test_should_add_component_specific_annotations(self, workers_values): + docs = render_chart( + values={"workers": workers_values}, show_only=["templates/workers/worker-deployment.yaml"], ) - assert "annotations" in jmespath.search("metadata", docs[0]) - assert jmespath.search("metadata.annotations", docs[0])["test_annotation"] == "test_annotation_value" + + assert jmespath.search("metadata.annotations", docs[0]) == { + "test_annotation": "test_annotation_value" + } @pytest.mark.parametrize( ("globalScope", "localScope", "precedence"), diff --git a/helm-tests/tests/helm_tests/airflow_core/test_worker_sets.py b/helm-tests/tests/helm_tests/airflow_core/test_worker_sets.py index 50efb69dff172..5a46add7f631b 100644 --- a/helm-tests/tests/helm_tests/airflow_core/test_worker_sets.py +++ b/helm-tests/tests/helm_tests/airflow_core/test_worker_sets.py @@ -3093,6 +3093,13 @@ def test_overwrite_host_aliases(self, workers_values): "sets": [{"name": "set1", "annotations": {"test": "echo"}}], }, }, + { + "celery": { + "enableDefault": False, + "annotations": {"echo": "test"}, + "sets": [{"name": "set1", "annotations": {"test": "echo"}}], + }, + }, ], ) def test_overwrite_annotations(self, workers_values):