Skip to content

Commit

Permalink
Add extraArgs value for CSI (#526)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomhjp authored May 21, 2021
1 parent dbd99b1 commit 030d3cd
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 0 deletions.
3 changes: 3 additions & 0 deletions templates/csi-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ spec:
args:
- --endpoint=/provider/vault.sock
- --debug={{ .Values.csi.debug }}
{{- if .Values.csi.extraArgs }}
{{- toYaml .Values.csi.extraArgs | nindent 12 }}
{{- end }}
volumeMounts:
- name: providervol
mountPath: "/provider"
Expand Down
30 changes: 30 additions & 0 deletions test/unit/csi-daemonset.bats
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,36 @@ load _helpers
[ "${actual}" = "--debug=true" ]
}

# Extra args
@test "csi/daemonset: extra args can be passed" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/csi-daemonset.yaml \
--set "csi.enabled=true" \
. | tee /dev/stderr |
yq -r '.spec.template.spec.containers[0].args | length' | tee /dev/stderr)
[ "${actual}" = "2" ]

local object=$(helm template \
--show-only templates/csi-daemonset.yaml \
--set "csi.enabled=true" \
--set "csi.extraArgs={--foo=bar,--bar baz,first}" \
. | tee /dev/stderr |
yq -r '.spec.template.spec.containers[0]')
local actual=$(echo $object |
yq -r '.args | length' | tee /dev/stderr)
[ "${actual}" = "5" ]
local actual=$(echo $object |
yq -r '.args[2]' | tee /dev/stderr)
[ "${actual}" = "--foo=bar" ]
local actual=$(echo $object |
yq -r '.args[3]' | tee /dev/stderr)
[ "${actual}" = "--bar baz" ]
local actual=$(echo $object |
yq -r '.args[4]' | tee /dev/stderr)
[ "${actual}" = "first" ]
}

# updateStrategy
@test "csi/daemonset: updateStrategy is configurable" {
cd `chart_dir`
Expand Down
3 changes: 3 additions & 0 deletions values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
"enabled": {
"type": "boolean"
},
"extraArgs": {
"type": "array"
},
"image": {
"type": "object",
"properties": {
Expand Down
3 changes: 3 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -773,3 +773,6 @@ csi:

# Enables debug logging.
debug: false

# Pass arbitrary additional arguments to vault-csi-provider.
extraArgs: []

0 comments on commit 030d3cd

Please sign in to comment.