-
Notifications
You must be signed in to change notification settings - Fork 342
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
533 additions
and
3 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
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 @@ | ||
apiVersion: v1 | ||
appVersion: "1.0" | ||
description: Postdock chart for kubernetes | ||
name: PostDock | ||
version: 1.2.0 | ||
maintainers: | ||
- name: Dmitry Paunin | ||
email: [email protected] | ||
home: https://github.com/paunin/PostDock | ||
sources: | ||
- https://github.com/paunin/PostDock | ||
icon: https://raw.githubusercontent.com/paunin/PostDock/master/artwork/logo.png | ||
keywords: | ||
- database | ||
- postgres | ||
- postgresql | ||
- postdock | ||
- cluster |
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,4 @@ | ||
approvers: | ||
- paunin | ||
reviewers: | ||
- paunin |
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,24 @@ | ||
# PostDock Helm Chart | ||
|
||
Includes Postgres, Pgpool, Barman components | ||
## Install the chart | ||
|
||
```console | ||
$ helm install [--name my-release] <path to chart> | ||
``` | ||
|
||
## Upgrade the chart | ||
|
||
```console | ||
$ helm upgrade my-release <path to chart> | ||
``` | ||
|
||
## Uninstalling the Chart | ||
|
||
```console | ||
$ helm delete my-release | ||
``` | ||
|
||
## Customization | ||
|
||
Please see [values.yaml](./values.yaml) file to understand what each of variables means in order to customize it for your needs |
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,13 @@ | ||
May the force be with you in this release of {{ .Chart.Name }}={{ .Release.Name }} | ||
|
||
Your database will be accessible through pgpool k8s service: | ||
* Host - {{ .Values.postDock.name }}-pgpool | ||
* Port - 5432 | ||
* User - {{ .Values.postgres.db.user }} | ||
* Database - {{ .Values.postgres.db.name }} | ||
|
||
To read: | ||
* Useful commands - https://github.com/paunin/PostDock#useful-commands | ||
* Recovery of cluster from backups - https://github.com/paunin/PostDock/blob/master/doc/RECOVERY.md | ||
* Documentation - https://github.com/paunin/PostDock | ||
* Issues tracker - https://github.com/paunin/PostDock/issues |
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,15 @@ | ||
{{ if .Values.barman.backupSchedule }} | ||
kind: PersistentVolumeClaim | ||
apiVersion: v1 | ||
metadata: | ||
name: barman-data-{{ .Values.postDock.name }}-barman-node-0 | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: {{ .Values.barman.volume.size }} | ||
selector: | ||
matchLabels: | ||
system: {{ .Values.postDock.name }}-barman | ||
{{ 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,68 @@ | ||
{{ if .Values.barman.backupSchedule }} | ||
apiVersion: apps/v1beta1 | ||
kind: StatefulSet | ||
metadata: | ||
name: {{ .Values.postDock.name }}-barman-node | ||
labels: | ||
name: barman | ||
system: {{ .Values.postDock.name }} | ||
app: {{ .Values.postDock.name }} | ||
spec: | ||
updateStrategy: | ||
type: RollingUpdate | ||
replicas: 1 | ||
serviceName: "{{ .Values.postDock.name }}-barman" | ||
template: | ||
metadata: | ||
labels: | ||
name: database | ||
system: {{ .Values.postDock.name }} | ||
spec: | ||
containers: | ||
- name: barman-node | ||
image: {{ .Values.barman.image }}:{{ .Values.barman.tag }} | ||
{{ if .Values.barman.resources }} | ||
resources: | ||
{{ toYaml .Values.barman.resources | indent 12 }} | ||
{{ end }} | ||
env: | ||
{{ if .Values.barman.env }} | ||
{{ toYaml .Values.barman.env | indent 12 }} | ||
{{ end }} | ||
- name: "BACKUP_SCHEDULE" | ||
value: {{ .Values.barman.backupSchedule | quote }} | ||
- name: "POSTGRES_DB" | ||
valueFrom: | ||
configMapKeyRef: | ||
name: {{ .Values.postDock.name }}-config | ||
key: app.db.database | ||
- name: "POSTGRES_USER" | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ .Values.postDock.name }}-secret | ||
key: app.db.user | ||
- name: "POSTGRES_PASSWORD" | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ .Values.postDock.name }}-secret | ||
key: app.db.password | ||
- name: "REPLICATION_USER" | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ .Values.postDock.name }}-secret | ||
key: app.db.cluster.replication.user | ||
- name: "REPLICATION_PASSWORD" | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ .Values.postDock.name }}-secret | ||
key: app.db.cluster.replication.password | ||
# @todo: should be service which always points to master - https://github.com/paunin/PostDock/issues/137 | ||
- name: "REPLICATION_HOST" | ||
value: {{ .Values.postDock.name }}-db-node-0.{{ .Values.postDock.name }}-db | ||
volumeMounts: | ||
- name: barman-data | ||
mountPath: /var/backups | ||
volumeClaimTemplates: | ||
- metadata: | ||
name: barman-data | ||
{{ 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,17 @@ | ||
{{ if .Values.barman.backupSchedule }} | ||
{{ if .Values.barman.volume.definition }} | ||
apiVersion: v1 | ||
kind: PersistentVolume | ||
metadata: | ||
name: barman-data-{{ $.Values.postDock.name }} | ||
labels: | ||
system: {{ $.Values.postDock.name }}-barman | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
capacity: | ||
storage: {{ .Values.barman.volume.size }} | ||
persistentVolumeReclaimPolicy: {{ .Values.barman.volume.recalimPolicy }} | ||
{{ toYaml .Values.barman.volume.definition | indent 2 }} | ||
{{ 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
apiVersion: extensions/v1beta1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ .Values.postDock.name }}-database-pgpool | ||
labels: | ||
name: database-balancer | ||
node: pgpool | ||
system: {{ .Values.postDock.name }} | ||
app: {{ .Values.postDock.name }} | ||
spec: | ||
replicas: {{ .Values.pgpool.replicas }} | ||
revisionHistoryLimit: 5 | ||
template: | ||
metadata: | ||
name: database-pgpool | ||
labels: | ||
name: database-balancer | ||
node: pgpool | ||
system: {{ .Values.postDock.name }} | ||
app: {{ .Values.postDock.name }} | ||
spec: | ||
containers: | ||
- name: database-pgpool | ||
image: {{ .Values.pgpool.image }}:{{ .Values.pgpool.tag }} | ||
livenessProbe: | ||
exec: | ||
command: ['bash', '-c', '/usr/local/bin/pgpool/has_write_node.sh && /usr/local/bin/pgpool/has_enough_backends.sh'] | ||
initialDelaySeconds: 600 | ||
timeoutSeconds: 10 | ||
periodSeconds: 30 | ||
successThreshold: 1 | ||
failureThreshold: 3 | ||
imagePullPolicy: Always | ||
{{ if .Values.pgpool.resources }} | ||
resources: | ||
{{ toYaml .Values.pgpool.resources | indent 10 }} | ||
{{ end }} | ||
ports: | ||
- containerPort: 5432 | ||
env: | ||
{{ if .Values.pgpool.env }} | ||
{{ toYaml .Values.pgpool.env | indent 10 }} | ||
{{ end }} | ||
- name: "PCP_USER" | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ .Values.postDock.name }}-secret | ||
key: app.db.pool.pcp.user | ||
- name: "PCP_PASSWORD" | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ .Values.postDock.name }}-secret | ||
key: app.db.pool.pcp.password | ||
- name: "CHECK_USER" | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ .Values.postDock.name }}-secret | ||
key: app.db.cluster.replication.user | ||
- name: "CHECK_PASSWORD" | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ .Values.postDock.name }}-secret | ||
key: app.db.cluster.replication.password | ||
- name: "DB_USERS" | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ .Values.postDock.name }}-secret | ||
key: app.db.pool.users | ||
- name: "BACKENDS" | ||
valueFrom: | ||
configMapKeyRef: | ||
name: {{ .Values.postDock.name }}-config | ||
key: app.db.pool.backends |
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,16 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ .Values.postDock.name }}-pgpool | ||
labels: | ||
name: database-balancer | ||
node: pgpool | ||
system: {{ .Values.postDock.name }} | ||
spec: | ||
ports: | ||
- port: 5432 | ||
targetPort: 5432 | ||
selector: | ||
name: database-balancer | ||
node: pgpool | ||
system: {{ .Values.postDock.name }} |
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,17 @@ | ||
{{ range $i, $e := .Values.postgres.nodes }} | ||
--- | ||
kind: PersistentVolumeClaim | ||
apiVersion: v1 | ||
metadata: | ||
name: db-data-{{ $.Values.postDock.name }}-db-node-{{ $i }} | ||
spec: | ||
accessModes: | ||
- ReadWriteOnce | ||
resources: | ||
requests: | ||
storage: {{ $e.volume.size }} | ||
selector: | ||
matchLabels: | ||
system: {{ $.Values.postDock.name }}-db | ||
node: node-{{ $i }} | ||
{{ 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,11 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ .Values.postDock.name }}-config | ||
labels: | ||
app: {{ .Values.postDock.name }} | ||
data: | ||
app.db.database: "{{ .Values.postgres.db.name }}" | ||
app.db.cluster.name: "{{ .Values.postgres.clusterName }}" | ||
app.db.cluster.replication.db: "{{ .Values.postgres.replicationDb.name }}" | ||
app.db.pool.backends: "{{ range $i, $e := .Values.postgres.nodes }}{{ if $i }},{{ end }}{{ $i }}:{{ $.Values.postDock.name }}-db-node-{{ $i }}.{{ $.Values.postDock.name }}-db::::{{ 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,13 @@ | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: {{ .Values.postDock.name }}-secret | ||
type: Opaque | ||
data: | ||
app.db.user: {{ .Values.postgres.db.user | b64enc }} | ||
app.db.password: {{ .Values.postgres.db.password | b64enc }} | ||
app.db.cluster.replication.user: {{ .Values.postgres.replicationDb.user | b64enc }} | ||
app.db.cluster.replication.password: {{ .Values.postgres.replicationDb.password | b64enc }} | ||
app.db.pool.users: {{ .Values.pgpool.users | b64enc }} | ||
app.db.pool.pcp.user: {{ .Values.pgpool.pcp.user | b64enc }} | ||
app.db.pool.pcp.password: {{ .Values.pgpool.pcp.password | b64enc }} |
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,16 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ .Values.postDock.name }}-db | ||
labels: | ||
name: database | ||
system: {{ .Values.postDock.name }} | ||
spec: | ||
clusterIP: None | ||
ports: | ||
- port: 5432 | ||
targetPort: 5432 | ||
selector: | ||
name: database | ||
system: {{ .Values.postDock.name }} | ||
|
Oops, something went wrong.