add CloudNativePG operator and HA postgres cluster
This commit is contained in:
parent
cc75fa6dbc
commit
2a5ddda96c
6 changed files with 116 additions and 0 deletions
20
apps/cnpg-operator.yaml
Normal file
20
apps/cnpg-operator.yaml
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
apiVersion: argoproj.io/v1alpha1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: cnpg-operator
|
||||
namespace: argocd
|
||||
spec:
|
||||
project: default
|
||||
source:
|
||||
repoURL: https://cloudnative-pg.github.io/charts
|
||||
chart: cloudnative-pg
|
||||
targetRevision: 0.28.0
|
||||
destination:
|
||||
server: https://kubernetes.default.svc
|
||||
namespace: cnpg-system
|
||||
syncPolicy:
|
||||
automated:
|
||||
prune: true
|
||||
selfHeal: true
|
||||
syncOptions:
|
||||
- CreateNamespace=true
|
||||
20
apps/postgres.yaml
Normal file
20
apps/postgres.yaml
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
apiVersion: argoproj.io/v1alpha1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: postgres
|
||||
namespace: argocd
|
||||
spec:
|
||||
project: default
|
||||
source:
|
||||
repoURL: ssh://git@git.czsk.it/asxpi/k8s-asxpio-gitops.git
|
||||
targetRevision: main
|
||||
path: apps/postgres
|
||||
destination:
|
||||
server: https://kubernetes.default.svc
|
||||
namespace: postgres
|
||||
syncPolicy:
|
||||
automated:
|
||||
prune: true
|
||||
selfHeal: true
|
||||
syncOptions:
|
||||
- CreateNamespace=true
|
||||
23
apps/postgres/cluster.yaml
Normal file
23
apps/postgres/cluster.yaml
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
apiVersion: postgresql.cnpg.io/v1
|
||||
kind: Cluster
|
||||
metadata:
|
||||
name: postgres-cluster
|
||||
namespace: postgres
|
||||
spec:
|
||||
instances: 2
|
||||
primaryUpdateStrategy: unsupervised
|
||||
|
||||
enableSuperuserAccess: true
|
||||
|
||||
postgresql:
|
||||
parameters:
|
||||
shared_buffers: "256MB"
|
||||
max_connections: "200"
|
||||
|
||||
storage:
|
||||
size: 10Gi
|
||||
storageClass: hcloud-volumes
|
||||
|
||||
affinity:
|
||||
enablePodAntiAffinity: true
|
||||
topologyKey: kubernetes.io/hostname
|
||||
10
apps/postgres/db-watchparty.yaml
Normal file
10
apps/postgres/db-watchparty.yaml
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
apiVersion: postgresql.cnpg.io/v1
|
||||
kind: Database
|
||||
metadata:
|
||||
name: watchparty-db
|
||||
namespace: postgres
|
||||
spec:
|
||||
name: watchparty
|
||||
owner: app
|
||||
cluster:
|
||||
name: postgres-cluster
|
||||
|
|
@ -24,6 +24,13 @@ spec:
|
|||
value: "8080"
|
||||
- name: HOST
|
||||
value: "0.0.0.0"
|
||||
- name: PG_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: postgres-cluster-app
|
||||
key: password
|
||||
- name: DATABASE_URL
|
||||
value: postgresql://app:$(PG_PASSWORD)@postgres-cluster-rw.postgres.svc.cluster.local:5432/watchparty
|
||||
resources:
|
||||
requests:
|
||||
memory: 256Mi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue