Skip to content

Commit

Permalink
feat: add keda
Browse files Browse the repository at this point in the history
  • Loading branch information
mikhail-klimko committed May 31, 2024
1 parent f71d105 commit 6f2ac80
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
7 changes: 4 additions & 3 deletions charts/cf-common-test/tests/keda/error_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@ suite: KEDA ScaledObject error handlers
templates:
- templates/scaled-object.yaml
tests:
- it: Test ScaledObject non-zero idleReplicaCount
- it: Test ScaledObject zero idleReplicaCount
values:
- values.yaml
set:
keda:
spec:
idleReplicaCount: 1
asserts:
- failedTemplate:
errorMessage: "Only 0 is allowed for idleReplicaCount"
- equal:
path: spec.idleReplicaCount
value: 0

- it: Test ScaledObject fallback
values:
Expand Down
4 changes: 1 addition & 3 deletions charts/cf-common-test/tests/keda/spec_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,15 @@ tests:
spec:
minReplicaCount: 2
maxReplicaCount: 10
idleReplicaCount: 0
asserts:
- equal:
path: spec.minReplicaCount
value: 2
- equal:
path: spec.maxReplicaCount
value: 10
- equal:
- isNull:
path: spec.idleReplicaCount
value: 0

- it: Test ScaledObject pollingInterval/cooldownPeriod
values:
Expand Down
4 changes: 1 addition & 3 deletions charts/cf-common/templates/keda/_scaledobject.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,8 @@ spec:
{{- end }}
pollingInterval: {{ .Values.keda.spec.pollingInterval | default 30 }}
cooldownPeriod: {{ .Values.keda.spec.cooldownPeriod | default 300 }}
{{- if (eq 0 (int .Values.keda.spec.idleReplicaCount)) }}
{{- with .Values.keda.spec.idleReplicaCount }}
idleReplicaCount: 0
{{- else }}
{{- fail "ERROR: Only 0 is allowed for idleReplicaCount" }}
{{- end }}
minReplicaCount: {{ .Values.keda.spec.minReplicaCount | default 1 }}
maxReplicaCount: {{ .Values.keda.spec.maxReplicaCount | default 100 }}
Expand Down
2 changes: 1 addition & 1 deletion charts/cf-common/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ keda:
envSourceContainerName: null
pollingInterval: null # default to 30
cooldownPeriod: null # default to 300
# idleReplicaCount: null # Only 0 is allowed!
idleReplicaCount: null # Only 0 is allowed!
minReplicaCount: null # default to 1
maxReplicaCount: null # default to 100
fallback: {}
Expand Down

0 comments on commit 6f2ac80

Please sign in to comment.