Require a server instance UUID (#15)
Requires `couchdbConfig.couchdb.uuid` to be set and fails helm install otherwise.
The option is mandatory since replication issues (See apache/couchdb#2298) can occur when all instances have different UUIDs which is what happens when couchdbConfig.couchdb.uuid is not set.
This is a major version bump as it requires upgrades to explicitly set this option.
diff --git a/couchdb/Chart.yaml b/couchdb/Chart.yaml
index deb6de7..fb44046 100644
--- a/couchdb/Chart.yaml
+++ b/couchdb/Chart.yaml
@@ -1,6 +1,6 @@
apiVersion: v1
name: couchdb
-version: 2.4.1
+version: 3.0.0
appVersion: 2.3.1
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 b48cd5b..ec7233c 100644
--- a/couchdb/README.md
+++ b/couchdb/README.md
@@ -15,7 +15,9 @@
```bash
$ helm repo add couchdb https://apache.github.io/couchdb-helm
-$ helm install couchdb/couchdb --set allowAdminParty=true
+$ helm install couchdb/couchdb \
+ --set allowAdminParty=true \
+ --set couchdbConfig.couchdb.uuid=$(curl https://www.uuidgenerator.net/api/version4 2>/dev/null | tr -d -)
```
## Prerequisites
@@ -33,9 +35,14 @@
$ helm repo add couchdb https://apache.github.io/couchdb-helm
```
+Afterwards install the chart replacing the UUID
+`decafbaddecafbaddecafbaddecafbad` with a custom one:
```bash
-$ helm install --name my-release couchdb/couchdb
+$ helm install \
+ --name my-release \
+ --set couchdbConfig.couchdb.uuid=decafbaddecafbaddecafbaddecafbad \
+ couchdb/couchdb
```
This will create a Secret containing the admin credentials for the cluster.
@@ -55,7 +62,11 @@
and then install the chart while overriding the `createAdminSecret` setting:
```bash
-$ helm install --name my-release --set createAdminSecret=false couchdb/couchdb
+$ helm install \
+ --name my-release \
+ --set createAdminSecret=false \
+ --set couchdbConfig.couchdb.uuid=decafbaddecafbaddecafbaddecafbad \
+ couchdb/couchdb
```
This Helm chart deploys CouchDB on the Kubernetes cluster in a default
@@ -80,6 +91,19 @@
A major chart version change (like v0.2.3 -> v1.0.0) indicates that there is an
incompatible breaking change needing manual actions.
+### Upgrade to 3.0.0
+
+Since version 3.0.0 setting the CouchDB server instance UUID is mandatory.
+Therefore you need to generate a UUID and supply it as a value during the
+upgrade as follows:
+
+```bash
+$ helm upgrade <release-name> \
+ --reuse-values \
+ --set couchdbConfig.couchdb.uuid=<UUID> \
+ couchdb/couchdb
+```
+
## Migrating from stable/couchdb
This chart replaces the `stable/couchdb` chart previously hosted by Helm and continues the
@@ -98,7 +122,7 @@
| Parameter | Description | Default |
|---------------------------------|-------------------------------------------------------|----------------------------------------|
| `clusterSize` | The initial number of nodes in the CouchDB cluster | 3 |
-| `couchdbConfig` | Map allowing override elements of server .ini config | chttpd.bind_address=any |
+| `couchdbConfig` | Map allowing override elements of server .ini config | *See below* |
| `allowAdminParty` | If enabled, start cluster without admin account | false (requires creating a Secret) |
| `createAdminSecret` | If enabled, create an admin account and cookie secret | true |
| `schedulerName` | Name of the k8s scheduler (other than default) | `nil` |
@@ -107,6 +131,16 @@
| `persistentVolume.size` | If enabled, the size of the persistent volume to attach | 10Gi
| `enableSearch` | Adds a sidecar for Lucene-powered text search | false |
+You can set the values of the `couchdbConfig` map according to the
+[official configuration][4]. The following shows the map's default values and
+required options to set:
+
+| Parameter | Description | Default |
+|---------------------------------|--------------------------------------------------------------------|----------------------------------------|
+| `couchdb.uuid` | UUID for this CouchDB server instance ([Required in a cluster][5]) | |
+| `chttpd.bind_address` | listens on all interfaces when set to any | any |
+| `chttpd.require_valid_user` | disables all the anonymous requests to the port 5984 when true | false |
+
A variety of other parameters are also configurable. See the comments in the
`values.yaml` file for further details:
@@ -175,3 +209,5 @@
[1]: http://mail-archives.apache.org/mod_mbox/couchdb-user/
[2]: http://mail-archives.apache.org/mod_mbox/couchdb-dev/
[3]: https://github.com/apache/couchdb/blob/master/CONTRIBUTING.md
+[4]: https://docs.couchdb.org/en/stable/config/index.html
+[5]: https://docs.couchdb.org/en/latest/setup/cluster.html#preparing-couchdb-nodes-to-be-joined-into-a-cluster
diff --git a/couchdb/ci/required-values.yaml b/couchdb/ci/required-values.yaml
new file mode 100644
index 0000000..79589d2
--- /dev/null
+++ b/couchdb/ci/required-values.yaml
@@ -0,0 +1,3 @@
+couchdbConfig:
+ couchdb:
+ uuid: "decafbaddecafbaddecafbaddecafbad"
diff --git a/couchdb/templates/_helpers.tpl b/couchdb/templates/_helpers.tpl
index 3a9288f..f9d013e 100644
--- a/couchdb/templates/_helpers.tpl
+++ b/couchdb/templates/_helpers.tpl
@@ -72,3 +72,10 @@
{{- template "couchdb.fullname" . -}}
{{- end -}}
{{- end -}}
+
+{{/*
+Fail if couchdbConfig.couchdb.uuid is undefined
+*/}}
+{{- define "couchdb.uuid" -}}
+{{- required "A value for couchdbConfig.couchdb.uuid must be set" (.Values.couchdbConfig.couchdb | default dict).uuid -}}
+{{- end -}}
\ No newline at end of file
diff --git a/couchdb/templates/configmap.yaml b/couchdb/templates/configmap.yaml
index 3520b01..a6a20e0 100644
--- a/couchdb/templates/configmap.yaml
+++ b/couchdb/templates/configmap.yaml
@@ -9,7 +9,9 @@
release: {{ .Release.Name | quote }}
data:
inifile: |
- {{ range $section, $settings := .Values.couchdbConfig -}}
+ {{ $couchdbConfig := dict "couchdb" (dict "uuid" (include "couchdb.uuid" .)) -}}
+ {{- $couchdbConfig := merge $couchdbConfig .Values.couchdbConfig -}}
+ {{- range $section, $settings := $couchdbConfig -}}
{{ printf "[%s]" $section }}
{{ range $key, $value := $settings -}}
{{ printf "%s = %s" $key ($value | toString) }}
diff --git a/couchdb/values.yaml b/couchdb/values.yaml
index f94faf7..a84e871 100644
--- a/couchdb/values.yaml
+++ b/couchdb/values.yaml
@@ -150,6 +150,8 @@
## by a ConfigMap object.
## ref: http://docs.couchdb.org/en/latest/config/index.html
couchdbConfig:
+ # couchdb:
+ # uuid: decafbaddecafbaddecafbaddecafbad # Unique identifier for this CouchDB server instance
# cluster:
# q: 8 # Create 8 shards for each database
chttpd:
diff --git a/docs/couchdb-3.0.0.tgz b/docs/couchdb-3.0.0.tgz
new file mode 100644
index 0000000..fa97799
--- /dev/null
+++ b/docs/couchdb-3.0.0.tgz
Binary files differ
diff --git a/docs/index.yaml b/docs/index.yaml
index 1e3801a..a3325cc 100644
--- a/docs/index.yaml
+++ b/docs/index.yaml
@@ -3,7 +3,30 @@
couchdb:
- apiVersion: v1
appVersion: 2.3.1
- created: "2019-11-01T11:51:15.339935463+01:00"
+ created: "2019-11-20T17:05:05.503189523+01:00"
+ description: A database featuring seamless multi-master sync, that scales from
+ big data to mobile, with an intuitive HTTP/JSON API and designed for reliability.
+ digest: 7770f1c19e948d9928eeed4f11ff960e598149bb5c0ae3e1f546b61e9dfb65f4
+ home: https://couchdb.apache.org/
+ icon: http://couchdb.apache.org/CouchDB-visual-identity/logo/CouchDB-couch-symbol.svg
+ keywords:
+ - couchdb
+ - database
+ - nosql
+ maintainers:
+ - email: kocolosk@apache.org
+ name: kocolosk
+ - email: willholley@apache.org
+ name: willholley
+ name: couchdb
+ sources:
+ - https://github.com/apache/couchdb-docker
+ urls:
+ - https://apache.github.io/couchdb-helm/couchdb-3.0.0.tgz
+ version: 3.0.0
+ - apiVersion: v1
+ appVersion: 2.3.1
+ created: "2019-11-20T17:05:05.500168632+01:00"
description: A database featuring seamless multi-master sync, that scales from
big data to mobile, with an intuitive HTTP/JSON API and designed for reliability.
digest: db0815c2766f76049b58d0954b66e0b70bf673a7d11c1d3cd9e07c775c646c12
@@ -26,7 +49,7 @@
version: 2.4.1
- apiVersion: v1
appVersion: 2.3.1
- created: "2019-11-01T11:51:15.339429507+01:00"
+ created: "2019-11-20T17:05:05.499725352+01:00"
description: A database featuring seamless multi-master sync, that scales from
big data to mobile, with an intuitive HTTP/JSON API and designed for reliability.
digest: daddf6cc7fe8bb63d6fa8679565d4496d92c23d9ff85b19521fca74c6412bc11
@@ -49,7 +72,7 @@
version: 2.4.0
- apiVersion: v1
appVersion: 2.3.1
- created: "2019-11-01T11:51:15.333646851+01:00"
+ created: "2019-11-20T17:05:05.499039305+01:00"
description: A database featuring seamless multi-master sync, that scales from
big data to mobile, with an intuitive HTTP/JSON API and designed for reliability.
digest: 0eba7c20ec47bc8556b3cb3b5137b578d46b37397493087d61b8199066f84782
@@ -72,7 +95,7 @@
version: 2.3.0
- apiVersion: v1
appVersion: 2.3.1
- created: "2019-11-01T11:51:15.330535744+01:00"
+ created: "2019-11-20T17:05:05.498407349+01:00"
description: A database featuring seamless multi-master sync, that scales from
big data to mobile, with an intuitive HTTP/JSON API and designed for reliability.
digest: f68e6187c2b65a02fdde9d49ec38e76a68c3d82421e5ea9e599bac87f4193c6a
@@ -93,4 +116,4 @@
urls:
- https://apache.github.io/couchdb-helm/couchdb-2.2.0.tgz
version: 2.2.0
-generated: "2019-11-01T11:51:15.321186109+01:00"
+generated: "2019-11-20T17:05:05.497677063+01:00"
diff --git a/test/kind-config.yaml b/test/kind-config.yaml
index e69de29..ee24a88 100644
--- a/test/kind-config.yaml
+++ b/test/kind-config.yaml
@@ -0,0 +1,5 @@
+kind: Cluster
+apiVersion: kind.sigs.k8s.io/v1alpha3
+nodes:
+ - role: control-plane
+ - role: worker