Documentation
¶
Overview ¶
Package shared provides reusable helpers for command wiring.
This package contains shared utilities for command construction including configuration loading and kubeconfig path resolution.
Index ¶
- Variables
- func GetDefaultKubeconfigPath() string
- func GetKubeconfigPathSilently() string
- func HandleLifecycleRunE(cmd *cobra.Command, cfgManager *ksailconfigmanager.ConfigManager, ...) error
- func LoadConfig(cfgManager *ksailconfigmanager.ConfigManager, deps ConfigLoadDeps) error
- func NewConfigLoaderRunE(runtimeContainer *runtime.Runtime) func(*cobra.Command, []string) error
- func NewLifecycleCommandWrapper(runtimeContainer *runtime.Runtime, ...) func(*cobra.Command, []string) error
- func WrapLifecycleHandler(runtimeContainer *runtime.Runtime, ...) func(*cobra.Command, []string) error
- type ConfigLoadDeps
- type LifecycleAction
- type LifecycleConfig
- type LifecycleDeps
Constants ¶
This section is empty.
Variables ¶
var ErrMissingClusterProvisionerDependency = errors.New("missing cluster provisioner dependency")
ErrMissingClusterProvisionerDependency is returned when the cluster provisioner is nil.
Functions ¶
func GetDefaultKubeconfigPath ¶ added in v1.12.0
func GetDefaultKubeconfigPath() string
GetDefaultKubeconfigPath returns the default kubeconfig path.
func GetKubeconfigPathSilently ¶ added in v1.12.0
func GetKubeconfigPathSilently() string
GetKubeconfigPathSilently tries to load config and get kubeconfig path without any output.
func HandleLifecycleRunE ¶
func HandleLifecycleRunE( cmd *cobra.Command, cfgManager *ksailconfigmanager.ConfigManager, deps LifecycleDeps, config LifecycleConfig, ) error
HandleLifecycleRunE executes a cluster lifecycle workflow.
func LoadConfig ¶
func LoadConfig( cfgManager *ksailconfigmanager.ConfigManager, deps ConfigLoadDeps, ) error
LoadConfig loads the KSail configuration using the provided dependencies.
func NewConfigLoaderRunE ¶
NewConfigLoaderRunE creates a cobra RunE function that loads the KSail configuration.
func NewLifecycleCommandWrapper ¶
func NewLifecycleCommandWrapper( runtimeContainer *runtime.Runtime, cfgManager *ksailconfigmanager.ConfigManager, config LifecycleConfig, ) func(*cobra.Command, []string) error
NewLifecycleCommandWrapper creates a command wrapper for lifecycle operations.
func WrapLifecycleHandler ¶ added in v1.12.3
func WrapLifecycleHandler( runtimeContainer *runtime.Runtime, cfgManager *ksailconfigmanager.ConfigManager, handler func(*cobra.Command, *ksailconfigmanager.ConfigManager, LifecycleDeps) error, ) func(*cobra.Command, []string) error
WrapLifecycleHandler resolves lifecycle dependencies and delegates to a provided handler.
Types ¶
type ConfigLoadDeps ¶
ConfigLoadDeps provides dependencies required for simple config-loading commands.
type LifecycleAction ¶
type LifecycleAction func( ctx context.Context, provisioner clusterprovisioner.ClusterProvisioner, clusterName string, ) error
LifecycleAction defines a function that performs an action on a cluster provisioner.
type LifecycleConfig ¶
type LifecycleConfig struct {
TitleEmoji string
TitleContent string
ActivityContent string
SuccessContent string
ErrorMessagePrefix string
Action LifecycleAction
}
LifecycleConfig contains the configuration for a lifecycle operation.
type LifecycleDeps ¶
type LifecycleDeps struct {
Timer timer.Timer
Factory clusterprovisioner.Factory
}
LifecycleDeps contains the dependencies required to handle lifecycle commands.