guerzon / vaultwarden

Helm chart for Vaultwarden, the (unofficial) Bitwarden-compatible server written in Rust, formerly known as bitwarden_rs
MIT License
151 stars 72 forks source link

Adding PVC does not work, because namespace is missing #104

Closed n-able-consulting closed 3 months ago

n-able-consulting commented 3 months ago

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 }}
guerzon commented 3 months ago

Thanks for raising this @n-able-consulting.