Documentation
¶
Overview ¶
Package deployer provides interfaces and implementations for deploying applications to the Caproni cluster.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrUnknownType is returned when trying to create a deployer with an unknown type. ErrUnknownType = errors.New("unknown deployer type") // ErrDeployFailed is returned when a deployment operation fails. ErrDeployFailed = errors.New("deployment failed") // ErrUndeployFailed is returned when an undeploy operation fails. ErrUndeployFailed = errors.New("undeploy failed") // ErrStatusFailed is returned when unable to determine deployment status. ErrStatusFailed = errors.New("failed to get deployment status") )
Functions ¶
func ListTypes ¶
func ListTypes() []string
ListTypes returns a list of all registered deployer types.
func Register ¶
func Register(deployerType string, factory ManagerFactory)
Register registers a deployer manager factory for a given type. This function is typically called in init() functions of deployer implementations.
Types ¶
type Manager ¶
type Manager interface {
// Type returns the deployer type that this manager handles (e.g., "helm").
Type() string
// Deploy deploys the application to the cluster.
// If the application is already deployed, this method updates it to match the current configuration.
Deploy(ctx context.Context, deployerConfig *v2.DeployerConfig, caproniConfig *v2.CaproniConfig) error
// Undeploy removes this deployment from the cluster.
Undeploy(ctx context.Context, deployerConfig *v2.DeployerConfig, caproniConfig *v2.CaproniConfig) error
// Status returns the current status of the deployment.
// Returns an error if unable to determine deployment state.
Status(ctx context.Context, deployerConfig *v2.DeployerConfig, caproniConfig *v2.CaproniConfig) (*Status, error)
// Validate validates the deployer configuration and referenced files.
// Returns nil if valid, or an error describing validation failures.
// Files in uncloned repository directories should not cause validation to fail.
Validate(deployerConfig *v2.DeployerConfig, caproniConfig *v2.CaproniConfig) error
}
Manager defines the interface for managing deployment lifecycle. Implementations are responsible for deploying and managing applications using specific deployment strategies (e.g., Helm charts).
func NewManager ¶
NewManager creates a new deployer manager for the given type. Returns an error if the type is not registered.
type ManagerFactory ¶
type ManagerFactory func() Manager
ManagerFactory is a function that creates a new deployer manager.
type State ¶
type State string
State represents the current state of a deployment.
const ( // StateNotDeployed indicates the deployer has not been deployed to the cluster. StateNotDeployed State = "not-deployed" // StateDeploying indicates the deployer is being deployed. StateDeploying State = "deploying" // StateDeployed indicates the deployer is deployed to the cluster. StateDeployed State = "deployed" // StateFailed indicates the deployment failed. StateFailed State = "failed" )