annotation configuration on service account (#47)

Signed-off-by: Vincent Desjardins <vdesjardins@gmail.com>
This commit is contained in:
Vincent Desjardins 2019-09-06 10:48:12 -04:00 committed by Jason O'Donnell
parent 5a64f9cc9e
commit 2852fbba9b
4 changed files with 43 additions and 0 deletions

View file

@ -259,6 +259,15 @@ Sets extra ui service annotations
{{- end }} {{- end }}
{{- end -}} {{- end -}}
{{/*
Sets extra service account annotations
*/}}
{{- define "vault.serviceaccount.annotations" -}}
{{- if and (ne .mode "dev") .Values.server.serviceaccount.annotations }}
annotations:
{{- toYaml .Values.server.serviceaccount.annotations | nindent 4 }}
{{- end }}
{{- end -}}
{{/* {{/*
Set's the container resources if the user has set any. Set's the container resources if the user has set any.

View file

@ -10,4 +10,5 @@ metadata:
app.kubernetes.io/name: {{ include "vault.name" . }} app.kubernetes.io/name: {{ include "vault.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }} app.kubernetes.io/managed-by: {{ .Release.Service }}
{{ template "vault.serviceaccount.annotations" . }}
{{ end }} {{ end }}

View file

@ -0,0 +1,29 @@
#!/usr/bin/env bats
load _helpers
@test "server/ServiceAccount: specify annotations" {
cd `chart_dir`
local actual=$(helm template \
-x templates/server-serviceaccount.yaml \
--set 'server.dev.enabled=true' \
--set 'server.serviceaccount.annotations.foo=bar' \
. | tee /dev/stderr |
yq -r '.metadata.annotations["foo"]' | tee /dev/stderr)
[ "${actual}" = "null" ]
local actual=$(helm template \
-x templates/server-serviceaccount.yaml \
--set 'server.ha.enabled=true' \
--set 'server.serviceaccount.annotations.foo=bar' \
. | tee /dev/stderr |
yq -r '.metadata.annotations["foo"]' | tee /dev/stderr)
[ "${actual}" = "bar" ]
local actual=$(helm template \
-x templates/server-serviceaccount.yaml \
--set 'server.ha.enabled=true' \
. | tee /dev/stderr |
yq -r '.metadata.annotations["foo"]' | tee /dev/stderr)
[ "${actual}" = "null" ]
}

View file

@ -206,6 +206,10 @@ server:
# replicas. If you'd like a custom value, you can specify an override here. # replicas. If you'd like a custom value, you can specify an override here.
maxUnavailable: null maxUnavailable: null
# Definition of the serviceaccount used to run Vault.
serviceaccount:
annotations: {}
# Vault UI # Vault UI
ui: ui:
# True if you want to create a Service entry for the Vault UI. # True if you want to create a Service entry for the Vault UI.