Provision Matrix PostgreSQL with CloudNativePG

This commit is contained in:
feedc0de committed 2026-10-25 13:18:49 +01:00
1 parent 6b70792559
commit 026daf1753
8 files changed
+105

No files matched your search

@@ -0,0 +1,20 @@
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: matrix-cnpg
namespace: matrix
spec:
instances: 1
enableSuperuserAccess: true
imageName: ghcr.io/cloudnative-pg/postgresql:18.6-standard-trixie
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/hostname
operator: In
values: [odroid-h3-00]
storage:
size: 200Gi
storageClass: rook-ceph-block
@@ -0,0 +1,4 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- cluster.yaml
@@ -0,0 +1,4 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- service.yaml
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: postgresql
namespace: matrix
spec:
type: ClusterIP
ports:
- name: postgresql
port: 5432
protocol: TCP
targetPort: 5432
selector:
cnpg.io/cluster: matrix-cnpg
cnpg.io/instanceRole: primary
+3
View File
@@ -86,6 +86,9 @@ resources:
- prometheus.yaml
- matrix-alertmanager-receiver-project.yaml
- matrix-alertmanager-receiver.yaml
- matrix-project.yaml
- matrix-cnpg.yaml
- matrix-postgresql.yaml
- visual-studio-code.yaml
- wiki-js.yaml
- wiki-js-postgresql.yaml
+21
View File
@@ -0,0 +1,21 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: matrix-cnpg
namespace: argocd
annotations:
argocd.argoproj.io/sync-wave: "0"
spec:
project: matrix
source:
repoURL: https://code.brunner.ninja/feedc0de/homelab-gitops.git
targetRevision: main
path: apps/matrix-postgresql/cluster
destination:
server: https://kubernetes.default.svc
namespace: matrix
syncPolicy:
automated:
enabled: true
prune: true
selfHeal: true
+19
View File
@@ -0,0 +1,19 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: matrix-postgresql
namespace: argocd
spec:
project: matrix
source:
repoURL: https://code.brunner.ninja/feedc0de/homelab-gitops.git
targetRevision: main
path: apps/matrix-postgresql/service
destination:
server: https://kubernetes.default.svc
namespace: matrix
syncPolicy:
automated:
enabled: true
prune: true
selfHeal: true
+19
View File
@@ -0,0 +1,19 @@
apiVersion: argoproj.io/v1alpha1
kind: AppProject
metadata:
name: matrix
namespace: argocd
annotations:
argocd.argoproj.io/sync-wave: "-1"
spec:
description: Matrix PostgreSQL cluster and stable in-namespace service
sourceRepos:
- https://code.brunner.ninja/feedc0de/homelab-gitops.git
destinations:
- namespace: matrix
server: https://kubernetes.default.svc
namespaceResourceWhitelist:
- group: ""
kind: Service
- group: postgresql.cnpg.io
kind: Cluster