builders

package
v0.0.7-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 13, 2026 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultImageCatalogName is the name of the CNPG ImageCatalog resource
	// that must exist in the target namespace before a PostgresCluster can be created.
	DefaultImageCatalogName = "postgres-catalog"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ClusterResourceBuilder

type ClusterResourceBuilder interface {
	BuildStackCR(stack *models.Stack) (*corev1alpha1.Stack, error)
	GetStackCRHash(stack *models.Stack) (string, error)
	BuildStackResourceCR(stackResource *models.StackResource, stackName, orgID string) (*corev1alpha1.StackResource, error)
	BuildVolumeCR(ctx context.Context, volume *models.Volume) (*storagev1alpha1.Volume, error)
}

type ClusterResourceBuilderSpec

type ClusterResourceBuilderSpec struct {
	// CredentialResolver is optional; when set, org-level registry credentials
	// auto-attach to image pull / push specs.
	CredentialResolver credentials.Resolver
	PlatformBaseDomain string
	ComputeMode        config.ComputeMode
	PlatformTLSEnabled bool
}

type PostgresClusterBuildContext

type PostgresClusterBuildContext struct {
	// BackupObjectStoreName is the resolved name of the barman ObjectStore
	// K8s resource used for backups. Required when BackupConfig.ObjectStoreID is set.
	BackupObjectStoreName string

	// RestoreObjectStoreName is the resolved name of the barman ObjectStore
	// K8s resource used for restore. Required when restoring from object store.
	RestoreObjectStoreName string

	// RecoverySourceClusterName is the name of the PostgresCluster CR that
	// originally archived backups to the object store. Used as the barman-cloud
	// serverName when restoring from object store.
	RecoverySourceClusterName string

	// RestoreBackupName is the resolved CNPG Backup CR name to restore from.
	// Required when restoring from a specific backup.
	RestoreBackupName string
}

PostgresClusterBuildContext provides pre-resolved references needed to build a PostgresCluster CR. The caller is responsible for resolving database IDs to cluster resource names before invoking the builder.

type PostgresClusterBuilder

type PostgresClusterBuilder interface {
	BuildPostgresClusterCR(addon *models.PostgresAddon, buildCtx PostgresClusterBuildContext) (*addonsv1alpha1.PostgresCluster, error)
	// BuildImportPasswordSecret builds the K8s Secret that holds the password for
	// importing from an external database. The returned secret must be created in
	// the cluster before the PostgresCluster CR is applied.
	BuildImportPasswordSecret(addon *models.PostgresAddon, password string) *corev1.Secret
}

func NewPostgresClusterBuilder

func NewPostgresClusterBuilder() PostgresClusterBuilder

type SecretBuilder

type SecretBuilder interface {
	// BuildDockerConfigJsonSecret synthesizes a dockerconfigjson secret from
	// raw credentials — used for org-level registry credentials. ref may be an
	// image or repository reference; insecure derives an http:// auth URL for
	// in-cluster/plain-HTTP registries.
	BuildDockerConfigJsonSecret(ctx context.Context, secretName, username, password, ref string, insecure bool) (*corev1.Secret, error)
	// BuildGitCredentialsSecretFromCredentials synthesizes a git credentials
	// secret from raw credentials — used for org-level git integrations and
	// minted GitHub App tokens that have no backing hub secret.
	BuildGitCredentialsSecretFromCredentials(ctx context.Context, secretName string, creds gitclient.GitCredentials) (*corev1.Secret, error)
}

func NewSecretBuilder

func NewSecretBuilder(spec SecretBuilderSpec) SecretBuilder

type SecretBuilderSpec

type SecretBuilderSpec struct{}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL