diff --git a/apps/matrix-postgresql/cluster/cluster.yaml b/apps/matrix-postgresql/cluster/cluster.yaml new file mode 100644 index 0000000..6021791 --- /dev/null +++ b/apps/matrix-postgresql/cluster/cluster.yaml @@ -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 diff --git a/apps/matrix-postgresql/cluster/kustomization.yaml b/apps/matrix-postgresql/cluster/kustomization.yaml new file mode 100644 index 0000000..993fbde --- /dev/null +++ b/apps/matrix-postgresql/cluster/kustomization.yaml @@ -0,0 +1,4 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - cluster.yaml diff --git a/apps/matrix-postgresql/service/kustomization.yaml b/apps/matrix-postgresql/service/kustomization.yaml new file mode 100644 index 0000000..9bb4d07 --- /dev/null +++ b/apps/matrix-postgresql/service/kustomization.yaml @@ -0,0 +1,4 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - service.yaml diff --git a/apps/matrix-postgresql/service/service.yaml b/apps/matrix-postgresql/service/service.yaml new file mode 100644 index 0000000..72620af --- /dev/null +++ b/apps/matrix-postgresql/service/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 diff --git a/bootstrap/kustomization.yaml b/bootstrap/kustomization.yaml index b7cfe65..87cec6d 100644 --- a/bootstrap/kustomization.yaml +++ b/bootstrap/kustomization.yaml @@ -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 diff --git a/bootstrap/matrix-cnpg.yaml b/bootstrap/matrix-cnpg.yaml new file mode 100644 index 0000000..ff8ff98 --- /dev/null +++ b/bootstrap/matrix-cnpg.yaml @@ -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 diff --git a/bootstrap/matrix-postgresql.yaml b/bootstrap/matrix-postgresql.yaml new file mode 100644 index 0000000..73bf910 --- /dev/null +++ b/bootstrap/matrix-postgresql.yaml @@ -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 diff --git a/bootstrap/matrix-project.yaml b/bootstrap/matrix-project.yaml new file mode 100644 index 0000000..12ab7bb --- /dev/null +++ b/bootstrap/matrix-project.yaml @@ -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