Skip to content

Commit 88880a4

Browse files
committed
Enable CouchDB configuration through ConfigMap
1 parent a4aacd2 commit 88880a4

File tree

4 files changed

+35
-2
lines changed

4 files changed

+35
-2
lines changed

incubator/couchdb/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ CouchDB chart and their default values:
5555
| Parameter | Description | Default |
5656
|---------------------------------|-------------------------------------------------------|----------------------------------------|
5757
| `clusterSize` | The initial number of nodes in the CouchDB cluster | 3 |
58+
| `couchdbConfig` | Map allowing override elements of server .ini config | {} |
5859
| `erlangFlags` | Map of flags supplied to the underlying Erlang VM | name: couchdb, setcookie: monster
5960
| `persistentVolume.enabled` | Boolean determining whether to attach a PV to each node | false
6061
| `persistentVolume.size` | If enabled, the size of the persistent volume to attach | 10Gi
@@ -84,5 +85,4 @@ A variety of other parameters are also configurable. See the comments in the
8485

8586
## TODO
8687

87-
* Enable CouchDB ini file injection via ConfigMaps
8888
* Configure administrator account credentials using Secrets
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: {{ template "couchdb.fullname" . }}
5+
labels:
6+
app: {{ template "couchdb.name" . }}
7+
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
8+
heritage: {{ .Release.Service | quote }}
9+
release: {{ .Release.Name | quote }}
10+
data:
11+
inifile: |
12+
{{ range $section, $settings := .Values.couchdbConfig -}}
13+
{{ printf "[%s]" $section }}
14+
{{ range $key, $value := $settings -}}
15+
{{ printf "%s = %s" $key ($value | toString) }}
16+
{{ end }}
17+
{{ end }}

incubator/couchdb/templates/statefulset.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,23 @@ spec:
4747
volumeMounts:
4848
- name: database-storage
4949
mountPath: /var/lib/couchdb
50+
- name: config
51+
mountPath: /opt/couchdb/etc/default.d
5052
- name: couchdb-statefulset-assembler
5153
image: "{{ .Values.helperImage.repository }}:{{ .Values.helperImage.tag }}"
5254
imagePullPolicy: {{ .Values.helperImage.pullPolicy }}
5355
{{- if .Values.nodeSelector }}
5456
nodeSelector:
5557
{{ toYaml .Values.nodeSelector | indent 8 }}
5658
{{- end }}
57-
{{- if not .Values.persistentVolume.enabled }}
5859
volumes:
60+
- name: config
61+
configMap:
62+
name: {{ template "couchdb.fullname" . }}
63+
items:
64+
- key: inifile
65+
path: chart.ini
66+
{{- if not .Values.persistentVolume.enabled }}
5967
- name: database-storage
6068
emptyDir: {}
6169
{{- else }}

incubator/couchdb/values.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,11 @@ resources: {}
7373
erlangFlags:
7474
name: couchdb
7575
setcookie: monster
76+
77+
## couchdbConfig will override default CouchDB configuration settings.
78+
## The contents of this map are reformatted into a .ini file laid down
79+
## by a ConfigMap object.
80+
## ref: http://docs.couchdb.org/en/latest/config/index.html
81+
couchdbConfig:
82+
# cluster:
83+
# q: 8 # Create 8 shards for each database

0 commit comments

Comments
 (0)