diff --git a/templates/csi-daemonset.yaml b/templates/csi-daemonset.yaml index 1436ff905..b019f3dc4 100644 --- a/templates/csi-daemonset.yaml +++ b/templates/csi-daemonset.yaml @@ -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 }} diff --git a/test/unit/csi-daemonset.bats b/test/unit/csi-daemonset.bats index d3d4221e5..efa5fc224 100644 --- a/test/unit/csi-daemonset.bats +++ b/test/unit/csi-daemonset.bats @@ -177,17 +177,40 @@ load _helpers --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 \ --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=$(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=$(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` diff --git a/values.yaml b/values.yaml index 839d805fc..702513549 100644 --- a/values.yaml +++ b/values.yaml @@ -1225,7 +1225,12 @@ csi: # Number of seconds after which the probe times out. timeoutSeconds: 3 - # Enables debug logging. + # Configures the log verbosity of the injector. + # 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.