Add ClusterImageCatalog
This commit is contained in:
12
infrastructure/hydra/postgres/image-cataglog.yaml
Normal file
12
infrastructure/hydra/postgres/image-cataglog.yaml
Normal file
@@ -0,0 +1,12 @@
|
||||
apiVersion: postgresql.cnpg.io/v1
|
||||
kind: ClusterImageCatalog
|
||||
metadata:
|
||||
name: pg-minimal-trixie
|
||||
spec:
|
||||
images:
|
||||
- extensions:
|
||||
- image:
|
||||
reference: ghcr.io/cloudnative-pg/pgvector:0.8.2-18-trixie
|
||||
name: pgvector
|
||||
image: ghcr.io/cloudnative-pg/postgresql:18.3-minimal-trixie
|
||||
major: 18
|
||||
@@ -5,5 +5,6 @@ metadata:
|
||||
namespace: cnpg-cluster
|
||||
resources:
|
||||
- cluster-namespace.yaml
|
||||
- image-cataglog.yaml
|
||||
- immich-db.yaml
|
||||
- pg-cluster.yaml
|
||||
|
||||
@@ -5,6 +5,11 @@ metadata:
|
||||
namespace: cnpg-cluster
|
||||
spec:
|
||||
affinity: {}
|
||||
imageCatalogRef:
|
||||
apiGroup: postgresql.cnpg.io/v1
|
||||
kind: ClusterImageCatalog
|
||||
major: 18
|
||||
name: pg-minimal-trixie
|
||||
instances: 3
|
||||
managed:
|
||||
roles:
|
||||
@@ -13,6 +18,9 @@ spec:
|
||||
passwordSecret:
|
||||
name: immich
|
||||
postgresql:
|
||||
extensions:
|
||||
- image: {}
|
||||
name: pgvector
|
||||
syncReplicaElectionConstraint:
|
||||
enabled: false
|
||||
resources: {}
|
||||
|
||||
@@ -8,9 +8,15 @@ 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(
|
||||
@@ -19,6 +25,7 @@ func Stack() stack.Stack {
|
||||
"cluster-namespace": root.PGClusterNamespace,
|
||||
"pg-cluster": Cluster(),
|
||||
"immich-db": ImmichDatabase(),
|
||||
"image-cataglog": image_catalog,
|
||||
},
|
||||
)
|
||||
return kz.Stack("postgres")
|
||||
@@ -35,19 +42,21 @@ func Cluster() pg.Cluster {
|
||||
StorageClassName: new(root.KUBE_LOCAL_STORAGE_CLASS),
|
||||
},
|
||||
},
|
||||
// PostgresConfiguration: pg.PostgresConfiguration{
|
||||
// Extensions: []pg.ExtensionConfiguration{
|
||||
// {
|
||||
// Name: "vector",
|
||||
// ImageVolumeSource: core.ImageVolumeSource{},
|
||||
// ExtensionControlPath: []string{},
|
||||
// DynamicLibraryPath: []string{},
|
||||
// LdLibraryPath: []string{},
|
||||
// BinPath: []string{},
|
||||
// Env: []pg.ExtensionEnvVar{},
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
ImageCatalogRef: &pg.ImageCatalogRef{
|
||||
TypedLocalObjectReference: core.TypedLocalObjectReference{
|
||||
APIGroup: &image_catalog.APIVersion,
|
||||
Kind: image_catalog.Kind,
|
||||
Name: image_catalog.Name,
|
||||
},
|
||||
Major: root.PG_VERSION_18,
|
||||
},
|
||||
PostgresConfiguration: pg.PostgresConfiguration{
|
||||
Extensions: []pg.ExtensionConfiguration{
|
||||
{
|
||||
Name: "pgvector",
|
||||
},
|
||||
},
|
||||
},
|
||||
Managed: &pg.ManagedConfiguration{
|
||||
Roles: []pg.RoleConfiguration{
|
||||
{
|
||||
@@ -63,6 +72,32 @@ func Cluster() pg.Cluster {
|
||||
return kube_cnpg.NewCluster(cluster_meta, spec)
|
||||
}
|
||||
|
||||
func ImageCatalog() pg.ImageCatalog {
|
||||
return pg.ImageCatalog{
|
||||
TypeMeta: meta.TypeMeta{
|
||||
Kind: "ClusterImageCatalog",
|
||||
APIVersion: "postgresql.cnpg.io/v1",
|
||||
},
|
||||
ObjectMeta: kube.ObjectMeta(root.PG_VERSION_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 {
|
||||
@@ -76,7 +111,7 @@ func ImmichDatabase() pg.Database {
|
||||
Extensions: []pg.ExtensionSpec{
|
||||
// {
|
||||
// DatabaseObjectSpec: pg.DatabaseObjectSpec{
|
||||
// Name: "vectors",
|
||||
// Name: "pgvector",
|
||||
// Ensure: pg.EnsurePresent,
|
||||
// },
|
||||
// },
|
||||
|
||||
@@ -38,6 +38,9 @@ const (
|
||||
HELM_CLOUD_NATIVE_PG_URL = "https://cloudnative-pg.github.io/charts"
|
||||
HELM_CLOUD_NATIVE_PG_CHART = "cloudnative-pg"
|
||||
HELM_CLOUD_NATIVE_PG_CHART_VERSION = "0.28.0"
|
||||
PG_VERSION_NAME = "pg-minimal-trixie"
|
||||
PG_VERSION_18 = 18
|
||||
PG_VERSION_18_IMAGE = "ghcr.io/cloudnative-pg/postgresql:18.3-minimal-trixie"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
Reference in New Issue
Block a user