Skip to content

Commit 46ffda3

Browse files
author
Jonathan S. Katz
committed
Various examples for working with PGO
1 parent 12ff4c8 commit 46ffda3

28 files changed

+437
-0
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# [PGO](https://github.com/CrunchyData/postgres-operator), Crunchy [Postgres Operator](https://github.com/CrunchyData/postgres-operator) Examples
2+
3+
This repository contains examples for deploying PGO, the Postgres Operator from Crunchy Data, using a variety of examples.
4+
5+
The examples are grouped by various tools that can be used to deploy them.
6+
7+
The best way to get started is to fork this repository and experiment with the examples.
8+
9+
Each of the examples has its own README that guides you through the process of deploying it.
10+
11+
You can find out more information about [PGO](https://github.com/CrunchyData/postgres-operator), the [Postgres Operator](https://github.com/CrunchyData/postgres-operator) from [Crunchy Data](https://www.crunchydata.com) at the project page:
12+
13+
[https://github.com/CrunchyData/postgres-operator](https://github.com/CrunchyData/postgres-operator)

kustomize/azure/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
azure.conf

kustomize/azure/azure.conf.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[global]
2+
repo1-azure-account=<YOUR_AZURE_ACCOUNT>
3+
repo1-azure-key=<YOUR_AZURE_KEY>

kustomize/azure/kustomization.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
namespace: postgres-operator
2+
3+
secretGenerator:
4+
- name: pgo-azure-creds
5+
files:
6+
- azure.conf
7+
8+
generatorOptions:
9+
disableNameSuffixHash: true
10+
11+
resources:
12+
- postgres.yaml

kustomize/azure/postgres.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
apiVersion: postgres-operator.crunchydata.com/v1beta1
2+
kind: PostgresCluster
3+
metadata:
4+
name: hippo-azure
5+
spec:
6+
image: registry.developers.crunchydata.com/crunchydata/crunchy-postgres-ha:centos8-13.3-4.7.0
7+
postgresVersion: 13
8+
instances:
9+
- volumeClaimSpec:
10+
accessModes:
11+
- "ReadWriteOnce"
12+
resources:
13+
requests:
14+
storage: 1Gi
15+
archive:
16+
pgbackrest:
17+
image: registry.developers.crunchydata.com/crunchydata/crunchy-pgbackrest:centos8-13.3-4.7.0
18+
repoHost:
19+
dedicated: {}
20+
configuration:
21+
- secret:
22+
name: pgo-azure-creds
23+
global:
24+
repo1-path: /pgbackrest/postgres-operator/hippo-azure/repo1
25+
repos:
26+
- name: repo1
27+
azure:
28+
container: "<YOUR_AZURE_CONTAINER>"

kustomize/gcs/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
gcs-key.json

kustomize/gcs/gcs.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[global]
2+
repo1-gcs-key=/etc/pgbackrest/conf.d/gcs-key.json

kustomize/gcs/kustomization.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
namespace: postgres-operator
2+
3+
secretGenerator:
4+
- name: pgo-gcs-creds
5+
files:
6+
- gcs.conf
7+
- gcs-key.json
8+
9+
generatorOptions:
10+
disableNameSuffixHash: true
11+
12+
resources:
13+
- postgres.yaml

kustomize/gcs/postgres.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
apiVersion: postgres-operator.crunchydata.com/v1beta1
2+
kind: PostgresCluster
3+
metadata:
4+
name: hippo-gcs
5+
spec:
6+
image: registry.developers.crunchydata.com/crunchydata/crunchy-postgres-ha:centos8-13.3-4.7.0
7+
postgresVersion: 13
8+
instances:
9+
- volumeClaimSpec:
10+
accessModes:
11+
- "ReadWriteOnce"
12+
resources:
13+
requests:
14+
storage: 1Gi
15+
archive:
16+
pgbackrest:
17+
image: registry.developers.crunchydata.com/crunchydata/crunchy-pgbackrest:centos8-13.3-4.7.0
18+
repoHost:
19+
dedicated: {}
20+
configuration:
21+
- secret:
22+
name: pgo-gcs-creds
23+
global:
24+
repo1-path: /pgbackrest/postgres-operator/hippo-gcs/repo1
25+
repos:
26+
- name: repo1
27+
gcs:
28+
bucket: "<YOUR_GCS_BUCKET_NAME>"
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
apiVersion: postgres-operator.crunchydata.com/v1beta1
2+
kind: PostgresCluster
3+
metadata:
4+
name: hippo-ha
5+
spec:
6+
image: registry.developers.crunchydata.com/crunchydata/crunchy-postgres-ha:centos8-13.3-4.7.0
7+
postgresVersion: 13
8+
instances:
9+
- name: pgha1
10+
replicas: 2
11+
volumeClaimSpec:
12+
accessModes:
13+
- "ReadWriteOnce"
14+
resources:
15+
requests:
16+
storage: 1Gi
17+
affinity:
18+
podAntiAffinity:
19+
preferredDuringSchedulingIgnoredDuringExecution:
20+
- weight: 1
21+
podAffinityTerm:
22+
topologyKey: kubernetes.io/hostname
23+
labelSelector:
24+
matchLabels:
25+
postgres-operator.crunchydata.com/cluster: hippo-ha
26+
postgres-operator.crunchydata.com/instance-set: pgha1
27+
archive:
28+
pgbackrest:
29+
image: registry.developers.crunchydata.com/crunchydata/crunchy-pgbackrest:centos8-13.3-4.7.0
30+
repoHost:
31+
dedicated: {}
32+
repos:
33+
- name: repo1
34+
volume:
35+
volumeClaimSpec:
36+
accessModes:
37+
- "ReadWriteOnce"
38+
resources:
39+
requests:
40+
storage: 1Gi
41+
proxy:
42+
pgBouncer:
43+
image: registry.developers.crunchydata.com/crunchydata/crunchy-pgbouncer:centos8-13.3-4.7.0
44+
replicas: 2
45+
affinity:
46+
podAntiAffinity:
47+
preferredDuringSchedulingIgnoredDuringExecution:
48+
- weight: 1
49+
podAffinityTerm:
50+
topologyKey: kubernetes.io/hostname
51+
labelSelector:
52+
matchLabels:
53+
postgres-operator.crunchydata.com/cluster: hippo-ha
54+
postgres-operator.crunchydata.com/role: pgbouncer
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
namespace: postgres-operator
2+
3+
resources:
4+
- ha-postgres.yaml

kustomize/keycloak/keycloak.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: keycloak
5+
namespace: postgres-operator
6+
labels:
7+
app.kubernetes.io/name: keycloak
8+
spec:
9+
selector:
10+
matchLabels:
11+
app.kubernetes.io/name: keycloak
12+
template:
13+
metadata:
14+
labels:
15+
app.kubernetes.io/name: keycloak
16+
spec:
17+
containers:
18+
- image: quay.io/keycloak/keycloak:latest
19+
name: keycloak
20+
env:
21+
- name: DB_VENDOR
22+
value: "postgres"
23+
- name: DB_ADDR
24+
valueFrom: { secretKeyRef: { name: keycloakdb-pguser, key: host } }
25+
- name: DB_PORT
26+
valueFrom: { secretKeyRef: { name: keycloakdb-pguser, key: port } }
27+
- name: DB_DATABASE
28+
valueFrom: { secretKeyRef: { name: keycloakdb-pguser, key: dbname } }
29+
- name: DB_USER
30+
valueFrom: { secretKeyRef: { name: keycloakdb-pguser, key: user } }
31+
- name: DB_PASSWORD
32+
valueFrom: { secretKeyRef: { name: keycloakdb-pguser, key: password } }
33+
- name: KEYCLOAK_USER
34+
value: "admin"
35+
- name: KEYCLOAK_PASSWORD
36+
value: "admin"
37+
- name: PROXY_ADDRESS_FORWARDING
38+
value: "true"
39+
ports:
40+
- name: http
41+
containerPort: 8080
42+
- name: https
43+
containerPort: 8443
44+
readinessProbe:
45+
httpGet:
46+
path: /auth/realms/master
47+
port: 8080
48+
restartPolicy: Always

kustomize/keycloak/kustomization.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
namespace: postgres-operator
2+
3+
resources:
4+
- postgres.yaml
5+
- keycloak.yaml

kustomize/keycloak/postgres.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
apiVersion: postgres-operator.crunchydata.com/v1beta1
2+
kind: PostgresCluster
3+
metadata:
4+
name: keycloakdb
5+
spec:
6+
image: registry.developers.crunchydata.com/crunchydata/crunchy-postgres-ha:centos8-13.3-4.7.0
7+
postgresVersion: 13
8+
openshift: false
9+
instances:
10+
- replicas: 2
11+
volumeClaimSpec:
12+
accessModes:
13+
- "ReadWriteOnce"
14+
resources:
15+
requests:
16+
storage: 1Gi
17+
affinity:
18+
podAntiAffinity:
19+
preferredDuringSchedulingIgnoredDuringExecution:
20+
- weight: 1
21+
podAffinityTerm:
22+
topologyKey: kubernetes.io/hostname
23+
labelSelector:
24+
matchLabels:
25+
postgres-operator.crunchydata.com/cluster: keycloakdb
26+
postgres-operator.crunchydata.com/instance-set: "00"
27+
archive:
28+
pgbackrest:
29+
image: registry.developers.crunchydata.com/crunchydata/crunchy-pgbackrest:centos8-13.3-4.7.0
30+
repoHost:
31+
dedicated: {}
32+
repos:
33+
- name: repo1
34+
volume:
35+
volumeClaimSpec:
36+
accessModes:
37+
- "ReadWriteOnce"
38+
resources:
39+
requests:
40+
storage: 1Gi
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
azure.conf
2+
gcs-key.json
3+
s3.conf
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[global]
2+
repo4-azure-account=<YOUR_AZURE_ACCOUNT>
3+
repo4-azure-key=<YOUR_AZURE_KEY>

kustomize/multi-backup-repo/gcs.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[global]
2+
repo3-gcs-key=/etc/pgbackrest/conf.d/gcs-key.json
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
namespace: postgres-operator
2+
3+
secretGenerator:
4+
- name: pgo-multi-repo-creds
5+
files:
6+
- azure.conf
7+
- gcs.conf
8+
- gcs-key.json
9+
- s3.conf
10+
11+
generatorOptions:
12+
disableNameSuffixHash: true
13+
14+
resources:
15+
- postgres.yaml
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
apiVersion: postgres-operator.crunchydata.com/v1beta1
2+
kind: PostgresCluster
3+
metadata:
4+
name: hippo-multi-repo
5+
spec:
6+
image: registry.developers.crunchydata.com/crunchydata/crunchy-postgres-ha:centos8-13.3-4.7.0
7+
postgresVersion: 13
8+
instances:
9+
- volumeClaimSpec:
10+
accessModes:
11+
- "ReadWriteOnce"
12+
resources:
13+
requests:
14+
storage: 1Gi
15+
archive:
16+
pgbackrest:
17+
image: registry.developers.crunchydata.com/crunchydata/crunchy-pgbackrest:centos8-13.3-4.7.0
18+
repoHost:
19+
dedicated: {}
20+
configuration:
21+
- secret:
22+
name: pgo-multi-repo-creds
23+
global:
24+
repo2-path: /pgbackrest/postgres-operator/hippo-multi-repo/repo2
25+
repo3-path: /pgbackrest/postgres-operator/hippo-multi-repo/repo3
26+
repo4-path: /pgbackrest/postgres-operator/hippo-multi-repo/repo4
27+
repos:
28+
- name: repo1
29+
volume:
30+
volumeClaimSpec:
31+
accessModes:
32+
- "ReadWriteOnce"
33+
resources:
34+
requests:
35+
storage: 1Gi
36+
- name: repo2
37+
s3:
38+
bucket: "<YOUR_AWS_S3_BUCKET_NAME>"
39+
endpoint: "<YOUR_AWS_S3_ENDPOINT>"
40+
region: "<YOUR_AWS_S3_REGION>"
41+
- name: repo3
42+
gcs:
43+
bucket: "<YOUR_GCS_BUCKET_NAME>"
44+
- name: repo4
45+
azure:
46+
container: "<YOUR_AZURE_CONTAINER>"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[global]
2+
repo2-s3-key=<YOUR_AWS_S3_KEY>
3+
repo2-s3-key-secret=<YOUR_AWS_S3_KEY_SECRET>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
namespace: postgres-operator
2+
3+
resources:
4+
- postgres.yaml

kustomize/openshift/postgres.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
apiVersion: postgres-operator.crunchydata.com/v1beta1
2+
kind: PostgresCluster
3+
metadata:
4+
name: hippo
5+
spec:
6+
image: registry.developers.crunchydata.com/crunchydata/crunchy-postgres-ha:centos8-13.3-4.7.0
7+
postgresVersion: 13
8+
openshift: true
9+
instances:
10+
- name: instance1
11+
volumeClaimSpec:
12+
accessModes:
13+
- "ReadWriteOnce"
14+
resources:
15+
requests:
16+
storage: 1Gi
17+
archive:
18+
pgbackrest:
19+
image: registry.developers.crunchydata.com/crunchydata/crunchy-pgbackrest:centos8-13.3-4.7.0
20+
repoHost:
21+
dedicated: {}
22+
repos:
23+
- name: repo1
24+
volume:
25+
volumeClaimSpec:
26+
accessModes:
27+
- "ReadWriteOnce"
28+
resources:
29+
requests:
30+
storage: 1Gi

kustomize/postgres/kustomization.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
namespace: postgres-operator
2+
3+
resources:
4+
- postgres.yaml

0 commit comments

Comments
 (0)