Add configurable mountPath for audit/data storage (#393)

This commit is contained in:
Jason O'Donnell 2020-10-01 09:32:46 -04:00 committed by GitHub
parent c16905edca
commit 13ef8db3b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 56 additions and 2 deletions

View file

@ -146,12 +146,12 @@ based on the mode configured.
{{- define "vault.mounts" -}}
{{ if eq (.Values.server.auditStorage.enabled | toString) "true" }}
- name: audit
mountPath: /vault/audit
mountPath: {{ .Values.server.auditStorage.mountPath }}
{{ end }}
{{ if or (eq .mode "standalone") (and (eq .mode "ha") (eq (.Values.server.ha.raft.enabled | toString) "true")) }}
{{ if eq (.Values.server.dataStorage.enabled | toString) "true" }}
- name: data
mountPath: /vault/data
mountPath: {{ .Values.server.dataStorage.mountPath }}
{{ end }}
{{ end }}
{{ if and (ne .mode "dev") (or (.Values.server.standalone.config) (.Values.server.ha.config)) }}

View file

@ -604,6 +604,56 @@ load _helpers
[ "${actual}" = "0" ]
}
@test "server/standalone-StatefulSet: default audit storage mount path" {
cd `chart_dir`
local object=$(helm template \
--show-only templates/server-statefulset.yaml \
--set 'server.auditStorage.enabled=true' \
. | tee /dev/stderr |
yq -r '.spec.template.spec.containers[0].volumeMounts[] | select(.name == "audit")' | tee /dev/stderr)
local actual=$(echo $object | yq -r '.mountPath' | tee /dev/stderr)
[ "${actual}" = "/vault/audit" ]
}
@test "server/standalone-StatefulSet: can configure audit storage mount path" {
cd `chart_dir`
local object=$(helm template \
--show-only templates/server-statefulset.yaml \
--set 'server.auditStorage.enabled=true' \
--set 'server.auditStorage.mountPath=/var/log/vault' \
. | tee /dev/stderr |
yq -r '.spec.template.spec.containers[0].volumeMounts[] | select(.name == "audit")' | tee /dev/stderr)
local actual=$(echo $object | yq -r '.mountPath' | tee /dev/stderr)
[ "${actual}" = "/var/log/vault" ]
}
@test "server/standalone-StatefulSet: default data storage mount path" {
cd `chart_dir`
local object=$(helm template \
--show-only templates/server-statefulset.yaml \
--set 'server.dataStorage.enabled=true' \
. | tee /dev/stderr |
yq -r '.spec.template.spec.containers[0].volumeMounts[] | select(.name == "data")' | tee /dev/stderr)
local actual=$(echo $object | yq -r '.mountPath' | tee /dev/stderr)
[ "${actual}" = "/vault/data" ]
}
@test "server/standalone-StatefulSet: can configure data storage mount path" {
cd `chart_dir`
local object=$(helm template \
--show-only templates/server-statefulset.yaml \
--set 'server.dataStorage.enabled=true' \
--set 'server.dataStorage.mountPath=/opt/vault' \
. | tee /dev/stderr |
yq -r '.spec.template.spec.containers[0].volumeMounts[] | select(.name == "data")' | tee /dev/stderr)
local actual=$(echo $object | yq -r '.mountPath' | tee /dev/stderr)
[ "${actual}" = "/opt/vault" ]
}
@test "server/standalone-StatefulSet: affinity is set by default" {
cd `chart_dir`
local actual=$(helm template \

View file

@ -369,6 +369,8 @@ server:
enabled: true
# Size of the PVC created
size: 10Gi
# Location where the PVC will be mounted.
mountPath: "/vault/data"
# Name of the storage class to use. If null it will use the
# configured default Storage Class.
storageClass: null
@ -386,6 +388,8 @@ server:
enabled: false
# Size of the PVC created
size: 10Gi
# Location where the PVC will be mounted.
mountPath: "/vault/audit"
# Name of the storage class to use. If null it will use the
# configured default Storage Class.
storageClass: null