Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support lifecycle hooks #124

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.5.2
version: 4.6.0
appVersion: 3.3.3
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
14 changes: 9 additions & 5 deletions couchdb/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# CouchDB

![Version: 4.5.2](https://img.shields.io/badge/Version-4.5.2-informational?style=flat-square) ![AppVersion: 3.3.3](https://img.shields.io/badge/AppVersion-3.3.3-informational?style=flat-square)
![Version: 4.6.0](https://img.shields.io/badge/Version-4.6.0-informational?style=flat-square) ![AppVersion: 3.3.3](https://img.shields.io/badge/AppVersion-3.3.3-informational?style=flat-square)

Apache CouchDB is a database featuring seamless multi-master sync, that scales
from big data to mobile, with an intuitive HTTP/JSON API and designed for
Expand All @@ -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.5.2 \
--version=4.6.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.5.2 \
--version=4.6.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.5.2 \
--version=4.6.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.5.2 couchdb/couchdb
$ helm upgrade my-release --version=4.6.0 couchdb/couchdb
```

## Configuration
Expand Down Expand Up @@ -239,6 +239,10 @@ A variety of other parameters are also configurable. See the comments in the
| `prometheusPort.enabled` | false |
| `prometheusPort.port` | 17896 |
| `prometheusPort.bind_address` | 0.0.0.0 |
| `lifecycle` | {} |
| `lifecycleTemplate` | false (set `true` and add a named `lifecycleTemplate` if using couchdb as a subchart) |
| `extraEnv` | [] |
| `extraEnvTemplate` | false (set `true` and add a named `extraEnvTemplate` if using couchdb as a subchart) |
| `placementConfig.enabled` | false |
| `placementConfig.image.repository` | caligrafix/couchdb-autoscaler-placement-manager |
| `placementConfig.image.tag` | 0.1.0 |
Expand Down
14 changes: 14 additions & 0 deletions couchdb/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ spec:
{{- if .Values.prometheusPort.enabled }}
- name: metrics
containerPort: {{ .Values.prometheusPort.port }}
{{- end }}
{{- if .Values.lifecycle }}
lifecycle: {{ toYaml .Values.lifecycle | nindent 12 }}
{{- else if .Values.lifecycleTemplate }}
lifecycle:
{{- include "couchdb.lifecycleTemplate" . | nindent 12 }}
{{- end }}
env:
{{- if not .Values.allowAdminParty }}
Expand All @@ -123,6 +129,11 @@ spec:
key: erlangCookie
- name: ERL_FLAGS
value: "{{ range $k, $v := .Values.erlangFlags }} -{{ $k }} {{ $v }} {{ end }}"
{{- if .Values.extraEnv }}
{{ toYaml .Values.extraEnv | indent 12 }}
{{- else if .Values.extraEnvTemplate }}
{{- include "couchdb.extraEnvTemplate" . | indent 12 }}
{{- end }}
{{- if .Values.livenessProbe.enabled }}
livenessProbe:
{{- if .Values.couchdbConfig.chttpd.require_valid_user }}
Expand Down Expand Up @@ -204,6 +215,9 @@ spec:
{{- with .Values.topologySpreadConstraints }}
topologySpreadConstraints:
{{ toYaml . | indent 8 }}
{{- end }}
{{- with .Values.priorityClassName }}
priorityClassName: {{ . | quote }}
{{- end }}
volumes:
- name: config-storage
Expand Down
14 changes: 14 additions & 0 deletions couchdb/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,17 @@ prometheusPort:
bind_address: "0.0.0.0"
port: 17986

# Optional lifecycle hooks defined by a lifecyle value map or parent template
# (for e.g. more complex use cases requiring variable interpolation by parent
# charts)
lifecycle: {}
lifecycleTemplate: false

# Optional environment variables defined by a values array or parent template
# (for e.g. passing secrets as environment variables or for use in the statefulset)
extraEnv: []
extraEnvTemplate: false

# Configure arbitrary sidecar containers for CouchDB pods created by the
# StatefulSet
sidecars: {}
Expand All @@ -281,3 +292,6 @@ placementConfig:
image:
repository: caligrafix/couchdb-autoscaler-placement-manager
tag: 0.1.0

# Optional priority class to be used for CouchDB pods
priorityClassName: ""