From 76227bcc5114d2362333f5cd7059e136846cf29d Mon Sep 17 00:00:00 2001 From: Daniel Cosme Date: Tue, 5 May 2026 14:10:38 -0400 Subject: [PATCH] Add pgvector --- .../hydra/postgres/image-cataglog.yaml | 9 ---- infrastructure/hydra/postgres/immich-db.yaml | 3 ++ .../hydra/postgres/kustomization.yaml | 1 - pkg/postgres/postgres.go | 45 +++---------------- 4 files changed, 9 insertions(+), 49 deletions(-) delete mode 100644 infrastructure/hydra/postgres/image-cataglog.yaml diff --git a/infrastructure/hydra/postgres/image-cataglog.yaml b/infrastructure/hydra/postgres/image-cataglog.yaml deleted file mode 100644 index 1ed3cf9..0000000 --- a/infrastructure/hydra/postgres/image-cataglog.yaml +++ /dev/null @@ -1,9 +0,0 @@ -apiVersion: postgresql.cnpg.io/v1 -kind: ImageCatalog -metadata: - name: pg-minimal-trixie - namespace: cnpg-cluster -spec: - images: - - image: ghcr.io/cloudnative-pg/postgresql:18.3-minimal-trixie - major: 18 diff --git a/infrastructure/hydra/postgres/immich-db.yaml b/infrastructure/hydra/postgres/immich-db.yaml index 7b5a048..cedca8a 100644 --- a/infrastructure/hydra/postgres/immich-db.yaml +++ b/infrastructure/hydra/postgres/immich-db.yaml @@ -6,6 +6,9 @@ metadata: spec: cluster: name: cnpg-cluster + extensions: + - ensure: present + name: pgvector name: immich owner: immich status: {} diff --git a/infrastructure/hydra/postgres/kustomization.yaml b/infrastructure/hydra/postgres/kustomization.yaml index 53590a0..63ec40e 100644 --- a/infrastructure/hydra/postgres/kustomization.yaml +++ b/infrastructure/hydra/postgres/kustomization.yaml @@ -5,6 +5,5 @@ metadata: namespace: cnpg-cluster resources: - cluster-namespace.yaml -- image-cataglog.yaml - immich-db.yaml - pg-cluster.yaml diff --git a/pkg/postgres/postgres.go b/pkg/postgres/postgres.go index 0cf6e1d..308df2f 100644 --- a/pkg/postgres/postgres.go +++ b/pkg/postgres/postgres.go @@ -8,15 +8,9 @@ import ( kube_cnpg "danicos.dev/daniel/go-kube/pkg/cnpg" pg "github.com/cloudnative-pg/api/pkg/api/v1" core "k8s.io/api/core/v1" - meta "k8s.io/apimachinery/pkg/apis/meta/v1" ) var cluster_meta = kube.NewMetadata(root.CloudNativePG+"-cluster", root.PGClusterNamespace) -var image_catalog pg.ImageCatalog - -func init() { - image_catalog = ImageCatalog() -} func Stack() stack.Stack { kz := kube.NewKuztomizedStack( @@ -25,7 +19,6 @@ func Stack() stack.Stack { "cluster-namespace": root.PGClusterNamespace, "pg-cluster": Cluster(), "immich-db": ImmichDatabase(), - "image-cataglog": image_catalog, }, ) return kz.Stack("postgres") @@ -68,32 +61,6 @@ func Cluster() pg.Cluster { return kube_cnpg.NewCluster(cluster_meta, spec) } -func ImageCatalog() pg.ImageCatalog { - return pg.ImageCatalog{ - TypeMeta: meta.TypeMeta{ - Kind: "ImageCatalog", - APIVersion: "postgresql.cnpg.io/v1", - }, - ObjectMeta: kube.ObjectMeta(root.PG_VERSION_NAME, root.PGClusterNamespace.Name), - Spec: pg.ImageCatalogSpec{ - Images: []pg.CatalogImage{ - { - Major: root.PG_VERSION_18, - Image: root.PG_VERSION_18_IMAGE, - // Extensions: []pg.ExtensionConfiguration{ - // { - // Name: "pgvector", - // ImageVolumeSource: core.ImageVolumeSource{ - // Reference: "ghcr.io/cloudnative-pg/pgvector:0.8.2-18-trixie", - // }, - // }, - // }, - }, - }, - }, - } -} - var ImmichPGSecret = kube_cnpg.NewPGSecret(root.Immich.Name, root.PGClusterNamespace) func ImmichDatabase() pg.Database { @@ -105,12 +72,12 @@ func ImmichDatabase() pg.Database { Name: cluster_meta.Meta().Name, }, Extensions: []pg.ExtensionSpec{ - // { - // DatabaseObjectSpec: pg.DatabaseObjectSpec{ - // Name: "pgvector", - // Ensure: pg.EnsurePresent, - // }, - // }, + { + DatabaseObjectSpec: pg.DatabaseObjectSpec{ + Name: "pgvector", + Ensure: pg.EnsurePresent, + }, + }, // { // DatabaseObjectSpec: pg.DatabaseObjectSpec{ // Name: "cube",