diff --git a/chart/templates/dag-processor/dag-processor-deployment.yaml b/chart/templates/dag-processor/dag-processor-deployment.yaml index 96abd3ff2b8e6..758d5ab5be61a 100644 --- a/chart/templates/dag-processor/dag-processor-deployment.yaml +++ b/chart/templates/dag-processor/dag-processor-deployment.yaml @@ -39,6 +39,10 @@ metadata: {{- with .Values.labels }} {{- toYaml . | nindent 4 }} {{- end }} + {{- if .Values.dagProcessor.annotations }} + annotations: + {{- toYaml .Values.dagProcessor.annotations | nindent 4 }} + {{- end }} spec: replicas: {{ .Values.dagProcessor.replicas }} {{- if $revisionHistoryLimit }} diff --git a/chart/templates/flower/flower-deployment.yaml b/chart/templates/flower/flower-deployment.yaml index 5c92193502c26..0e52190644a9f 100644 --- a/chart/templates/flower/flower-deployment.yaml +++ b/chart/templates/flower/flower-deployment.yaml @@ -39,6 +39,10 @@ metadata: {{- with .Values.labels }} {{ toYaml . | indent 4 }} {{- end }} + {{- if .Values.flower.annotations }} + annotations: + {{- toYaml .Values.flower.annotations | nindent 4 }} + {{- end }} spec: replicas: 1 {{- if $revisionHistoryLimit }} diff --git a/chart/templates/pgbouncer/pgbouncer-deployment.yaml b/chart/templates/pgbouncer/pgbouncer-deployment.yaml index 3d5f76c81c70a..b8e2e0d421ef2 100644 --- a/chart/templates/pgbouncer/pgbouncer-deployment.yaml +++ b/chart/templates/pgbouncer/pgbouncer-deployment.yaml @@ -37,6 +37,10 @@ metadata: {{- with .Values.labels }} {{ toYaml . | indent 4 }} {{- end }} + {{- if .Values.pgbouncer.annotations }} + annotations: + {{- toYaml .Values.pgbouncer.annotations | nindent 4 }} + {{- end }} spec: replicas: {{ .Values.pgbouncer.replicas | default "1" }} {{- if $revisionHistoryLimit }} diff --git a/chart/templates/scheduler/scheduler-deployment.yaml b/chart/templates/scheduler/scheduler-deployment.yaml index 94cd7fd95ab02..6814ada50a70e 100644 --- a/chart/templates/scheduler/scheduler-deployment.yaml +++ b/chart/templates/scheduler/scheduler-deployment.yaml @@ -51,6 +51,10 @@ metadata: {{- with .Values.labels }} {{ toYaml . | indent 4 }} {{- end }} + {{- if .Values.scheduler.annotations }} + annotations: + {{- toYaml .Values.scheduler.annotations | nindent 4 }} + {{- end }} spec: {{- if $stateful }} serviceName: {{ .Release.Name }}-scheduler diff --git a/chart/templates/triggerer/triggerer-deployment.yaml b/chart/templates/triggerer/triggerer-deployment.yaml index befee9c90a15e..78310394e91c9 100644 --- a/chart/templates/triggerer/triggerer-deployment.yaml +++ b/chart/templates/triggerer/triggerer-deployment.yaml @@ -39,6 +39,10 @@ metadata: {{- with .Values.labels }} {{- toYaml . | nindent 4 }} {{- end }} + {{- if .Values.triggerer.annotations }} + annotations: + {{- toYaml .Values.triggerer.annotations | nindent 4 }} + {{- end }} spec: replicas: {{ .Values.triggerer.replicas }} {{- if $revisionHistoryLimit }} diff --git a/chart/templates/webserver/webserver-deployment.yaml b/chart/templates/webserver/webserver-deployment.yaml index bfc83a2140466..55b065a68eda9 100644 --- a/chart/templates/webserver/webserver-deployment.yaml +++ b/chart/templates/webserver/webserver-deployment.yaml @@ -37,6 +37,10 @@ metadata: {{- with .Values.labels }} {{ toYaml . | indent 4 }} {{- end }} +{{- if .Values.webserver.annotations }} + annotations: + {{- toYaml .Values.webserver.annotations | nindent 4 }} +{{- end }} spec: replicas: {{ .Values.webserver.replicas }} {{- if $revisionHistoryLimit }} diff --git a/chart/templates/workers/worker-deployment.yaml b/chart/templates/workers/worker-deployment.yaml index 2c221e7f88b60..2b0742bb5f20a 100644 --- a/chart/templates/workers/worker-deployment.yaml +++ b/chart/templates/workers/worker-deployment.yaml @@ -39,6 +39,10 @@ metadata: {{- with .Values.labels }} {{ toYaml . | indent 4 }} {{- end }} +{{- if .Values.workers.annotations }} + annotations: + {{- toYaml .Values.workers.annotations | nindent 4 }} +{{- end }} spec: {{- if $persistence }} serviceName: {{ .Release.Name }}-worker diff --git a/chart/values.schema.json b/chart/values.schema.json index 44f87ddf43d95..31044ddbc2949 100644 --- a/chart/values.schema.json +++ b/chart/values.schema.json @@ -1558,6 +1558,14 @@ } ] }, + "annotations": { + "description": "Annotations to add to the worker deployment", + "type": "object", + "default": {}, + "additionalProperties": { + "type": "string" + } + }, "podAnnotations": { "description": "Annotations to add to the worker pods.", "type": "object", @@ -1949,6 +1957,14 @@ "$ref": "#/definitions/io.k8s.api.core.v1.TopologySpreadConstraint" } }, + "annotations": { + "description": "Annotations to add to the scheduler deployment", + "type": "object", + "default": {}, + "additionalProperties": { + "type": "string" + } + }, "podAnnotations": { "description": "Annotations to add to the scheduler pods.", "type": "object", @@ -2325,6 +2341,14 @@ "type": "integer", "default": 60 }, + "annotations": { + "description": "Annotations to add to the triggerer deployment", + "type": "object", + "default": {}, + "additionalProperties": { + "type": "string" + } + }, "podAnnotations": { "description": "Annotations to add to the triggerer pods.", "type": "object", @@ -2642,6 +2666,14 @@ "type": "integer", "default": 60 }, + "annotations": { + "description": "Annotations to add to the dag processor deployment", + "type": "object", + "default": {}, + "additionalProperties": { + "type": "string" + } + }, "podAnnotations": { "description": "Annotations to add to the dag processor pods.", "type": "object", @@ -3602,6 +3634,14 @@ "$ref": "#/definitions/io.k8s.api.core.v1.TopologySpreadConstraint" } }, + "annotations": { + "description": "Annotations to add to the webserver deployment", + "type": "object", + "default": {}, + "additionalProperties": { + "type": "string" + } + }, "podAnnotations": { "description": "Annotations to add to the webserver pods.", "type": "object", @@ -3981,6 +4021,14 @@ "$ref": "#/definitions/io.k8s.api.core.v1.TopologySpreadConstraint" } }, + "annotations": { + "description": "Annotations to add to the flower deployment", + "type": "object", + "default": {}, + "additionalProperties": { + "type": "string" + } + }, "podAnnotations": { "description": "Annotations to add to the Flower pods.", "type": "object", @@ -4225,6 +4273,14 @@ "x-docsSection": "Common", "default": false }, + "annotations": { + "description": "Annotations to add to the PgBouncer deployment", + "type": "object", + "default": {}, + "additionalProperties": { + "type": "string" + } + }, "replicas": { "description": "Number of PgBouncer replicas to run in Deployment.", "type": "integer", diff --git a/chart/values.yaml b/chart/values.yaml index f22980c94c60b..17231711ee342 100644 --- a/chart/values.yaml +++ b/chart/values.yaml @@ -600,6 +600,9 @@ workers: # hostnames: # - "test.hostname.two" + # annotations for the worker resource + annotations: {} + podAnnotations: {} # Labels specific to workers objects and pods @@ -718,6 +721,9 @@ scheduler: priorityClassName: ~ + # annotations for scheduler deployment + annotations: {} + podAnnotations: {} # Labels specific to scheduler objects and pods @@ -1030,6 +1036,9 @@ webserver: tolerations: [] topologySpreadConstraints: [] + # annotations for webserver deployment + annotations: {} + podAnnotations: {} # Labels specific webserver app @@ -1128,6 +1137,9 @@ triggerer: priorityClassName: ~ + # annotations for the triggerer deployment + annotations: {} + podAnnotations: {} # Labels specific to triggerer objects and pods @@ -1226,6 +1238,9 @@ dagProcessor: priorityClassName: ~ + # annotations for the dag processor deployment + annotations: {} + podAnnotations: {} waitForMigrations: @@ -1328,6 +1343,9 @@ flower: priorityClassName: ~ + # annotations for the flower deployment + annotations: {} + podAnnotations: {} # Labels specific to flower objects and pods @@ -1409,6 +1427,9 @@ pgbouncer: auth_type: md5 auth_file: /etc/pgbouncer/users.txt + # annotations to be added to the PgBouncer deployment + annotations: {} + # Create ServiceAccount serviceAccount: # Specifies whether a ServiceAccount should be created diff --git a/tests/charts/test_dag_processor.py b/tests/charts/test_dag_processor.py index 8d3bef7346bb0..def2523fc2874 100644 --- a/tests/charts/test_dag_processor.py +++ b/tests/charts/test_dag_processor.py @@ -536,3 +536,16 @@ def test_airflow_local_settings(self): } assert volume_mount in jmespath.search("spec.template.spec.containers[0].volumeMounts", docs[0]) assert volume_mount in jmespath.search("spec.template.spec.initContainers[0].volumeMounts", docs[0]) + + def test_should_add_component_specific_annotations(self): + docs = render_chart( + values={ + "dagProcessor": { + "enabled": True, + "annotations": {"test_annotation": "test_annotation_value"}, + }, + }, + show_only=["templates/dag-processor/dag-processor-deployment.yaml"], + ) + assert "annotations" in jmespath.search("metadata", docs[0]) + assert jmespath.search("metadata.annotations", docs[0])["test_annotation"] == "test_annotation_value" diff --git a/tests/charts/test_flower.py b/tests/charts/test_flower.py index 81cb3fe02ac19..45a2ff4ef1d9e 100644 --- a/tests/charts/test_flower.py +++ b/tests/charts/test_flower.py @@ -335,6 +335,19 @@ def test_airflow_local_settings(self): } assert volume_mount in jmespath.search("spec.template.spec.containers[0].volumeMounts", docs[0]) + def test_should_add_component_specific_annotations(self): + docs = render_chart( + values={ + "flower": { + "enabled": True, + "annotations": {"test_annotation": "test_annotation_value"}, + }, + }, + show_only=["templates/flower/flower-deployment.yaml"], + ) + assert "annotations" in jmespath.search("metadata", docs[0]) + assert jmespath.search("metadata.annotations", docs[0])["test_annotation"] == "test_annotation_value" + class TestFlowerService: @pytest.mark.parametrize( diff --git a/tests/charts/test_pgbouncer.py b/tests/charts/test_pgbouncer.py index 35981f1a7d91b..901ea71d48710 100644 --- a/tests/charts/test_pgbouncer.py +++ b/tests/charts/test_pgbouncer.py @@ -345,6 +345,19 @@ def test_pgbouncer_replicas_are_configurable(self): ) assert 2 == jmespath.search("spec.replicas", docs[0]) + def test_should_add_component_specific_annotations(self): + docs = render_chart( + values={ + "pgbouncer": { + "enabled": True, + "annotations": {"test_annotation": "test_annotation_value"}, + }, + }, + show_only=["templates/pgbouncer/pgbouncer-deployment.yaml"], + ) + assert "annotations" in jmespath.search("metadata", docs[0]) + assert jmespath.search("metadata.annotations", docs[0])["test_annotation"] == "test_annotation_value" + class TestPgbouncerConfig: def test_config_not_created_by_default(self): diff --git a/tests/charts/test_scheduler.py b/tests/charts/test_scheduler.py index fe98861fda413..1042fc5a1e563 100644 --- a/tests/charts/test_scheduler.py +++ b/tests/charts/test_scheduler.py @@ -707,6 +707,18 @@ def test_scheduler_deployment_has_executor_label(self, executor): assert 1 == len(docs) assert executor == docs[0]["metadata"]["labels"].get("executor") + def test_should_add_component_specific_annotations(self): + docs = render_chart( + values={ + "scheduler": { + "annotations": {"test_annotation": "test_annotation_value"}, + }, + }, + show_only=["templates/scheduler/scheduler-deployment.yaml"], + ) + assert "annotations" in jmespath.search("metadata", docs[0]) + assert jmespath.search("metadata.annotations", docs[0])["test_annotation"] == "test_annotation_value" + class TestSchedulerNetworkPolicy: def test_should_add_component_specific_labels(self): diff --git a/tests/charts/test_triggerer.py b/tests/charts/test_triggerer.py index 757bdb4fa4d0a..8e2503455012e 100644 --- a/tests/charts/test_triggerer.py +++ b/tests/charts/test_triggerer.py @@ -507,6 +507,18 @@ def test_airflow_local_settings(self): assert volume_mount in jmespath.search("spec.template.spec.containers[0].volumeMounts", docs[0]) assert volume_mount in jmespath.search("spec.template.spec.initContainers[0].volumeMounts", docs[0]) + def test_should_add_component_specific_annotations(self): + docs = render_chart( + values={ + "triggerer": { + "annotations": {"test_annotation": "test_annotation_value"}, + }, + }, + show_only=["templates/triggerer/triggerer-deployment.yaml"], + ) + assert "annotations" in jmespath.search("metadata", docs[0]) + assert jmespath.search("metadata.annotations", docs[0])["test_annotation"] == "test_annotation_value" + class TestTriggererServiceAccount: def test_should_add_component_specific_labels(self): diff --git a/tests/charts/test_webserver.py b/tests/charts/test_webserver.py index 5de32e90a8eb5..1b0d49b0f3984 100644 --- a/tests/charts/test_webserver.py +++ b/tests/charts/test_webserver.py @@ -673,6 +673,18 @@ def test_dags_persistence_volume_no_sidecar(self, dags_values, expected_claim_na assert 1 == len(jmespath.search("spec.template.spec.containers", docs[0])) assert 1 == len(jmespath.search("spec.template.spec.initContainers", docs[0])) + def test_should_add_component_specific_annotations(self): + docs = render_chart( + values={ + "webserver": { + "annotations": {"test_annotation": "test_annotation_value"}, + }, + }, + show_only=["templates/webserver/webserver-deployment.yaml"], + ) + assert "annotations" in jmespath.search("metadata", docs[0]) + assert jmespath.search("metadata.annotations", docs[0])["test_annotation"] == "test_annotation_value" + class TestWebserverService: def test_default_service(self): diff --git a/tests/charts/test_worker.py b/tests/charts/test_worker.py index 7056e5b8151f6..39c65cf87aac9 100644 --- a/tests/charts/test_worker.py +++ b/tests/charts/test_worker.py @@ -680,6 +680,18 @@ def test_persistence_volume_annotations(self): ) assert {"foo": "bar"} == jmespath.search("spec.volumeClaimTemplates[0].metadata.annotations", docs[0]) + def test_should_add_component_specific_annotations(self): + docs = render_chart( + values={ + "workers": { + "annotations": {"test_annotation": "test_annotation_value"}, + }, + }, + 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" + class TestWorkerKedaAutoScaler: def test_should_add_component_specific_labels(self):