You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by wi...@apache.org on 2022/10/24 19:28:52 UTC

[couchdb-helm] branch main updated (973ac31 -> c93f124)

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

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


    from 973ac31  start a release-inventory.sh and install-cr.sh script
     new 3024366  auto-generate the erlangCookie variable
     new cd33102  bump chart version and add NEWS
     new c93f124  add a NOTES.txt output to mention the auto-generation

The 3 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/Chart.yaml             |  2 +-
 couchdb/NEWS.md                |  6 ++++++
 couchdb/templates/NOTES.txt    | 12 ++++++++++++
 couchdb/templates/_helpers.tpl | 25 ++++++++++++++++++++++++-
 couchdb/templates/secrets.yaml |  3 ++-
 5 files changed, 45 insertions(+), 3 deletions(-)
 create mode 100644 couchdb/NEWS.md


[couchdb-helm] 02/03: bump chart version and add NEWS

Posted by wi...@apache.org.
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

commit cd33102772d284af5e7e1c6aca4c0d071589b744
Author: Cole Arendt <co...@outlook.com>
AuthorDate: Mon Jun 20 06:23:43 2022 -0400

    bump chart version and add NEWS
---
 couchdb/Chart.yaml | 2 +-
 couchdb/NEWS.md    | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/couchdb/Chart.yaml b/couchdb/Chart.yaml
index 1c825b8..e131d0b 100644
--- a/couchdb/Chart.yaml
+++ b/couchdb/Chart.yaml
@@ -1,6 +1,6 @@
 apiVersion: v1
 name: couchdb
-version: 3.6.1
+version: 3.6.2
 appVersion: 3.2.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/NEWS.md b/couchdb/NEWS.md
new file mode 100644
index 0000000..2474ceb
--- /dev/null
+++ b/couchdb/NEWS.md
@@ -0,0 +1,6 @@
+# NEWS
+
+## 3.6.2
+
+- Change the `erlangCookie` to be auto-generated in a stateful fashion (i.e. we auto-generate it once, then leave that
+  value alone). ([#78](https://github.com/apache/couchdb-helm/issues/78))


[couchdb-helm] 01/03: auto-generate the erlangCookie variable

Posted by wi...@apache.org.
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

commit 3024366ec0ba94dff995abef98b52bad1534e406
Author: Cole Arendt <co...@outlook.com>
AuthorDate: Mon Jun 20 06:23:30 2022 -0400

    auto-generate the erlangCookie variable
    
    related to #78, #88. We auto-generate the secret if it is not provided, and then continue to use that value on upgrades rather than auto-generating fresh each time.
---
 couchdb/templates/_helpers.tpl | 25 ++++++++++++++++++++++++-
 couchdb/templates/secrets.yaml |  3 ++-
 2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/couchdb/templates/_helpers.tpl b/couchdb/templates/_helpers.tpl
index f9d013e..2f5c1a4 100644
--- a/couchdb/templates/_helpers.tpl
+++ b/couchdb/templates/_helpers.tpl
@@ -43,6 +43,29 @@ Create a random string if the supplied key does not exist
 {{- end -}}
 {{- end -}}
 
+{{- /*
+Create a random string if the supplied "secret" key does not exist. Otherwise create the key in a persistent fashion
+using `lookup` and `get`. The "key", "ns", and "secretName" keys need to be provided for this to work
+*/ -}}
+{{- define "couchdb.defaultsecret-stateful" -}}
+  {{- if .secret -}}
+    {{- .secret | b64enc | quote -}}
+  {{- else -}}
+    {{- /* generate secret, which will be overwritten if already exists */ -}}
+    {{- $autoSecret := randAlphaNum 20 | b64enc -}}
+    {{- if and (not (empty .key)) (not (empty .secretName)) }}
+      {{- $currentSecret := lookup "v1" "Secret" .ns .secretName }}
+      {{- if $currentSecret }}
+        {{- /* already exists, looking up */ -}}
+        {{- $autoSecret = get $currentSecret.data .key -}}
+      {{- end }}
+    {{- end }}
+    {{- print $autoSecret | quote -}}
+  {{- end -}}
+{{- end -}}
+
+
+
 {{/*
 Labels used to define Pods in the CouchDB statefulset
 */}}
@@ -78,4 +101,4 @@ 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
+{{- end -}}
diff --git a/couchdb/templates/secrets.yaml b/couchdb/templates/secrets.yaml
index 857543b..1028e53 100644
--- a/couchdb/templates/secrets.yaml
+++ b/couchdb/templates/secrets.yaml
@@ -12,7 +12,8 @@ type: Opaque
 data:
   adminUsername: {{ template "couchdb.defaultsecret" .Values.adminUsername }}
   adminPassword: {{ template "couchdb.defaultsecret" .Values.adminPassword }}
-  erlangCookie: {{ template "couchdb.defaultsecret" .Values.erlangFlags.setcookie }}
+  {{- $erlangCookieArgs := dict "key" "erlangCookie" "ns" $.Release.Namespace "secretName" (include "couchdb.fullname" .) "secret" .Values.erlangFlags.setcookie }}
+  erlangCookie: {{ template "couchdb.defaultsecret-stateful" $erlangCookieArgs }}
   cookieAuthSecret: {{ template "couchdb.defaultsecret" .Values.cookieAuthSecret }}
 {{- if  .Values.adminHash  }}
   password.ini: {{ tpl (.Files.Get "password.ini") . | b64enc }}


[couchdb-helm] 03/03: add a NOTES.txt output to mention the auto-generation

Posted by wi...@apache.org.
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

commit c93f124d66271906e7309b047a27019cfc7e8ddb
Author: Cole Arendt <co...@outlook.com>
AuthorDate: Mon Jun 20 06:23:56 2022 -0400

    add a NOTES.txt output to mention the auto-generation
---
 couchdb/templates/NOTES.txt | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/couchdb/templates/NOTES.txt b/couchdb/templates/NOTES.txt
index a3658bd..0727ca1 100644
--- a/couchdb/templates/NOTES.txt
+++ b/couchdb/templates/NOTES.txt
@@ -18,3 +18,15 @@ some required system databases:
 {{- end }}
 
 Then it's time to relax.
+
+{{- $erlangCookie := .Values.erlangFlags.setcookie }}
+{{- if (empty $erlangCookie) }}
+
+NOTE: You are using an auto-generated value for the Erlang Cookie
+  - We recommend making this value persistent by setting it in: `erlangFlags.setcookie`
+  - Changing this value can cause problems for the Couch DB installation (particularly upgrades / config changes)
+  - You can get the current value with:
+```
+kubectl -n {{ $.Release.Namespace }} get secret {{ include "couchdb.fullname" . }} --template='{{print "{{" }}index .data "erlangCookie" | base64decode{{ print "}}" }}'
+```
+{{- end }}