Allow scale to zero (#943)

This commit is contained in:
Johannes Siebel 2023-08-15 11:50:25 +02:00 committed by GitHub
parent 9a16496e86
commit ec964a33ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 1 deletions

View file

@ -156,7 +156,11 @@ Set's the replica count based on the different modes configured by user
{{ if eq .mode "standalone" }}
{{- default 1 -}}
{{ else if eq .mode "ha" }}
{{- .Values.server.ha.replicas | default 3 -}}
{{- if kindIs "int64" .Values.server.ha.replicas -}}
{{- .Values.server.ha.replicas -}}
{{ else }}
{{- 3 -}}
{{- end -}}
{{ else }}
{{- default 1 -}}
{{ end }}

View file

@ -157,6 +157,28 @@ load _helpers
[ "${actual}" = "10" ]
}
@test "server/ha-StatefulSet: zero replicas" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/server-statefulset.yaml \
--set 'server.ha.enabled=true' \
--set 'server.ha.replicas=0' \
. | tee /dev/stderr |
yq -r '.spec.replicas' | tee /dev/stderr)
[ "${actual}" = "0" ]
}
@test "server/ha-StatefulSet: invalid value for replicas" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/server-statefulset.yaml \
--set 'server.ha.enabled=true' \
--set 'server.ha.replicas=null' \
. | tee /dev/stderr |
yq -r '.spec.replicas' | tee /dev/stderr)
[ "${actual}" = "3" ]
}
#--------------------------------------------------------------------
# resources