Skip to content

Commit

Permalink
Merge pull request hashicorp#395 from hashicorp/set-items
Browse files Browse the repository at this point in the history
Allow setting items for server.extraVolumes
  • Loading branch information
lkysow authored Mar 31, 2020
2 parents 0e5a0da + a14a6b7 commit ebf57c2
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
7 changes: 7 additions & 0 deletions templates/server-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ spec:
{{- else if (eq .type "secret") }}
secretName: {{ .name }}
{{- end }}
{{- with .items }}
items:
{{- range . }}
- key: {{.key}}
path: {{.path}}
{{- end }}
{{- end }}
{{- end }}
{{- if .Values.server.priorityClassName }}
priorityClassName: {{ .Values.server.priorityClassName | quote }}
Expand Down
14 changes: 14 additions & 0 deletions test/unit/server-statefulset.bats
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,20 @@ load _helpers
[ "${actual}" = "1" ]
}

@test "server/StatefulSet: adds extra secret volume with items" {
cd `chart_dir`

local actual=$(helm template \
-x templates/server-statefulset.yaml \
--set 'server.extraVolumes[0].type=secret' \
--set 'server.extraVolumes[0].name=foo' \
--set 'server.extraVolumes[0].items[0].key=key' \
--set 'server.extraVolumes[0].items[0].path=path' \
. | tee /dev/stderr |
yq -c '.spec.template.spec.volumes[] | select(.name == "userconfig-foo")' | tee /dev/stderr)
[ "${actual}" = "{\"name\":\"userconfig-foo\",\"secret\":{\"secretName\":\"foo\",\"items\":[{\"key\":\"key\",\"path\":\"path\"}]}}" ]
}

#--------------------------------------------------------------------
# affinity

Expand Down
3 changes: 3 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,9 @@ server:
# - type: secret (or "configMap")
# name: my-secret
# load: false # if true, will add to `-config-dir` to load by Consul
# items: # optional items array
# - key: key
# path: path

# Affinity Settings
# Commenting out or setting as empty the affinity variable, will allow
Expand Down

0 comments on commit ebf57c2

Please sign in to comment.