From 49135bab66d08db0f86db2614677a80930e73290 Mon Sep 17 00:00:00 2001 From: Daniel Cosme Date: Tue, 5 May 2026 15:18:02 -0400 Subject: [PATCH] Ensure immich db absent --- infrastructure/hydra/postgres/immich-db.yaml | 15 +++++++++++++++ infrastructure/hydra/postgres/kustomization.yaml | 1 + pkg/postgres/postgres.go | 7 ++++--- 3 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 infrastructure/hydra/postgres/immich-db.yaml diff --git a/infrastructure/hydra/postgres/immich-db.yaml b/infrastructure/hydra/postgres/immich-db.yaml new file mode 100644 index 0000000..f7a8d2c --- /dev/null +++ b/infrastructure/hydra/postgres/immich-db.yaml @@ -0,0 +1,15 @@ +apiVersion: postgresql.cnpg.io/v1 +kind: Database +metadata: + name: immich-db + namespace: cnpg-cluster +spec: + cluster: + name: cnpg-cluster + ensure: absent + extensions: + - ensure: present + name: vector + name: immich + owner: immich +status: {} diff --git a/infrastructure/hydra/postgres/kustomization.yaml b/infrastructure/hydra/postgres/kustomization.yaml index 60d391a..63ec40e 100644 --- a/infrastructure/hydra/postgres/kustomization.yaml +++ b/infrastructure/hydra/postgres/kustomization.yaml @@ -5,4 +5,5 @@ metadata: namespace: cnpg-cluster resources: - cluster-namespace.yaml +- immich-db.yaml - pg-cluster.yaml diff --git a/pkg/postgres/postgres.go b/pkg/postgres/postgres.go index a63eddf..1160a7a 100644 --- a/pkg/postgres/postgres.go +++ b/pkg/postgres/postgres.go @@ -18,7 +18,7 @@ func Stack() stack.Stack { map[string]any{ "cluster-namespace": root.PGClusterNamespace, "pg-cluster": Cluster(), - // "immich-db": ImmichDatabase(), + "immich-db": ImmichDatabase(), }, ) return kz.Stack("postgres") @@ -66,8 +66,9 @@ var ImmichPGSecret = kube_cnpg.NewPGSecret(root.Immich.Name, root.PGClusterNames func ImmichDatabase() pg.Database { meta := kube.NewMetadata(root.Immich.Name+"-db", root.PGClusterNamespace) spec := pg.DatabaseSpec{ - Name: root.Immich.Name, - Owner: root.Immich.Name, + Ensure: pg.EnsureAbsent, + Name: root.Immich.Name, + Owner: root.Immich.Name, ClusterRef: core.LocalObjectReference{ Name: cluster_meta.Meta().Name, },