Skip to content

Instantly share code, notes, and snippets.

@gerbal
Created February 19, 2019 22:00
Show Gist options
  • Save gerbal/255bc707045ff84bb5b5164256e00503 to your computer and use it in GitHub Desktop.
Save gerbal/255bc707045ff84bb5b5164256e00503 to your computer and use it in GitHub Desktop.
diff --git a/incubator/patroni/Chart.yaml b/incubator/patroni/Chart.yaml
index 42a00726..586c9aab 100644
--- a/incubator/patroni/Chart.yaml
+++ b/incubator/patroni/Chart.yaml
@@ -1,7 +1,7 @@
name: patroni
description: 'Highly available elephant herd: HA PostgreSQL cluster.'
-version: 0.8.1
-appVersion: 1.4-p7
+version: 0.11.0
+appVersion: 1.4-p16
home: https://github.com/zalando/patroni
sources:
- https://github.com/zalando/patroni
diff --git a/incubator/patroni/README.md b/incubator/patroni/README.md
index 309f0432..5025b54b 100644
--- a/incubator/patroni/README.md
+++ b/incubator/patroni/README.md
@@ -14,7 +14,6 @@ This directory contains a Kubernetes chart to deploy a five node [Patroni](https
## Todo
* Make namespace configurable
-* K8S native DCS
## Chart Details
This chart will do the following:
@@ -63,14 +62,16 @@ The following table lists the configurable parameters of the patroni chart and t
| `nameOverride` | Override the name of the chart | `nil` |
| `fullnameOverride` | Override the fullname of the chart | `nil` |
| `replicaCount` | Amount of pods to spawn | `5` |
-| `image.repository` | The image to pull | `registry.opensource.zalan.do/acid/spilo-10` |
-| `image.tag` | The version of the image to pull | `1.4-p6` |
+| `image.repository` | The image to pull | `registry.opensource.zalan.do/acid/spilo-10` |
+| `image.tag` | The version of the image to pull | `1.4-p16` |
| `image.pullPolicy` | The pull policy | `IfNotPresent` |
| `credentials.superuser` | Password of the superuser | `tea` |
| `credentials.admin` | Password of the admin | `cola` |
| `credentials.standby` | Password of the replication user | `pinacolada` |
-| `etcd.enable` | Using etcd as DCS | `true` |
-| `etcd.deployChart` | Deploy etcd chart | `true` |
+| `kubernetes.dcs.enable` | Using Kubernetes as DCS | `true` |
+| `kubernetes.configmaps.enable` | Using Kubernetes configmaps instead of endpoints | `false` |
+| `etcd.enable` | Using etcd as DCS | `false` |
+| `etcd.deployChart` | Deploy etcd chart | `false` |
| `etcd.host` | Host name of etcd cluster | `nil` |
| `etcd.discovery` | Domain name of etcd cluster | `nil` |
| `zookeeper.enable` | Using ZooKeeper as DCS | `false` |
diff --git a/incubator/patroni/requirements.lock b/incubator/patroni/requirements.lock
index 77b5ba2e..bbcd9253 100644
--- a/incubator/patroni/requirements.lock
+++ b/incubator/patroni/requirements.lock
@@ -1,9 +1,9 @@
dependencies:
- name: etcd
repository: https://kubernetes-charts-incubator.storage.googleapis.com/
- version: 0.3.9
+ version: 0.6.2
- name: zookeeper
repository: https://kubernetes-charts-incubator.storage.googleapis.com/
version: 1.0.0
-digest: sha256:2cba87a0a23df25d78a0908f4ce9ae27acb0530a5aac430f19a2dbc0778aa4b2
-generated: 2018-05-14T14:49:09.901956221+02:00
+digest: sha256:b65cce5b82c3c9971b7551e923e03a9253bcb9771386086a4e75992a9682ca03
+generated: 2019-01-26T09:48:28.627975698-06:00
diff --git a/incubator/patroni/requirements.yaml b/incubator/patroni/requirements.yaml
index 4f2db1b5..72555f26 100644
--- a/incubator/patroni/requirements.yaml
+++ b/incubator/patroni/requirements.yaml
@@ -1,6 +1,6 @@
dependencies:
- name: etcd
- version: 0.3.9
+ version: 0.6.2
repository: https://kubernetes-charts-incubator.storage.googleapis.com/
condition: etcd.deployChart
- name: zookeeper
diff --git a/incubator/patroni/templates/role-patroni.yaml b/incubator/patroni/templates/role-patroni.yaml
index 2a289bf1..3341826b 100644
--- a/incubator/patroni/templates/role-patroni.yaml
+++ b/incubator/patroni/templates/role-patroni.yaml
@@ -9,7 +9,35 @@ metadata:
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
rules:
- - apiGroups: [""]
- resources: ["endpoints", "pods"]
- verbs: ["patch"]
+- apiGroups: [""]
+ resources: ["configmaps"]
+ verbs:
+ - create
+ - get
+ - list
+ - patch
+ - update
+ - watch
+ # delete is required only for 'patronictl remove'
+ - delete
+- apiGroups: [""]
+ resources: ["endpoints"]
+ verbs:
+ - create
+ - get
+ - patch
+ - update
+ # the following three privileges are necessary only when using endpoints
+ - list
+ - watch
+ # delete is required only for for 'patronictl remove'
+ - delete
+- apiGroups: [""]
+ resources: ["pods"]
+ verbs:
+ - get
+ - list
+ - patch
+ - update
+ - watch
{{- end }}
diff --git a/incubator/patroni/templates/statefulset-patroni.yaml b/incubator/patroni/templates/statefulset-patroni.yaml
index 136ce68f..76c12910 100644
--- a/incubator/patroni/templates/statefulset-patroni.yaml
+++ b/incubator/patroni/templates/statefulset-patroni.yaml
@@ -42,6 +42,18 @@ spec:
secretKeyRef:
name: {{ template "patroni.fullname" . }}
key: password-standby
+ {{- if .Values.kubernetes.dcs.enable }}
+ - name: DCS_ENABLE_KUBERNETES_API
+ value: "true"
+ - name: KUBERNETES_LABELS
+ value: {{ (printf "{ \"app\": \"%s\", \"release\": \"%s\" }" (include "patroni.name" .) .Release.Name) | quote }}
+ - name: KUBERNETES_SCOPE_LABEL
+ value: "app"
+ {{- end }}
+ {{- if .Values.kubernetes.configmaps.enable }}
+ - name: KUBERNETES_USE_CONFIGMAPS
+ value: "true"
+ {{- end }}
{{- if .Values.etcd.enable }}
{{- if .Values.etcd.deployChart }}
- name: ETCD_DISCOVERY_DOMAIN
@@ -142,21 +154,20 @@ spec:
secretName: {{ .Values.walE.kubernetesSecret }}
{{- end }}
{{- end }}
+ {{- if not .Values.persistentVolume.enabled }}
+ - name: storage-volume
+ emptyDir: {}
+ {{- end }}
+ {{- if .Values.persistentVolume.enabled }}
volumeClaimTemplates:
- metadata:
name: storage-volume
annotations:
- {{- if .Values.persistentVolume.storageClass }}
- volume.beta.kubernetes.io/storage-class: "{{ .Values.persistentVolume.storageClass }}"
- {{- else }}
- volume.alpha.kubernetes.io/storage-class: default
- {{- end }}
{{- if .Values.persistentVolume.annotations }}
{{ toYaml .Values.persistentVolume.annotations | indent 8 }}
{{- end }}
labels:
app: {{ template "patroni.name" . }}
- chart: {{ template "patroni.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
@@ -165,3 +176,11 @@ spec:
resources:
requests:
storage: "{{ .Values.persistentVolume.size }}"
+ {{- if .Values.persistentVolume.storageClass }}
+ {{- if (eq "-" .Values.persistentVolume.storageClass) }}
+ storageClassName: ""
+ {{- else }}
+ storageClassName: "{{ .Values.persistentVolume.storageClass }}"
+ {{- end }}
+ {{- end }}
+ {{- end }}
diff --git a/incubator/patroni/values.yaml b/incubator/patroni/values.yaml
index f4db5938..e6f4f04c 100644
--- a/incubator/patroni/values.yaml
+++ b/incubator/patroni/values.yaml
@@ -4,7 +4,7 @@ image:
# Image was built from
# https://github.com/zalando/spilo/tree/master/postgres-appliance
repository: registry.opensource.zalan.do/acid/spilo-10
- tag: 1.4-p7
+ tag: 1.4-p16
pullPolicy: IfNotPresent
# Credentials used by Patroni
@@ -17,9 +17,14 @@ credentials:
# Distribution Configuration stores
# Please note that only one of the following stores should be enabled.
+kubernetes:
+ dcs:
+ enable: true
+ configmaps:
+ enable: false
etcd:
- enable: true
- deployChart: true
+ enable: false
+ deployChart: false
# If not deploying etcd chart, fill-in value for etcd service
# <service>.<namespace>.svc.cluster.local
host:
@@ -52,8 +57,16 @@ walE:
backupThresholdPercentage: 30
persistentVolume:
+ enabled: true
size: 1G
- storageClass: ""
+ ## database data Persistent Volume Storage Class
+ ## If defined, storageClassName: <storageClass>
+ ## If set to "-", storageClassName: "", which disables dynamic provisioning
+ ## If undefined (the default) or set to null, no storageClassName spec is
+ ## set, choosing the default provisioner. (gp2 on AWS, standard on
+ ## GKE, AWS & OpenStack)
+ ##
+ # storageClass: "-"
subPath: ""
mountPath: "/home/postgres/pgdata"
annotations: {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment