Documentation
¶
Overview ¶
Package localregistry provides local registry lifecycle operations for cluster commands. It handles provisioning, connecting, and cleaning up local Docker registries.
Index ¶
- Variables
- func Cleanup(cmd *cobra.Command, cfgManager *ksailconfigmanager.ConfigManager, ...) error
- func CleanupStageInfo() setup.StageInfo
- func ConnectStageInfo() setup.StageInfo
- func ExecuteStage(cmd *cobra.Command, ctx *Context, deps lifecycle.Deps, stage StageType, ...) error
- func ProvisionStageInfo() setup.StageInfo
- func WaitForK3dLocalRegistryReady(cmd *cobra.Command, clusterCfg *v1alpha1.Cluster, ...) error
- type Context
- type Dependencies
- type Option
- type StageType
Constants ¶
This section is empty.
Variables ¶
var ( ErrNilRegistryContext = errors.New("registry stage context is nil") ErrUnsupportedStage = errors.New("unsupported local registry stage") )
Errors for local registry operations.
Functions ¶
func Cleanup ¶
func Cleanup( cmd *cobra.Command, cfgManager *ksailconfigmanager.ConfigManager, clusterCfg *v1alpha1.Cluster, deps lifecycle.Deps, deleteVolumes bool, localDeps Dependencies, ) error
Cleanup cleans up the local registry during cluster deletion. This function checks if the local registry container exists and removes it if present, regardless of the config setting. This ensures orphaned containers are cleaned up even when the config file is missing or has default values.
func CleanupStageInfo ¶
CleanupStageInfo returns the stage info for cleanup.
func ConnectStageInfo ¶
ConnectStageInfo returns the stage info for connecting.
func ExecuteStage ¶
func ExecuteStage( cmd *cobra.Command, ctx *Context, deps lifecycle.Deps, stage StageType, firstActivityShown *bool, localDeps Dependencies, ) error
ExecuteStage executes the specified local registry stage.
func ProvisionStageInfo ¶
ProvisionStageInfo returns the stage info for provisioning.
func WaitForK3dLocalRegistryReady ¶
func WaitForK3dLocalRegistryReady( cmd *cobra.Command, clusterCfg *v1alpha1.Cluster, k3dConfig *k3dv1alpha5.SimpleConfig, dockerInvoker func(*cobra.Command, func(client.APIClient) error) error, ) error
WaitForK3dLocalRegistryReady waits for the K3d-managed local registry to be ready. This should be called after K3d cluster creation when local registry is enabled, to ensure the registry is accepting connections before installing Flux or other components that depend on it.
For K3d, the local registry is created during cluster creation via Registries.Create, so we need to wait for it to be ready after the cluster is created. For Kind and Talos, this is a no-op since they use KSail-managed registries which are created and waited for before cluster creation.
Types ¶
type Context ¶
type Context struct {
ClusterCfg *v1alpha1.Cluster
KindConfig *kindv1alpha4.Cluster
K3dConfig *k3dv1alpha5.SimpleConfig
TalosConfig *talosconfigmanager.Configs
}
Context holds cluster configuration for local registry operations.
func NewContextFromConfigManager ¶
func NewContextFromConfigManager(cfgManager *ksailconfigmanager.ConfigManager) *Context
NewContextFromConfigManager creates a Context from a config manager.
type Dependencies ¶
type Dependencies struct {
ServiceFactory func(cfg registry.Config) (registry.Service, error)
DockerInvoker func(*cobra.Command, func(client.APIClient) error) error
}
Dependencies holds injectable dependencies for local registry operations.
func DefaultDependencies ¶
func DefaultDependencies() Dependencies
DefaultDependencies returns the default production dependencies.
func NewDependencies ¶
func NewDependencies(opts ...Option) Dependencies
NewDependencies creates dependencies with optional overrides.
type Option ¶
type Option func(*Dependencies)
Option configures local registry dependencies.
func WithDockerInvoker ¶
WithDockerInvoker sets a custom Docker client invoker.