Add extraArgs support to dev mode (#421)

This commit is contained in:
Jason O'Donnell 2020-11-30 16:31:02 -05:00 committed by GitHub
parent b544e01391
commit a8c42428b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 13 deletions

View file

@ -103,18 +103,6 @@ extra volumes the user may have specified (such as a secret with TLS).
{{- end }}
{{- end -}}
{{/*
Set's a command to override the entrypoint defined in the image
so we can make the user experience nicer. This works in with
"vault.args" to specify what commands /bin/sh should run.
*/}}
{{- define "vault.command" -}}
{{ if or (eq .mode "standalone") (eq .mode "ha") }}
- "/bin/sh"
- "-ec"
{{ end }}
{{- end -}}
{{/*
Set's the args for custom command to render the Vault configuration
file with IP addresses to make the out of box experience easier
@ -131,6 +119,9 @@ for users looking to use this chart with Consul Helm.
[ -n "${TRANSIT_ADDR}" ] && sed -Ei "s|TRANSIT_ADDR|${TRANSIT_ADDR?}|g" /tmp/storageconfig.hcl;
[ -n "${RAFT_ADDR}" ] && sed -Ei "s|RAFT_ADDR|${RAFT_ADDR?}|g" /tmp/storageconfig.hcl;
/usr/local/bin/docker-entrypoint.sh vault server -config=/tmp/storageconfig.hcl {{ .Values.server.extraArgs }}
{{ else if eq .mode "dev" }}
- |
/usr/local/bin/docker-entrypoint.sh vault server -dev {{ .Values.server.extraArgs }}
{{ end }}
{{- end -}}

View file

@ -66,7 +66,9 @@ spec:
{{ template "vault.resources" . }}
image: {{ .Values.server.image.repository }}:{{ .Values.server.image.tag | default "latest" }}
imagePullPolicy: {{ .Values.server.image.pullPolicy }}
command: {{ template "vault.command" . }}
command:
- "/bin/sh"
- "-ec"
args: {{ template "vault.args" . }}
env:
- name: HOST_IP

View file

@ -403,3 +403,14 @@ load _helpers
yq -r '.spec.template.spec.securityContext.fsGroup' | tee /dev/stderr)
[ "${actual}" = "2000" ]
}
@test "server/dev-StatefulSet: add extraArgs" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/server-statefulset.yaml \
--set 'server.dev.enabled=true' \
--set 'server.extraArgs=foobar' \
. | tee /dev/stderr |
yq -r '.spec.template.spec.containers[0].args[0]' | tee /dev/stderr)
[[ "${actual}" = *"foobar"* ]]
}