diff --git a/chart/templates/scheduler/scheduler-deployment.yaml b/chart/templates/scheduler/scheduler-deployment.yaml index a4a93190f64fe..f3c381492aa48 100644 --- a/chart/templates/scheduler/scheduler-deployment.yaml +++ b/chart/templates/scheduler/scheduler-deployment.yaml @@ -47,6 +47,7 @@ metadata: release: {{ .Release.Name }} chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" heritage: {{ .Release.Service }} + executor: {{ .Values.executor }} {{- with .Values.labels }} {{ toYaml . | indent 4 }} {{- end }} diff --git a/tests/charts/test_basic_helm_chart.py b/tests/charts/test_basic_helm_chart.py index e1acb9a284ea8..e71e5888871c1 100644 --- a/tests/charts/test_basic_helm_chart.py +++ b/tests/charts/test_basic_helm_chart.py @@ -358,7 +358,10 @@ def test_labels_are_valid(self): } if component: expected_labels["component"] = component - assert kind_k8s_obj_labels_tuples.pop((k8s_object_name, kind)) == expected_labels + if k8s_object_name == f"{release_name}-scheduler": + expected_labels['executor'] = 'CeleryExecutor' + actual_labels = kind_k8s_obj_labels_tuples.pop((k8s_object_name, kind)) + assert actual_labels == expected_labels if kind_k8s_obj_labels_tuples: warnings.warn(f"Unchecked objects: {kind_k8s_obj_labels_tuples.keys()}") diff --git a/tests/charts/test_scheduler.py b/tests/charts/test_scheduler.py index cc07721cb8897..1cfd5659e0f0b 100644 --- a/tests/charts/test_scheduler.py +++ b/tests/charts/test_scheduler.py @@ -674,6 +674,24 @@ def test_persistence_volume_annotations(self): ) assert {"foo": "bar"} == jmespath.search("spec.volumeClaimTemplates[0].metadata.annotations", docs[0]) + @parameterized.expand( + [ + "LocalExecutor", + "LocalKubernetesExecutor", + "CeleryExecutor", + "KubernetesExecutor", + "CeleryKubernetesExecutor", + ] + ) + def test_scheduler_deployment_has_executor_label(self, executor): + docs = render_chart( + values={"executor": executor}, + show_only=["templates/scheduler/scheduler-deployment.yaml"], + ) + + assert 1 == len(docs) + assert executor == docs[0]['metadata']['labels'].get('executor') + class SchedulerNetworkPolicyTest(unittest.TestCase): def test_should_add_component_specific_labels(self):