vaultwarden
vaultwarden copied to clipboard
Adding PVC does not work, because namespace is missing
The current template only sets name on the PVC, so K8S adds it to the default namespace.
By adding the following to the pvc.yaml this issue is solved:
{{- $newPvc := merge (dict "metadata" (dict "namespace" $.Release.Namespace)) $newPvc }}
New pvc.yaml full:
{{- if eq (include "vaultwarden.resourceType" .) "Deployment" }}
{{- range $pvc := (fromYaml (include "vaultwarden.pvcSpec" .)).volumeClaimTemplates }}
---
apiVersion: v1
kind: PersistentVolumeClaim
{{- $newName := printf "%s-%s-0" $pvc.metadata.name $.Release.Name }}
{{- $newPvc := merge (dict "metadata" (dict "name" $newName)) $pvc }}
{{- $newPvc := merge (dict "metadata" (dict "namespace" $.Release.Namespace)) $newPvc }}
{{ $newPvc | toYaml }}
{{- end }}
{{- end }}