-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automatically finalize the cluster with a post-install job (#108)
Create a job after the installation to finalize the cluster. The job can also create default databases such as _global_changes.
- Loading branch information
1 parent
53d334c
commit 7b52f9f
Showing
7 changed files
with
87 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{{- if .Values.autoSetup -}} | ||
{{- if and .Values.autoSetup.enabled .Values.service.enabled -}} | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: "{{ .Release.Name }}-post-install" | ||
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: | ||
"helm.sh/hook": post-install | ||
spec: | ||
template: | ||
metadata: | ||
name: "{{ .Release.Name }}-post-install" | ||
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: cluster-setup | ||
image: {{ .Values.autoSetup.image.repository }}:{{ .Values.autoSetup.image.tag }} | ||
imagePullPolicy: {{ .Values.autoSetup.image.pullPolicy }} | ||
command: | ||
- 'sh' | ||
- '-c' | ||
- 'curl -s http://$COUCHDB_ADDRESS/_cluster_setup -X POST -H "Content-Type: application/json" -d "{\"action\": \"finish_cluster\"}" -u $COUCHDB_ADMIN:$COUCHDB_PASS && export IFS=","; for db_name in $DEFAULT_DBS; do curl -X PUT http://$COUCHDB_ADDRESS/$db_name -u $COUCHDB_ADMIN:$COUCHDB_PASS; done' | ||
env: | ||
- name: DEFAULT_DBS | ||
value: {{ join "," .Values.autoSetup.defaultDatabases }} | ||
- name: COUCHDB_ADDRESS | ||
value: "{{ template "couchdb.svcname" . }}.{{ .Release.Namespace }}.svc.cluster.local:{{ .Values.service.externalPort}}" | ||
- name: COUCHDB_ADMIN | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ template "couchdb.fullname" . }} | ||
key: adminUsername | ||
- name: COUCHDB_PASS | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ template "couchdb.fullname" . }} | ||
key: adminPassword | ||
backoffLimit: 2 | ||
ttlSecondsAfterFinished: 600 | ||
{{- end -}} | ||
{{- end -}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters