forked from helm/charts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[stable/stolon] external secret, auto cluster spec update, pdb (helm#…
…9739) * add support for external stolon secret Signed-off-by: Taehyun Kim <[email protected]> * fix version Signed-off-by: Taehyun Kim <[email protected]> * fix rbac Signed-off-by: Taehyun Kim <[email protected]> * fix Chart.yaml Signed-off-by: Taehyun Kim <[email protected]> * add pdb Signed-off-by: Taehyun Kim <[email protected]> * update README.md Signed-off-by: Taehyun Kim <[email protected]> * auto update cluster spec Signed-off-by: Taehyun Kim <[email protected]> * disable pdb by default Signed-off-by: Taehyun Kim <[email protected]> * add failKeeper hook Signed-off-by: Taehyun Kim <[email protected]> * add sentinel pod checksum annotation Signed-off-by: Taehyun Kim <[email protected]> * remove podDisruptionBudget.enabled Signed-off-by: Taehyun Kim <[email protected]>
- Loading branch information
1 parent
13341ab
commit e26b7ee
Showing
14 changed files
with
266 additions
and
21 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
Stolon cluster installed and initialized. | ||
|
||
To get superuser password run | ||
{{ if not (empty .Values.superuserSecret.name) }} | ||
PGPASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ .Values.superuserSecret.name }} -o jsonpath="{.data.{{.Values.superuserSecret.passwordKey}}}" | base64 --decode; echo) | ||
{{ else }} | ||
PGPASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "stolon.fullname" . }} -o jsonpath="{.data.pg_su_password}" | base64 --decode; echo) | ||
{{ 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ template "stolon.fullname" . }} | ||
labels: | ||
app: {{ template "stolon.name" . }} | ||
chart: {{ template "stolon.chart" . }} | ||
release: {{ .Release.Name }} | ||
heritage: {{ .Release.Service }} | ||
data: | ||
{{- if .Values.keeper.hooks.failKeeper.enabled }} | ||
pre-stop-hook.sh: |- | ||
#!/bin/bash | ||
exec &> >(tee -a "/var/log/stolon-hooks.log") | ||
NODE_NAME=${HOSTNAME} | ||
IFS='-' read -ra ADDR <<< "$(hostname)" | ||
STKEEPER_UID="keeper${ADDR[-1]}" | ||
echo "keeper [${STKEEPER_UID}] is failing" | ||
stolonctl \ | ||
--cluster-name={{ template "stolon.fullname" . }} \ | ||
--store-backend={{ .Values.store.backend }} \ | ||
{{- if eq .Values.store.backend "kubernetes" }} | ||
--kube-resource-kind={{ .Values.store.kubeResourceKind }} \ | ||
{{- else }} | ||
--store-endpoints={{ .Values.store.endpoints }} \ | ||
{{- end }} | ||
failkeeper ${STKEEPER_UID} || true | ||
echo "Node ${NODE_NAME} is ready to shutdown" | ||
{{- 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
47 changes: 47 additions & 0 deletions
47
stable/stolon/templates/hooks/update-cluster-spec-job.yaml
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,47 @@ | ||
{{ if .Values.job.autoUpdateClusterSpec }} | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: {{ template "stolon.fullname" . }}-update-cluster-spec | ||
labels: | ||
app: {{ template "stolon.name" . }} | ||
chart: {{ template "stolon.chart" . }} | ||
release: {{ .Release.Name }} | ||
heritage: {{ .Release.Service }} | ||
annotations: | ||
"helm.sh/hook": post-upgrade | ||
"helm.sh/hook-delete-policy": before-hook-creation | ||
spec: | ||
template: | ||
metadata: | ||
labels: | ||
app: {{ template "stolon.fullname" . }} | ||
release: {{ .Release.Name }} | ||
spec: | ||
restartPolicy: OnFailure | ||
serviceAccountName: {{ template "stolon.serviceAccountName" . }} | ||
{{- if eq .Values.store.backend "etcdv2" "etcdv3" }} | ||
initContainers: | ||
- name: {{ .Chart.Name }}-etcd-wait | ||
image: "{{ .Values.etcdImage.repository }}:{{ .Values.etcdImage.tag }}" | ||
imagePullPolicy: {{ .Values.etcdImage.pullPolicy }} | ||
command: ["sh", "-c", "while ! etcdctl --endpoints {{ .Values.store.endpoints }} cluster-health; do sleep 1 && echo -n .; done"] | ||
{{- end }} | ||
containers: | ||
- name: {{ template "stolon.fullname" . }}-update-cluster-spec | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
command: ["/usr/local/bin/stolonctl"] | ||
args: | ||
- update | ||
- --cluster-name={{ template "stolon.fullname" . }} | ||
- --store-backend={{ .Values.store.backend }} | ||
{{- if eq .Values.store.backend "kubernetes" }} | ||
- --kube-resource-kind={{ .Values.store.kubeResourceKind }} | ||
{{- else }} | ||
- --store-endpoints={{ .Values.store.endpoints }} | ||
{{- end }} | ||
- -p | ||
- '{ {{- range $key, $value := .Values.clusterSpec }} {{ $key | quote }}: {{ if typeIs "string" $value }} {{ $value | quote }} {{ else }} {{ $value }} {{ end }}, {{- end }} "pgParameters": {{ toJson .Values.pgParameters }} }' | ||
{{ 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{{- if .Values.keeper.podDisruptionBudget }} | ||
apiVersion: policy/v1beta1 | ||
kind: PodDisruptionBudget | ||
metadata: | ||
name: {{ template "stolon.fullname" . }}-keeper | ||
labels: | ||
app: {{ template "stolon.name" . }} | ||
chart: {{ template "stolon.chart" . }} | ||
release: {{ .Release.Name }} | ||
heritage: {{ .Release.Service }} | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: {{ template "stolon.name" . }} | ||
release: {{ .Release.Name }} | ||
component: stolon-keeper | ||
{{ toYaml .Values.keeper.podDisruptionBudget | indent 2 }} | ||
{{- end }} |
Oops, something went wrong.