2026-04-30 18:05:24 -04:00
|
|
|
package cnpg
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"danicos.dev/daniel/go-kube/pkg/kube"
|
2026-04-30 18:18:09 -04:00
|
|
|
"danicos.dev/daniel/homelab/pkg/immich"
|
2026-04-30 18:05:24 -04:00
|
|
|
"danicos.dev/daniel/homelab/pkg/root"
|
|
|
|
|
|
|
|
|
|
kube_cnpg "danicos.dev/daniel/go-kube/pkg/cnpg"
|
|
|
|
|
pg "github.com/cloudnative-pg/api/pkg/api/v1"
|
|
|
|
|
core "k8s.io/api/core/v1"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func Cluster() pg.Cluster {
|
|
|
|
|
meta := kube.NewMetadata(root.CloudNativePG+"-cluster", PGClusterNamespace)
|
|
|
|
|
spec := pg.ClusterSpec{
|
|
|
|
|
Instances: 3,
|
|
|
|
|
StorageConfiguration: pg.StorageConfiguration{
|
|
|
|
|
StorageClass: new(root.KUBE_LOCAL_STORAGE_CLASS),
|
|
|
|
|
Size: "10Gi",
|
|
|
|
|
ResizeInUseVolumes: new(true),
|
|
|
|
|
PersistentVolumeClaimTemplate: &core.PersistentVolumeClaimSpec{
|
|
|
|
|
StorageClassName: new(root.KUBE_LOCAL_STORAGE_CLASS),
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
Managed: &pg.ManagedConfiguration{
|
2026-04-30 18:18:09 -04:00
|
|
|
Roles: []pg.RoleConfiguration{
|
|
|
|
|
{
|
2026-04-30 18:33:33 -04:00
|
|
|
Name: root.Immich.Name,
|
|
|
|
|
Login: true,
|
2026-04-30 18:18:09 -04:00
|
|
|
PasswordSecret: &pg.LocalObjectReference{
|
|
|
|
|
Name: immich.Secret.Name,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
2026-04-30 18:05:24 -04:00
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
return kube_cnpg.NewCluster(meta, spec)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
2026-04-30 18:48:24 -04:00
|
|
|
PG expects username, password
|
|
|
|
|
|
|
|
|
|
PG Secret
|
2026-04-30 18:05:24 -04:00
|
|
|
*/
|