shared

package
v1.12.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

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

Constants

This section is empty.

Variables

View Source
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

func NewConfigLoaderRunE(runtimeContainer *runtime.Runtime) func(*cobra.Command, []string) error

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

type ConfigLoadDeps struct {
	Timer timer.Timer
}

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.

Jump to

Keyboard shortcuts

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