Skip to content

Commit

Permalink
Update CSI log tests (#1048)
Browse files Browse the repository at this point in the history
* Update CSI log tests

* update test

* Update test/unit/csi-daemonset.bats

Co-authored-by: Ben Ash <[email protected]>

* Update test/unit/csi-daemonset.bats

Co-authored-by: Ben Ash <[email protected]>

* Update values.yaml

Co-authored-by: Ben Ash <[email protected]>

* update with suggestions + update vault version

* update bats test

* update csi version

* update csi tag

* update changelog

* update changelog

* revert csi driver version

* Remove extra line

* flip precedence

* update yaml file

* Fix test

* revert change to avoid behavioral change

---------

Co-authored-by: Ben Ash <[email protected]>
  • Loading branch information
Zlaticanin and benashz authored Aug 9, 2024
1 parent 191e422 commit 0fa7697
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 9 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
## Unreleased

Changes:

* Default `vault` version updated to 1.17.3
* Default `vault-csi-provider` version updated to 1.5.0

Bugs:

* Properly handle JSON formatted server config [GH-1049](https://github.com/hashicorp/vault-helm/pull/1049)
Expand Down
6 changes: 5 additions & 1 deletion templates/csi-daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,11 @@ spec:
imagePullPolicy: {{ .Values.csi.image.pullPolicy }}
args:
- --endpoint=/provider/vault.sock
- --debug={{ .Values.csi.debug }}
{{- if .Values.csi.debug }}
- --log-level=debug
{{- else }}
- --log-level={{ .Values.csi.logLevel }}
{{- end }}
{{- if .Values.csi.hmacSecretName }}
- --hmac-secret-name={{ .Values.csi.hmacSecretName }}
{{- else }}
Expand Down
2 changes: 1 addition & 1 deletion test/acceptance/csi.bats
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ load _helpers
--namespace=acceptance \
--set="server.dev.enabled=true" \
--set="csi.enabled=true" \
--set="csi.debug=true" \
--set="csi.logLevel=debug" \
--set="csi.agent.logLevel=debug" \
--set="injector.enabled=false" \
.
Expand Down
34 changes: 30 additions & 4 deletions test/unit/csi-daemonset.bats
Original file line number Diff line number Diff line change
Expand Up @@ -172,22 +172,48 @@ load _helpers
# Debug arg
@test "csi/daemonset: debug arg is configurable" {
cd `chart_dir`
local actual=$(helm template \
local actual
actual=$(helm template \
--show-only templates/csi-daemonset.yaml \
--set "csi.enabled=true" \
. | tee /dev/stderr |
yq -r '.spec.template.spec.containers[0].args[1]' | tee /dev/stderr)
[ "${actual}" = "--debug=false" ]
[ "${actual}" = "--log-level=info" ]

local actual=$(helm template \
actual=$(helm template \
--show-only templates/csi-daemonset.yaml \
--set "csi.enabled=true" \
--set "csi.logLevel=error" \
--set "csi.debug=true" \
. | tee /dev/stderr |
yq -r '.spec.template.spec.containers[0].args[1]' | tee /dev/stderr)
[ "${actual}" = "--debug=true" ]
[ "${actual}" = "--log-level=debug" ]
}

@test "csi/daemonset: default log-level" {
cd `chart_dir`
local actual
actual=$(helm template \
--show-only templates/csi-daemonset.yaml \
--set "csi.enabled=true" \
. | tee /dev/stderr |
yq -r '.spec.template.spec.containers[0].args[1]' | tee /dev/stderr)
[ "${actual}" = "--log-level=info" ]
}

@test "csi/daemonset: log-level is configurable" {
cd `chart_dir`
local actual
actual=$(helm template \
--show-only templates/csi-daemonset.yaml \
--set "csi.enabled=true" \
--set "csi.logLevel=warn" \
. | tee /dev/stderr |
yq -r '.spec.template.spec.containers[0].args[1]' | tee /dev/stderr)
[ "${actual}" = "--log-level=warn" ]
}


# HMAC secret arg
@test "csi/daemonset: HMAC secret arg is configurable" {
cd `chart_dir`
Expand Down
11 changes: 8 additions & 3 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ injector:
# required.
agentImage:
repository: "hashicorp/vault"
tag: "1.17.2"
tag: "1.17.3"

# The default values for the injected Vault Agent containers.
agentDefaults:
Expand Down Expand Up @@ -1088,7 +1088,7 @@ csi:

image:
repository: "hashicorp/vault-csi-provider"
tag: "1.4.3"
tag: "1.5.0"
pullPolicy: IfNotPresent

# volumes is a list of volumes made available to all containers. These are rendered
Expand Down Expand Up @@ -1226,7 +1226,12 @@ csi:
# Number of seconds after which the probe times out.
timeoutSeconds: 3

# Enables debug logging.
# Configures the log level for the Vault CSI provider.
# Supported log levels include: trace, debug, info, warn, error, and off
logLevel: "info"

# Deprecated, set logLevel to debug instead.
# If set to true, the logLevel will be set to debug.
debug: false

# Pass arbitrary additional arguments to vault-csi-provider.
Expand Down

0 comments on commit 0fa7697

Please sign in to comment.