From 65e08646dec81a9c5a10c6841be1d35e597cab1a Mon Sep 17 00:00:00 2001 From: vtino17 Date: Wed, 22 Jul 2026 16:10:56 +0700 Subject: [PATCH] Apply Dag processor-specific labels to its Deployment metadata The metadata.labels section of the dag-processor Deployment now includes dagProcessor.labels (merged with global .Values.labels), matching the pattern used by other components. closes: #53190 --- chart/newsfragments/53190.feature.rst | 1 + .../dag-processor-deployment.yaml | 4 ++-- .../dagprocessor/test_labels_deployment.py | 23 +++++++++++++++++++ 3 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 chart/newsfragments/53190.feature.rst diff --git a/chart/newsfragments/53190.feature.rst b/chart/newsfragments/53190.feature.rst new file mode 100644 index 0000000000000..ce4e732b8e43e --- /dev/null +++ b/chart/newsfragments/53190.feature.rst @@ -0,0 +1 @@ +Apply Dag processor-specific labels to its Deployment. diff --git a/chart/templates/dag-processor/dag-processor-deployment.yaml b/chart/templates/dag-processor/dag-processor-deployment.yaml index d3596527c7765..e025c1b4f86dc 100644 --- a/chart/templates/dag-processor/dag-processor-deployment.yaml +++ b/chart/templates/dag-processor/dag-processor-deployment.yaml @@ -41,8 +41,8 @@ metadata: release: {{ .Release.Name }} chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" heritage: {{ .Release.Service }} - {{- with .Values.labels }} - {{- toYaml . | nindent 4 }} + {{- if or .Values.labels .Values.dagProcessor.labels }} + {{- mustMerge .Values.dagProcessor.labels .Values.labels | toYaml | nindent 4 }} {{- end }} {{- if .Values.dagProcessor.annotations }} annotations: {{- toYaml .Values.dagProcessor.annotations | nindent 4 }} diff --git a/chart/tests/helm_tests/dagprocessor/test_labels_deployment.py b/chart/tests/helm_tests/dagprocessor/test_labels_deployment.py index ba5693eee66cb..632d756a01fc0 100644 --- a/chart/tests/helm_tests/dagprocessor/test_labels_deployment.py +++ b/chart/tests/helm_tests/dagprocessor/test_labels_deployment.py @@ -57,6 +57,29 @@ def test_should_add_component_specific_labels(self): == "test_component_label_value" ) + def test_should_merge_global_and_component_specific_labels_in_deployment_metadata(self): + """Test metadata.labels merge both global and component labels.""" + docs = render_chart( + values={ + "labels": { + "test_global_label": "test_global_label_value", + "common_label": "global_value", + }, + "dagProcessor": { + "labels": { + "test_component_label": "test_component_label_value", + "common_label": "component_value", + }, + }, + }, + show_only=[self.TEMPLATE_FILE], + ) + + labels = jmespath.search("metadata.labels", docs[0]) + assert labels["test_global_label"] == "test_global_label_value" + assert labels["test_component_label"] == "test_component_label_value" + assert labels["common_label"] == "component_value" + def test_should_merge_global_and_component_specific_labels(self): """Test adding both .Values.labels and .Values.dagProcessor.labels.""" docs = render_chart(