Add support for setting service type (#65)
This commit is contained in:
parent
b52b0d3c15
commit
f957c52acc
2 changed files with 52 additions and 0 deletions
|
@ -19,6 +19,9 @@ metadata:
|
||||||
{{ toYaml .Values.server.service.annotations | indent 4 }}
|
{{ toYaml .Values.server.service.annotations | indent 4 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
spec:
|
spec:
|
||||||
|
{{- if .Values.server.service.type}}
|
||||||
|
type: {{ .Values.server.service.type }}
|
||||||
|
{{- end}}
|
||||||
{{- if .Values.server.service.clusterIP }}
|
{{- if .Values.server.service.clusterIP }}
|
||||||
clusterIP: {{ .Values.server.service.clusterIP }}
|
clusterIP: {{ .Values.server.service.clusterIP }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
|
@ -174,6 +174,55 @@ load _helpers
|
||||||
[ "${actual}" = "true" ]
|
[ "${actual}" = "true" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "server/Service: type empty by default" {
|
||||||
|
cd `chart_dir`
|
||||||
|
local actual=$(helm template \
|
||||||
|
-x templates/server-service.yaml \
|
||||||
|
--set 'server.dev.enabled=true' \
|
||||||
|
. | tee /dev/stderr |
|
||||||
|
yq -r '.spec.type' | tee /dev/stderr)
|
||||||
|
[ "${actual}" = "null" ]
|
||||||
|
|
||||||
|
local actual=$(helm template \
|
||||||
|
-x templates/server-service.yaml \
|
||||||
|
--set 'server.ha.enabled=true' \
|
||||||
|
. | tee /dev/stderr |
|
||||||
|
yq -r '.spec.type' | tee /dev/stderr)
|
||||||
|
[ "${actual}" = "null" ]
|
||||||
|
|
||||||
|
local actual=$(helm template \
|
||||||
|
-x templates/server-service.yaml \
|
||||||
|
. | tee /dev/stderr |
|
||||||
|
yq -r '.spec.type' | tee /dev/stderr)
|
||||||
|
[ "${actual}" = "null" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "server/Service: type can set" {
|
||||||
|
cd `chart_dir`
|
||||||
|
local actual=$(helm template \
|
||||||
|
-x templates/server-service.yaml \
|
||||||
|
--set 'server.dev.enabled=true' \
|
||||||
|
--set 'server.service.type=NodePort' \
|
||||||
|
. | tee /dev/stderr |
|
||||||
|
yq -r '.spec.type' | tee /dev/stderr)
|
||||||
|
[ "${actual}" = "NodePort" ]
|
||||||
|
|
||||||
|
local actual=$(helm template \
|
||||||
|
-x templates/server-service.yaml \
|
||||||
|
--set 'server.ha.enabled=true' \
|
||||||
|
--set 'server.service.type=NodePort' \
|
||||||
|
. | tee /dev/stderr |
|
||||||
|
yq -r '.spec.type' | tee /dev/stderr)
|
||||||
|
[ "${actual}" = "NodePort" ]
|
||||||
|
|
||||||
|
local actual=$(helm template \
|
||||||
|
-x templates/server-service.yaml \
|
||||||
|
--set 'server.service.type=NodePort' \
|
||||||
|
. | tee /dev/stderr |
|
||||||
|
yq -r '.spec.type' | tee /dev/stderr)
|
||||||
|
[ "${actual}" = "NodePort" ]
|
||||||
|
}
|
||||||
|
|
||||||
@test "server/Service: clusterIP empty by default" {
|
@test "server/Service: clusterIP empty by default" {
|
||||||
cd `chart_dir`
|
cd `chart_dir`
|
||||||
local actual=$(helm template \
|
local actual=$(helm template \
|
||||||
|
|
Loading…
Reference in a new issue