Fix ha standby and active service annotations (#268)

* service: fix annotations for HA standby/active services

* added unit tests

Co-authored-by: yotsub <63680950+yotsub@users.noreply.github.com>
This commit is contained in:
Theron Voran 2020-04-21 08:19:17 -07:00 committed by GitHub
parent 39631aad6b
commit 2072bf2dcd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 30 additions and 2 deletions

View file

@ -14,7 +14,7 @@ metadata:
app.kubernetes.io/managed-by: {{ .Release.Service }}
annotations:
{{- if .Values.server.service.annotations }}
{{ toYaml .Values.server.service.annotations | indent 4 }}
{{ tpl .Values.server.service.annotations . | indent 4 }}
{{- end }}
spec:
type: ClusterIP

View file

@ -14,7 +14,7 @@ metadata:
app.kubernetes.io/managed-by: {{ .Release.Service }}
annotations:
{{- if .Values.server.service.annotations }}
{{ toYaml .Values.server.service.annotations | indent 4 }}
{{ tpl .Values.server.service.annotations . | indent 4 }}
{{- end }}
spec:
type: ClusterIP

View file

@ -0,0 +1,14 @@
#!/usr/bin/env bats
load _helpers
@test "server/ha-active-Service: generic annotations" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/server-ha-active-service.yaml \
--set 'server.ha.enabled=true' \
--set 'server.service.annotations=vaultIsAwesome: true' \
. | tee /dev/stderr |
yq -r '.metadata.annotations["vaultIsAwesome"]' | tee /dev/stderr)
[ "${actual}" = "true" ]
}

View file

@ -0,0 +1,14 @@
#!/usr/bin/env bats
load _helpers
@test "server/ha-standby-Service: generic annotations" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/server-ha-standby-service.yaml \
--set 'server.ha.enabled=true' \
--set 'server.service.annotations=vaultIsAwesome: true' \
. | tee /dev/stderr |
yq -r '.metadata.annotations["vaultIsAwesome"]' | tee /dev/stderr)
[ "${actual}" = "true" ]
}