Skip to content

Commit

Permalink
Add pdb (#117)
Browse files Browse the repository at this point in the history
Adds a optional PDB to make node drains/cordons safer
  • Loading branch information
bryopsida authored May 22, 2023
1 parent 4b40b84 commit 5fcb7da
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 5 deletions.
2 changes: 1 addition & 1 deletion couchdb/Chart.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
12 changes: 8 additions & 4 deletions couchdb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 -)
```
Expand All @@ -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
```
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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` | |
Expand Down
3 changes: 3 additions & 0 deletions couchdb/README.md.gotmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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` | |
Expand Down
21 changes: 21 additions & 0 deletions couchdb/templates/pdb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{{- if and .Values.podDisruptionBudget .Values.podDisruptionBudget.enabled }}
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
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 }}
7 changes: 7 additions & 0 deletions couchdb/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 5fcb7da

Please sign in to comment.