Documentation
¶
Overview ¶
Package repository provides interfaces and implementations for managing repository deployments in the Caproni cluster.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotDeployed is returned when an operation requires a deployed repository. ErrNotDeployed = errors.New("repository is not deployed") // ErrAlreadyDeployed is returned when attempting to deploy an already deployed repository. ErrAlreadyDeployed = errors.New("repository is already deployed") // ErrConfigMismatch is returned when the deployed configuration doesn't match the requested configuration. ErrConfigMismatch = errors.New("repository configuration mismatch") // ErrManagerNotFound is returned when the specified repository type is not available. ErrManagerNotFound = errors.New("repository manager not found") // ErrNotReady is returned when the repository is deployed but not ready. ErrNotReady = errors.New("repository is not ready") // ErrEditModeActive is returned when an operation cannot be performed in edit mode. ErrEditModeActive = errors.New("repository is in edit mode") )
Functions ¶
func ListManagers ¶
func ListManagers() []string
ListManagers returns a list of all registered manager types.
func RegisterManager ¶
func RegisterManager(repoType string, factory ManagerFactory)
RegisterManager registers a manager factory function with the given type. This is typically called from a manager package's init() function. Panics if a manager with the same type is already registered.
Types ¶
type Manager ¶
type Manager interface {
// Type returns the repository type that this manager handles (e.g., "helm", "app", "mock").
Type() string
// Deploy deploys the repository to the cluster.
// If the repository is already deployed, this method updates it to match the current configuration.
Deploy(ctx context.Context, repoConfig *v1.RepositoryConfig, caproniConfig *v1.CaproniConfig) error
// Undeploy removes this repository from the cluster.
Undeploy(ctx context.Context, repoConfig *v1.RepositoryConfig, caproniConfig *v1.CaproniConfig) error
// Status returns the current status of the repository deployment.
// Returns an error if unable to determine repository state.
Status(ctx context.Context, repoConfig *v1.RepositoryConfig, caproniConfig *v1.CaproniConfig) (*Status, error)
// Run runs the repository in edit mode, blocking until the context is cancelled.
// For mirror repositories with edit_mode=true:
// - Generates mirrord configuration
// - Launches all edit_mode_processes concurrently with mirrord wrapping
// - Auto-restarts processes that exit unexpectedly
// - Cleans up on shutdown
// For other repository types or edit_mode=false: no-op (returns nil immediately)
//
// Returns an error if:
// - Repository type doesn't support edit mode
// - edit_mode is false
// - Unable to generate mirrord configuration
Run(ctx context.Context, repoConfig *v1.RepositoryConfig, caproniConfig *v1.CaproniConfig) error
}
Manager defines the interface for managing repository lifecycle. Implementations are responsible for deploying, updating, and managing repositories using specific backends (e.g., Helm charts, Kubernetes apps).
func NewManager ¶
NewManager creates a new repository manager for the specified type. Returns ErrManagerNotFound if the type is not registered.
type ManagerFactory ¶
type ManagerFactory func() Manager
ManagerFactory is a function that creates a new repository manager instance.
type State ¶
type State string
State represents the current state of a repository deployment.
const ( // StateNotDeployed indicates the repository is not deployed to the cluster. StateNotDeployed State = "not-deployed" // StateDeploying indicates the repository is being deployed. StateDeploying State = "deploying" // StateDeployed indicates the repository is deployed in standard mode. StateDeployed State = "deployed" // StateEditMode indicates the repository is deployed in edit mode. StateEditMode State = "edit-mode" // StateUpdating indicates the repository is being updated. StateUpdating State = "updating" )