stackdeploy

package
v0.0.5-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: 10 Imported by: 0

Documentation

Overview

Package stackdeploy converts a draft stack (user-authored state from the DB) into an effective stack: connections, self outputs, and volume relationships resolved into the concrete values the cluster CR builder consumes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloneStack

func CloneStack(stack *models.Stack) (*models.Stack, error)

CloneStack deep-copies a stack via JSON so the resolver never mutates the caller's draft.

func PostgresConnectionConfig

func PostgresConnectionConfig(connection models.StackConnection) (database string, superuser bool, err error)

func PostgresCredentialSecretName

func PostgresCredentialSecretName(addonID, database string) string

PostgresCredentialSecretName returns the deterministic K8s Secret name for projected postgres credentials in a stack's namespace. The format is pgcred-<8-char-hash>-<sanitized-database>.

func ResolveTemplate

func ResolveTemplate(tmplStr string, data map[string]string) (string, error)

ResolveTemplate executes a Go text/template string against the provided data. Template keys are registered as zero-arg functions so {{ key }} syntax works without a dot prefix. Keys must be valid Go identifiers (letters, digits, underscores; cannot start with a digit).

func ValidateTemplateKeys

func ValidateTemplateKeys(tmplStr string, values map[string]models.OutputValueRef) error

ValidateTemplateKeys checks that all keys in the values map are valid Go identifiers and that the template string parses successfully.

Types

type DependencyNotReadyError

type DependencyNotReadyError struct {
	Message string
}

DependencyNotReadyError signals that a backing resource is not available yet and resolution should be retried.

func (DependencyNotReadyError) Error

func (e DependencyNotReadyError) Error() string

type PostgresAddonService

type PostgresAddonService interface {
	InternalGetPostgresAddon(ctx context.Context, id string) (*models.PostgresAddon, *errors.ServiceError)
	InternalGetCredentials(ctx context.Context, addonID string, database string, superuser bool) (*models.PostgresCredentials, *errors.ServiceError)
}

type Resolver

type Resolver struct {
	// contains filtered or unexported fields
}

func NewResolver

func NewResolver(spec ResolverSpec) *Resolver

func (*Resolver) Resolve

func (r *Resolver) Resolve(ctx context.Context, stack *models.Stack) (*models.Stack, error)

Resolve returns an effective copy of the stack with volume connections, self outputs, and env connections resolved. The input stack is not mutated.

type ResolverSpec

type ResolverSpec struct {
	VolumeService        VolumeService
	PostgresAddonService PostgresAddonService
	SecretService        SecretService
}

type SecretService

type SecretService interface {
	InternalGetByID(ctx context.Context, id string) (*models.Secret, *errors.ServiceError)
}

type VolumeService

type VolumeService interface {
	ListVolumesUsedByStack(ctx context.Context, stackID string) ([]*models.Volume, *errors.ServiceError)
}

Jump to

Keyboard shortcuts

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