Add helm post-install hook to automate placement tagging in CouchDB nodes (#66)
* Add placementManager Job to automate placement tagging
* Bump chart version to 3.6.0
diff --git a/couchdb/Chart.yaml b/couchdb/Chart.yaml
index 8d1cbae..80269a0 100644
--- a/couchdb/Chart.yaml
+++ b/couchdb/Chart.yaml
@@ -1,6 +1,6 @@
apiVersion: v1
name: couchdb
-version: 3.5.2
+version: 3.6.0
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/README.md b/couchdb/README.md
index 6cb285a..bd06357 100644
--- a/couchdb/README.md
+++ b/couchdb/README.md
@@ -214,6 +214,10 @@
| `prometheusPort.enabled` | false |
| `prometheusPort.port` | 17896 |
| `prometheusPort.bind_address` | 0.0.0.0 |
+| `placementConfig.enabled` | false |
+| `placementConfig.image.repository` | caligrafix/couchdb-autoscaler-placement-manager|
+| `placementConfig.image.tag` | 0.1.0 |
+
## Feedback, Issues, Contributing
General feedback is welcome at our [user][1] or [developer][2] mailing lists.
diff --git a/couchdb/templates/placementmanager.yaml b/couchdb/templates/placementmanager.yaml
new file mode 100644
index 0000000..b77d723
--- /dev/null
+++ b/couchdb/templates/placementmanager.yaml
@@ -0,0 +1,44 @@
+{{- if .Values.placementConfig.enabled -}}
+apiVersion: batch/v1
+kind: Job
+metadata:
+ name: {{ template "couchdb.fullname" . }}
+ 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 "+" "_" }}
+ annotations:
+ # This is what defines this resource as a hook. Without this line, the
+ # job is considered part of the release.
+ "helm.sh/hook": post-install
+ "helm.sh/hook-weight": "-5"
+ "helm.sh/hook-delete-policy": before-hook-creation
+spec:
+ template:
+ metadata:
+ name: "{{ .Release.Name }}"
+ labels:
+ app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
+ app.kubernetes.io/instance: {{ .Release.Name | quote }}
+ helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
+ spec:
+ restartPolicy: OnFailure
+ containers:
+ - name: placement-tagging-job
+ image: {{ .Values.placementConfig.image.repository }}:{{ .Values.placementConfig.image.tag }}
+ imagePullPolicy: Always
+ args: ["--placement-manager"]
+ envFrom:
+ - secretRef:
+ name: couchdb-couchdb
+ - configMapRef:
+ name: {{ template "couchdb.fullname" . }}
+ env:
+ - name: NAMESPACE
+ value: {{ .Release.Namespace }}
+ - name: COUCHDB_SVC
+ value: {{ template "couchdb.svcname" . }}
+ - name: COUCHDB_PORT
+ value: {{ .Values.service.externalPort | quote }}
+{{- end -}}
diff --git a/couchdb/values.yaml b/couchdb/values.yaml
index e45f56b..f76dc25 100644
--- a/couchdb/values.yaml
+++ b/couchdb/values.yaml
@@ -221,3 +221,13 @@
# volumeMounts:
# - name: database-storage
# mountPath: /opt/couchdb/data/
+
+
+# Placement manager to annotate each document in the nodes DB with "zone" attribute
+# recording the zone where node has been scheduled
+# Ref: https://docs.couchdb.org/en/stable/cluster/sharding.html#specifying-database-placement
+placementConfig:
+ enabled: false
+ image:
+ repository: caligrafix/couchdb-autoscaler-placement-manager
+ tag: 0.1.0
diff --git a/docs/couchdb-3.6.0.tgz b/docs/couchdb-3.6.0.tgz
new file mode 100644
index 0000000..0c4f404
--- /dev/null
+++ b/docs/couchdb-3.6.0.tgz
Binary files differ
diff --git a/docs/index.yaml b/docs/index.yaml
index 0300250..05bde67 100644
--- a/docs/index.yaml
+++ b/docs/index.yaml
@@ -3,6 +3,30 @@
couchdb:
- apiVersion: v1
appVersion: 3.2.1
+ created: "2022-01-27T12:14:55.94368627-03: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: 8a6dc96fbf7df0f4bf1f95bd763fb523bad98dcc34282a5b3623c2a5b2b5d36a
+ 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-helm
+ - https://github.com/apache/couchdb-docker
+ urls:
+ - https://apache.github.io/couchdb-helm/couchdb-3.6.0.tgz
+ version: 3.6.0
+ - apiVersion: v1
+ appVersion: 3.2.1
created: "2022-01-24T11:16:39.860979-05: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.
@@ -393,4 +417,4 @@
urls:
- https://apache.github.io/couchdb-helm/couchdb-2.2.0.tgz
version: 2.2.0
-generated: "2022-01-24T11:16:39.859868-05:00"
+generated: "2022-01-27T12:14:55.941950611-03:00"