You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by fl...@apache.org on 2020/09/21 13:38:51 UTC

[couchdb-helm] branch clusterSetup updated (ed30b9f -> 7c7d7cf)

This is an automated email from the ASF dual-hosted git repository.

flimzy pushed a change to branch clusterSetup
in repository https://gitbox.apache.org/repos/asf/couchdb-helm.git.


 discard ed30b9f  Update documentation
 discard 768aee8  Run _cluster_setup after installation
     new 8d015b9  Run _cluster_setup after installation
     new 7c7d7cf  Update documentation

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (ed30b9f)
            \
             N -- N -- N   refs/heads/clusterSetup (7c7d7cf)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 couchdb/templates/clustersetup.yaml | 2 ++
 1 file changed, 2 insertions(+)


[couchdb-helm] 01/02: Run _cluster_setup after installation

Posted by fl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

flimzy pushed a commit to branch clusterSetup
in repository https://gitbox.apache.org/repos/asf/couchdb-helm.git

commit 8d015b98fc9aa4304d89c92d45559b55de862bce
Author: Jonathan Hall <fl...@flimzy.com>
AuthorDate: Mon Sep 21 15:30:06 2020 +0200

    Run _cluster_setup after installation
---
 couchdb/templates/clustersetup.yaml | 76 +++++++++++++++++++++++++++++++++++++
 couchdb/values.yaml                 |  2 +
 2 files changed, 78 insertions(+)

diff --git a/couchdb/templates/clustersetup.yaml b/couchdb/templates/clustersetup.yaml
new file mode 100644
index 0000000..e00ab87
--- /dev/null
+++ b/couchdb/templates/clustersetup.yaml
@@ -0,0 +1,76 @@
+{{ if .Values.clusterSetup }}
+---
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: cluster-setup-script
+  labels:
+    app: {{ template "couchdb.name" . }}
+    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
+    release: {{ .Release.Name }}
+    heritage: {{ .Release.Service }}
+data:
+  setup.sh: |
+    set -e
+    BASE_URL=http://{{ template "couchdb.fullname" . }}:5984
+    set -x
+
+    echo "Waiting for CouchDB service to start..."
+    until curl --silent -max-time 5 --head --fail "${BASE_URL}/_up"; do
+        printf "%s: CouchDB not up yet. Will try again\n" "$(date)"
+        sleep 2
+    done
+
+    echo "Initializing cluster"
+    touch /tmp/curl.cf
+    {{ if not .Values.allowAdminParty }}
+        echo "-u $(cat /tmp/admin-password/adminUsername):$(cat /tmp/admin-password/adminPassword)" >> /tmp/curl.cf
+    {{ end }}
+    curl -silent "${BASE_URL}/_cluster_setup" \
+      -H "Content-Type: application/json" \
+      -d '{"action": "finish_cluster"}' \
+      -K /tmp/curl.cf
+
+    echo "Success!"
+---
+apiVersion: batch/v1
+kind: Job
+metadata:
+  name: cluster-setup-job
+  labels:
+    app: {{ template "couchdb.name" . }}
+    chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
+    release: {{ .Release.Name }}
+    heritage: {{ .Release.Service }}
+  annotations:
+    "helm.sh/hook": post-install
+    "helm.sh/hook-delete-policy": hook-succeeded
+spec:
+  template:
+    metadata:
+      name: cluster-setup-job
+      labels:
+        app: {{ template "couchdb.name" . }}
+        chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
+        release: {{ .Release.Name }}
+        heritage: {{ .Release.Service }}
+    spec:
+      restartPolicy: Never
+      volumes:
+        - name: admin-password-volume
+          secret:
+            secretName: {{ template "couchdb.fullname" . }}
+        - name: cluster-setup-script-volume
+          configMap:
+            name: cluster-setup-script
+      containers:
+      - name: cluster-setup-job
+        image: "curlimages/curl:7.72.0"
+        command: [ "/bin/sh", "/tmp/setup/setup.sh" ]
+        volumeMounts:
+        - name: admin-password-volume
+          readOnly: true
+          mountPath: /tmp/admin-password
+        - name: cluster-setup-script-volume
+          mountPath: /tmp/setup
+{{ end }}
diff --git a/couchdb/values.yaml b/couchdb/values.yaml
index 6a35426..cff9cc2 100644
--- a/couchdb/values.yaml
+++ b/couchdb/values.yaml
@@ -22,6 +22,8 @@ allowAdminParty: false
 ##    created ahead of time.
 createAdminSecret: true
 
+clusterSetup: false
+
 adminUsername: admin
 # adminPassword: this_is_not_secure
 # adminHash: -pbkdf2-this_is_not_necessarily_secure_either


[couchdb-helm] 02/02: Update documentation

Posted by fl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

flimzy pushed a commit to branch clusterSetup
in repository https://gitbox.apache.org/repos/asf/couchdb-helm.git

commit 7c7d7cfdc631635c104c9d9df38f50226af70a16
Author: Jonathan Hall <fl...@flimzy.com>
AuthorDate: Mon Sep 21 15:34:23 2020 +0200

    Update documentation
---
 couchdb/README.md           | 1 +
 couchdb/templates/NOTES.txt | 6 ++++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/couchdb/README.md b/couchdb/README.md
index ca3716b..fab0a85 100644
--- a/couchdb/README.md
+++ b/couchdb/README.md
@@ -142,6 +142,7 @@ CouchDB chart and their default values:
 | `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                                   |
+| `clusterSetup`                  | Finalize cluster configuration by calling /_cluster_setup endpoint after installation | false  |
 | `schedulerName`                 | Name of the k8s scheduler (other than default)        | `nil`                                  |
 | `erlangFlags`                   | Map of flags supplied to the underlying Erlang VM     | name: couchdb, setcookie: monster
 | `persistentVolume.enabled`      | Boolean determining whether to attach a PV to each node | false
diff --git a/couchdb/templates/NOTES.txt b/couchdb/templates/NOTES.txt
index a3658bd..483b73c 100644
--- a/couchdb/templates/NOTES.txt
+++ b/couchdb/templates/NOTES.txt
@@ -2,13 +2,12 @@ Apache CouchDB is starting. Check the status of the Pods using:
 
   kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "couchdb.name" . }},release={{ .Release.Name }}"
 
-Once all of the Pods are fully Ready, execute the following command to create
+Once all of the pods are fully ready, execute the following command to create
 some required system databases:
 
   kubectl exec --namespace {{ .Release.Namespace }} {{ if not .Values.allowAdminParty }}-it {{ end }}{{ template "couchdb.fullname" . }}-0 -c couchdb -- \
     curl -s \
     http://127.0.0.1:5984/_cluster_setup \
-    -X POST \
     -H "Content-Type: application/json" \
 {{- if .Values.allowAdminParty }}
     -d '{"action": "finish_cluster"}'
@@ -18,3 +17,6 @@ some required system databases:
 {{- end }}
 
 Then it's time to relax.
+
+As of chart version 3.4.0, the helm chart will attempt automatically to complete
+cluster setup after installation if the `clusterSetup` value is set to true.
\ No newline at end of file