From 267bb27b75a0ad89c9df88f695d6ab9d5f94d491 Mon Sep 17 00:00:00 2001 From: bryopsida <8363252+bryopsida@users.noreply.github.com> Date: Sun, 14 May 2023 07:17:34 -0500 Subject: [PATCH 1/4] PDB management --- couchdb/Chart.yaml | 2 +- couchdb/templates/pdb.yaml | 20 ++++++++++++++++++++ couchdb/values.yaml | 7 +++++++ 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 couchdb/templates/pdb.yaml diff --git a/couchdb/Chart.yaml b/couchdb/Chart.yaml index 1de5fa8..76e58d4 100644 --- a/couchdb/Chart.yaml +++ b/couchdb/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 name: couchdb -version: 4.3.1 +version: 4.4.0 appVersion: 3.3.2 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/templates/pdb.yaml b/couchdb/templates/pdb.yaml new file mode 100644 index 0000000..8b0b4cc --- /dev/null +++ b/couchdb/templates/pdb.yaml @@ -0,0 +1,20 @@ +{{- if .Values.podDisruptionBudget.enabled }} +apiVersion: policy/v1 +kind: PodDisruptionBudget +name: "{{ .Release.Name }}-pdb" + labels: + app.kubernetes.io/managed-by: {{ .Release.Service | quote }} + app.kubernetes.io/instance: {{ .Release.Name | quote }} + app.kubernetes.io/version: {{ .Chart.AppVersion }} + helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} +spec: + {{- if .Values.podDisruptionBudget.minAvailable }} + minAvailable: {{ .Values.podDisruptionBudget.minAvailable }} + {{- end }} + {{- if .Values.podDisruptionBudget.maxUnavailable }} + maxUnavailable: {{ .Values.podDisruptionBudget.maxUnavailable }} + {{- end }} + selector: + matchLabels: +{{ include "couchdb.ss.selector" . | indent 6 }} +{{- end }} diff --git a/couchdb/values.yaml b/couchdb/values.yaml index cc9878e..19b6b50 100644 --- a/couchdb/values.yaml +++ b/couchdb/values.yaml @@ -221,6 +221,13 @@ readinessProbe: successThreshold: 1 timeoutSeconds: 1 +# Control an optional pod disruption budget +podDisruptionBudget: + # toggle creation of pod disruption budget, disabled by default + enabled: false + # minAvailable: 1 + maxUnavailable: 1 + # CouchDB 3.2.0 adds in a metrics endpoint on the path `/_node/_local/_prometheus`. # Optionally, a standalone, unauthenticated port can be exposed for these metrics. prometheusPort: From f0fd8773e48bc98e8a183a32a8d59c6c63a02a31 Mon Sep 17 00:00:00 2001 From: bryopsida <8363252+bryopsida@users.noreply.github.com> Date: Sun, 14 May 2023 07:45:20 -0500 Subject: [PATCH 2/4] update readme --- couchdb/README.md | 12 ++++++++---- couchdb/README.md.gotmpl | 3 +++ 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/couchdb/README.md b/couchdb/README.md index 5175d25..569837f 100644 --- a/couchdb/README.md +++ b/couchdb/README.md @@ -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.2.0 \ + --version=4.4.0 \ --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.2.0 \ + --version=4.4.0 \ --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.2.0 \ + --version=4.4.0 \ --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.2.0 couchdb/couchdb +$ helm upgrade my-release --version=4.4.0 couchdb/couchdb ``` ## Configuration @@ -193,6 +193,10 @@ A variety of other parameters are also configurable. See the comments in the | `persistentVolume.volumeName` | | | `persistentVolume.claimName` | | | `persistentVolume.volumeSource` | | +| `persistentVolume.annotations` | {} | +| `podDisruptionBudget.enabled` | false | +| `podDisruptionBudget.minAvailable` | nil | +| `podDisruptionBudget.maxUnavailable` | 1 | | `podManagementPolicy` | Parallel | | `affinity` | | | `topologySpreadConstraints` | | diff --git a/couchdb/README.md.gotmpl b/couchdb/README.md.gotmpl index 2bdd972..969c2d0 100644 --- a/couchdb/README.md.gotmpl +++ b/couchdb/README.md.gotmpl @@ -179,6 +179,9 @@ A variety of other parameters are also configurable. See the comments in the | `persistentVolume.accessModes` | ReadWriteOnce | | `persistentVolume.storageClass` | Default for the Kube cluster | | `persistentVolume.annotations` | {} | +| `podDisruptionBudget.enabled` | false | +| `podDisruptionBudget.minAvailable` | nil | +| `podDisruptionBudget.maxUnavailable` | 1 | | `podManagementPolicy` | Parallel | | `affinity` | | | `topologySpreadConstraints` | | From 52b5504f96c76e2f68e94785bf766926528d5375 Mon Sep 17 00:00:00 2001 From: bryopsida <8363252+bryopsida@users.noreply.github.com> Date: Sun, 14 May 2023 08:04:12 -0500 Subject: [PATCH 3/4] fix missing metadata --- couchdb/templates/pdb.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/couchdb/templates/pdb.yaml b/couchdb/templates/pdb.yaml index 8b0b4cc..04b241d 100644 --- a/couchdb/templates/pdb.yaml +++ b/couchdb/templates/pdb.yaml @@ -1,7 +1,8 @@ {{- if .Values.podDisruptionBudget.enabled }} apiVersion: policy/v1 kind: PodDisruptionBudget -name: "{{ .Release.Name }}-pdb" +metadata: + name: "{{ .Release.Name }}-pdb" labels: app.kubernetes.io/managed-by: {{ .Release.Service | quote }} app.kubernetes.io/instance: {{ .Release.Name | quote }} From 9e8c7238d1c208d420c5247471a4906681a44fa1 Mon Sep 17 00:00:00 2001 From: bryopsida <8363252+bryopsida@users.noreply.github.com> Date: Sat, 20 May 2023 07:55:51 -0500 Subject: [PATCH 4/4] add null check for presence of podDisruptionObject on pdb template --- couchdb/templates/pdb.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/couchdb/templates/pdb.yaml b/couchdb/templates/pdb.yaml index 04b241d..4b79818 100644 --- a/couchdb/templates/pdb.yaml +++ b/couchdb/templates/pdb.yaml @@ -1,4 +1,4 @@ -{{- if .Values.podDisruptionBudget.enabled }} +{{- if and .Values.podDisruptionBudget .Values.podDisruptionBudget.enabled }} apiVersion: policy/v1 kind: PodDisruptionBudget metadata: