Skip to content

Commit

Permalink
Set container name to envSourceContainerName in KEDA ScaledObject (ap…
Browse files Browse the repository at this point in the history
…ache#44963)

* add envSourceContainerName in ScaledObject
  • Loading branch information
jx2lee authored Jan 27, 2025
1 parent a605f04 commit ca7c6ad
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions chart/templates/triggerer/triggerer-kedaautoscaler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ spec:
scaleTargetRef:
kind: {{ ternary "StatefulSet" "Deployment" .Values.triggerer.persistence.enabled }}
name: {{ .Release.Name }}-triggerer
envSourceContainerName: triggerer
pollingInterval: {{ .Values.triggerer.keda.pollingInterval }}
cooldownPeriod: {{ .Values.triggerer.keda.cooldownPeriod }}
minReplicaCount: {{ .Values.triggerer.keda.minReplicaCount }}
Expand Down
1 change: 1 addition & 0 deletions chart/templates/workers/worker-kedaautoscaler.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ spec:
scaleTargetRef:
kind: {{ ternary "StatefulSet" "Deployment" .Values.workers.persistence.enabled }}
name: {{ include "airflow.fullname" . }}-worker
envSourceContainerName: worker
pollingInterval: {{ .Values.workers.keda.pollingInterval }}
cooldownPeriod: {{ .Values.workers.keda.cooldownPeriod }}
minReplicaCount: {{ .Values.workers.keda.minReplicaCount }}
Expand Down
15 changes: 15 additions & 0 deletions helm_tests/airflow_core/test_triggerer.py
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,21 @@ def test_should_remove_replicas_field(self):

assert "replicas" not in jmespath.search("spec", docs[0])

@pytest.mark.parametrize(
"executor", ["CeleryExecutor", "CeleryKubernetesExecutor", "CeleryExecutor,KubernetesExecutor"]
)
def test_include_event_source_container_name_in_scaled_object_for_triggerer(self, executor):
docs = render_chart(
values={
"triggerer": {
"keda": {"enabled": True},
},
},
show_only=["templates/triggerer/triggerer-kedaautoscaler.yaml"],
)

assert jmespath.search("spec.scaleTargetRef.envSourceContainerName", docs[0]) == "triggerer"

@pytest.mark.parametrize(
"query, expected_query",
[
Expand Down
13 changes: 13 additions & 0 deletions helm_tests/other/test_keda.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,19 @@ def test_keda_enabled(self, executor, is_created):
else:
assert docs == []

@pytest.mark.parametrize(
"executor", ["CeleryExecutor", "CeleryKubernetesExecutor", "CeleryExecutor,KubernetesExecutor"]
)
def test_include_event_source_container_name_in_scaled_object(self, executor):
docs = render_chart(
values={
"workers": {"keda": {"enabled": True}, "persistence": {"enabled": False}},
"executor": executor,
},
show_only=["templates/workers/worker-kedaautoscaler.yaml"],
)
assert jmespath.search("spec.scaleTargetRef.envSourceContainerName", docs[0]) == "worker"

@pytest.mark.parametrize(
"executor", ["CeleryExecutor", "CeleryKubernetesExecutor", "CeleryExecutor,KubernetesExecutor"]
)
Expand Down

0 comments on commit ca7c6ad

Please sign in to comment.