This is an automated email from the ASF dual-hosted git repository.
willholley pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/couchdb-helm.git
The following commit(s) were added to refs/heads/main by this push:
new c83baf8 feat: allow configure persistentVolumeClaimRetentionPolicy
(#136)
c83baf8 is described below
commit c83baf88763357ebc12ee21dcd33f37ad698c9a6
Author: Jakub Rosa <[email protected]>
AuthorDate: Tue May 7 18:14:53 2024 +0200
feat: allow configure persistentVolumeClaimRetentionPolicy (#136)
Allow to specify a persistentVolumeClaimRetentionPolicy in both the primary
and secondary StatefulSet.
This allows for automatic cleanup of PVCs after deletion, etc. An example
use case of this is for highly dynamic test environments, where cleaning up the
PVCs after deletion of the helm chart is preferred.
---
couchdb/Chart.yaml | 2 +-
couchdb/README.md | 13 ++++++++-----
couchdb/templates/statefulset.yaml | 5 +++++
couchdb/values.yaml | 9 +++++++++
test/e2e-kind.sh | 2 +-
5 files changed, 24 insertions(+), 7 deletions(-)
diff --git a/couchdb/Chart.yaml b/couchdb/Chart.yaml
index a0c49d2..c6f74c9 100644
--- a/couchdb/Chart.yaml
+++ b/couchdb/Chart.yaml
@@ -1,6 +1,6 @@
apiVersion: v1
name: couchdb
-version: 4.5.1
+version: 4.5.2
appVersion: 3.3.3
description: A database featuring seamless multi-master sync, that scales from
big data to mobile, with an intuitive HTTP/JSON API and designed for
diff --git a/couchdb/README.md b/couchdb/README.md
index e4a3224..a4200f0 100644
--- a/couchdb/README.md
+++ b/couchdb/README.md
@@ -1,6 +1,6 @@
# CouchDB
-

+

Apache CouchDB is a database featuring seamless multi-master sync, that scales
from big data to mobile, with an intuitive HTTP/JSON API and designed for
@@ -18,7 +18,7 @@ storage volumes to each Pod in the Deployment.
```bash
$ helm repo add couchdb https://apache.github.io/couchdb-helm
$ helm install couchdb/couchdb \
- --version=4.5.1 \
+ --version=4.5.2 \
--set allowAdminParty=true \
--set couchdbConfig.couchdb.uuid=$(curl
https://www.uuidgenerator.net/api/version4 2>/dev/null | tr -d -)
```
@@ -44,7 +44,7 @@ Afterwards install the chart replacing the UUID
```bash
$ helm install \
--name my-release \
- --version=4.5.1 \
+ --version=4.5.2 \
--set couchdbConfig.couchdb.uuid=decafbaddecafbaddecafbaddecafbad \
couchdb/couchdb
```
@@ -78,7 +78,7 @@ and then install the chart while overriding the
`createAdminSecret` setting:
```bash
$ helm install \
--name my-release \
- --version=4.5.1 \
+ --version=4.5.2 \
--set createAdminSecret=false \
--set couchdbConfig.couchdb.uuid=decafbaddecafbaddecafbaddecafbad \
couchdb/couchdb
@@ -133,7 +133,7 @@ version semantics. You can upgrade directly from
`stable/couchdb` to this chart
```bash
$ helm repo add couchdb https://apache.github.io/couchdb-helm
-$ helm upgrade my-release --version=4.5.1 couchdb/couchdb
+$ helm upgrade my-release --version=4.5.2 couchdb/couchdb
```
## Configuration
@@ -194,6 +194,9 @@ A variety of other parameters are also configurable. See
the comments in the
| `persistentVolume.claimName` |
|
| `persistentVolume.volumeSource` |
|
| `persistentVolume.annotations` | {}
|
+| `persistentVolumeClaimRetentionPolicy.enabled` | Field controls if and
how PVCs are deleted during the lifecycle
|
+| `persistentVolumeClaimRetentionPolicy.whenScaled` | Configures the volume
retention behavior that applies when the replica count of the StatefulSet is
reduced |
+| `persistentVolumeClaimRetentionPolicy.whenDeleted` | Configures the volume
retention behavior that applies when the StatefulSet is deleted
|
| `podDisruptionBudget.enabled` | false
|
| `podDisruptionBudget.minAvailable` | nil
|
| `podDisruptionBudget.maxUnavailable` | 1
|
diff --git a/couchdb/templates/statefulset.yaml
b/couchdb/templates/statefulset.yaml
index 619a46d..f9c7bcf 100644
--- a/couchdb/templates/statefulset.yaml
+++ b/couchdb/templates/statefulset.yaml
@@ -236,6 +236,11 @@ spec:
claimName: {{ $claim.claimName }}
{{- end }}
{{- else }}
+{{- if .Values.persistentVolumeClaimRetentionPolicy.enabled }}
+ persistentVolumeClaimRetentionPolicy:
+ whenDeleted: {{ .Values.persistentVolumeClaimRetentionPolicy.whenDeleted }}
+ whenScaled: {{ .Values.persistentVolumeClaimRetentionPolicy.whenScaled }}
+{{- end }}
volumeClaimTemplates:
- metadata:
{{- include "persistentVolume.metadata" (dict "context" .) | nindent 8
}}
diff --git a/couchdb/values.yaml b/couchdb/values.yaml
index 5f65795..30941c5 100644
--- a/couchdb/values.yaml
+++ b/couchdb/values.yaml
@@ -75,6 +75,15 @@ persistentVolume:
size: 10Gi
# storageClass: "-"
+# Experimental - FEATURE STATE: Kubernetes v1.27 [beta]
+# Field controls if and how PVCs are deleted during the lifecycle
+# of a StatefulSet
+# ref:
https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#persistentvolumeclaim-retention
+persistentVolumeClaimRetentionPolicy:
+ enabled: false
+ whenScaled: Retain
+ whenDeleted: Retain
+
## The CouchDB image
image:
repository: couchdb
diff --git a/test/e2e-kind.sh b/test/e2e-kind.sh
index 525c8ee..35ac2ea 100755
--- a/test/e2e-kind.sh
+++ b/test/e2e-kind.sh
@@ -11,7 +11,7 @@ readonly K8S_VERSION=v1.25.3
run_ct_container() {
echo 'Running ct container...'
- docker run --rm --interactive --detach --network host --name ct \
+ docker run --rm --interactive --detach --network host --name ct
--userns=host \
--volume "$(pwd)/test/ct.yaml:/etc/ct/ct.yaml" \
--volume "$(pwd):/workdir" \
--workdir /workdir \