Skip to content

Commit

Permalink
Improved PVC configuration to optionally keep the volume after uninst…
Browse files Browse the repository at this point in the history
…alling the deployment (#60)
  • Loading branch information
groundhog2k authored Dec 17, 2023
1 parent ba5ff95 commit e87e33f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion charts/vaultwarden/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ maintainers:
- name: guerzon
email: [email protected]
url: https://github.com/guerzon
version: 0.18.0
version: 0.18.1
kubeVersion: ">=1.12.0-0"
13 changes: 12 additions & 1 deletion charts/vaultwarden/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ data:
path: "/srv/vaultwarden-data"
```

To use persistent storage for attachments, set the `attachmenets` dictionary. Optionally set a different path. Note that by default, the path is `/data/attachments`.
To use persistent storage for attachments, set the `attachments` dictionary. Optionally set a different path. Note that by default, the path is `/data/attachments`.

```yaml
data:
Expand All @@ -217,6 +217,17 @@ data:
class: "local-path"
```

In case you want to keep the existing persistent volume claim during uninstall and redeployments, set the option `keepPvc: true`
(This will be ignored for StatefulSets and is only relevant for `resourceType: Deployment`)

```yaml
data:
name: "vaultwarden-data"
size: "15Gi"
class: "local-path"
keepPvc: true
```

## Uninstall

To uninstall/delete the `vaultwarden-demo` release:
Expand Down
9 changes: 9 additions & 0 deletions charts/vaultwarden/templates/_pvcSpec.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ volumeClaimTemplates:
annotations:
meta.helm.sh/release-name: {{ $.Release.Name | quote }}
meta.helm.sh/release-namespace: {{ $.Release.Namespace | quote }}
{{- if .keepPvc }}
helm.sh/resource-policy: keep
{{- end }}
spec:
accessModes:
- "ReadWriteOnce"
Expand All @@ -24,6 +27,12 @@ volumeClaimTemplates:
name: {{ .name }}
labels:
{{- include "vaultwarden.labels" $ | nindent 10 }}
annotations:
meta.helm.sh/release-name: {{ $.Release.Name | quote }}
meta.helm.sh/release-namespace: {{ $.Release.Namespace | quote }}
{{- if .keepPvc }}
helm.sh/resource-policy: keep
{{- end }}
spec:
accessModes:
- "ReadWriteOnce"
Expand Down
2 changes: 2 additions & 0 deletions charts/vaultwarden/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,7 @@ data: {}
# size: "15Gi"
# class: ""
# path: "/data"
# keepPvc: false

## @param attachments Attachments directory configuration, refer to values.yaml for parameters.
## By default, attachments/ is located inside the data directory.
Expand All @@ -389,6 +390,7 @@ attachments: {}
# size: "100Gi"
# class: ""
# path: /files
# keepPvc: false

## @section Logging Configuration
##
Expand Down

0 comments on commit e87e33f

Please sign in to comment.