mirror of
https://github.com/helm/charts.git
synced 2026-08-22 22:07:36 +00:00
[stable/stolon] Init script support (#15990)
* Add initScript and postStartScript feature Signed-off-by: Fiore Mario Vitale <mvitale86@gmail.com> * Increase chart version Signed-off-by: Fiore Mario Vitale <mvitale86@gmail.com> * Add new line at the end of file Signed-off-by: Fiore Mario Vitale <mvitale86@gmail.com> * Remove trailing whitespace Signed-off-by: Fiore Mario Vitale <mvitale86@gmail.com> * Bump version to 1.2.0 Minor syntax fix Signed-off-by: Fiore Mario Vitale <mvitale86@gmail.com> * Fix minor syntax issues Signed-off-by: Fiore Mario Vitale <mvitale86@gmail.com>
This commit is contained in:
committed by
Kubernetes Prow Robot
parent
c0259368df
commit
19601be66c
@@ -1,6 +1,6 @@
|
||||
apiVersion: v1
|
||||
name: stolon
|
||||
version: 1.1.2
|
||||
version: 1.2.0
|
||||
appVersion: 0.13.0
|
||||
description: Stolon - PostgreSQL cloud native High Availability.
|
||||
home: https://github.com/sorintlab/stolon
|
||||
|
||||
@@ -89,6 +89,8 @@ Kubernetes is the default store backend. `consul`, `etcdv2` or `etcdv3` can also
|
||||
| `sentinel.podDisruptionBudget.enabled` | If true, create a pod disruption budget for sentinel pods. | `false` |
|
||||
| `sentinel.podDisruptionBudget.minAvailable` | Minimum number / percentage of pods that should remain scheduled | `""` |
|
||||
| `sentinel.podDisruptionBudget.maxUnavailable` | Maximum number / percentage of pods that may be made unavailable | `""` |
|
||||
| `initdbScripts` | Dictionary of scripts. Executed after cluster startup | `nil` |
|
||||
| `nodePostStartScript` | Dictionary of scripts. Executed after the node startup | `nil` |
|
||||
|
||||
|
||||
[pgconf]: https://github.com/postgres/postgres/blob/master/src/backend/utils/misc/postgresql.conf.sample
|
||||
|
||||
@@ -30,3 +30,6 @@ data:
|
||||
|
||||
echo "Node ${NODE_NAME} is ready to shutdown"
|
||||
{{- end }}
|
||||
{{- with .Values.nodePostStartScript }}
|
||||
{{ toYaml . | indent 2 }}
|
||||
{{- end }}
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: init-scripts
|
||||
data:
|
||||
{{- with .Values.initdbScripts }}
|
||||
{{ toYaml . | indent 2 }}
|
||||
{{- end }}
|
||||
---
|
||||
{{- if .Values.initdbScripts }}
|
||||
apiVersion: batch/v1
|
||||
kind: Job
|
||||
metadata:
|
||||
name: '{{template "stolon.clusterName" .}}-createdb'
|
||||
labels:
|
||||
heritage: {{.Release.Service | quote }}
|
||||
release: {{.Release.Name | quote }}
|
||||
chart: "{{.Chart.Name}}-{{.Chart.Version}}"
|
||||
annotations:
|
||||
"helm.sh/hook": post-install
|
||||
"helm.sh/hook-weight": "2"
|
||||
"helm.sh/hook-delete-policy": hook-succeeded
|
||||
spec:
|
||||
template:
|
||||
metadata:
|
||||
name: "{{.Release.Name}}"
|
||||
labels:
|
||||
heritage: {{.Release.Service | quote }}
|
||||
release: {{.Release.Name | quote }}
|
||||
chart: "{{.Chart.Name}}-{{.Chart.Version}}"
|
||||
spec:
|
||||
restartPolicy: Never
|
||||
containers:
|
||||
- name: create-database-job
|
||||
image: 'postgres'
|
||||
env:
|
||||
- name: USERNAME
|
||||
value: {{ .Values.superuserUsername }}
|
||||
- name: PGPASSWORD
|
||||
value: {{ .Values.superuserPassword }}
|
||||
- name: HOST
|
||||
value: {{ template "stolon.fullname" . }}-proxy
|
||||
command: ["/bin/bash", "-e", "/tmp/sql-script/create_script.sh"]
|
||||
volumeMounts:
|
||||
- mountPath: "/tmp/sql-script"
|
||||
readOnly: true
|
||||
name: sql-script
|
||||
volumes:
|
||||
- name: sql-script
|
||||
configMap:
|
||||
name: init-scripts
|
||||
defaultMode: 420
|
||||
initContainers:
|
||||
- name: wait-for-database
|
||||
image: jwilder/dockerize
|
||||
command: ['dockerize', '-timeout', '30s', '-wait', 'tcp://{{ template "stolon.fullname" . }}-proxy:5432']
|
||||
{{- end }}
|
||||
@@ -128,11 +128,23 @@ spec:
|
||||
- name: config
|
||||
mountPath: /pre-stop-hook.sh
|
||||
subPath: pre-stop-hook.sh
|
||||
{{- end }}
|
||||
{{- if .Values.nodePostStartScript }}
|
||||
- name: config
|
||||
mountPath: /postStartScript.sh
|
||||
subPath: postStartScript.sh
|
||||
{{- end }}
|
||||
lifecycle:
|
||||
{{- if .Values.keeper.hooks.failKeeper.enabled }}
|
||||
preStop:
|
||||
exec:
|
||||
command: ["/bin/bash", "-e", "/pre-stop-hook.sh"]
|
||||
{{ end }}
|
||||
{{- end }}
|
||||
{{- if .Values.nodePostStartScript }}
|
||||
postStart:
|
||||
exec:
|
||||
command: ["/bin/bash", "-e", "/postStartScript.sh"]
|
||||
{{- end }}
|
||||
{{- with .Values.keeper.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{ toYaml . | indent 8 }}
|
||||
|
||||
@@ -132,3 +132,21 @@ sentinel:
|
||||
podDisruptionBudget:
|
||||
# minAvailable: 1
|
||||
# maxUnavailable: 1
|
||||
|
||||
## initdb scripts
|
||||
## Specify dictionary of scripts to be run at first boot, the entry point script is create_script.sh
|
||||
## i.e. you can use pgsql to run sql script on the cluster.
|
||||
##
|
||||
# initdbScripts:
|
||||
# create_script.sh: |
|
||||
# #!/bin/sh
|
||||
# echo "Do something."
|
||||
|
||||
## nodePostStart scripts
|
||||
## Specify dictionary of scripts to be run at first boot, the entry point script is postStartScript.sh
|
||||
## i.e. you can create tablespace directory here.
|
||||
##
|
||||
# nodePostStartScript:
|
||||
# postStartScript.sh: |
|
||||
# #!/bin/bash
|
||||
# echo "Do something."
|
||||
|
||||
Reference in New Issue
Block a user