Documentation
¶
Overview ¶
Package setup provides helpers for cluster creation and setup workflows. It contains component installers, CNI setup, and registry stage handling that are used by the cluster create command.
Index ¶
- Variables
- func EnsureArgoCDResources(ctx context.Context, kubeconfig string, clusterCfg *v1alpha1.Cluster, ...) error
- func HelmClientForCluster(clusterCfg *v1alpha1.Cluster) (*helm.Client, string, error)
- func InstallArgoCDSilent(ctx context.Context, clusterCfg *v1alpha1.Cluster, ...) error
- func InstallCNI(cmd *cobra.Command, clusterCfg *v1alpha1.Cluster, tmr timer.Timer) (bool, error)
- func InstallCSISilent(ctx context.Context, clusterCfg *v1alpha1.Cluster, ...) error
- func InstallCertManagerSilent(ctx context.Context, clusterCfg *v1alpha1.Cluster, ...) error
- func InstallFluxSilent(ctx context.Context, clusterCfg *v1alpha1.Cluster, ...) error
- func InstallKubeletCSRApproverSilent(ctx context.Context, clusterCfg *v1alpha1.Cluster, ...) error
- func InstallMetricsServerSilent(ctx context.Context, clusterCfg *v1alpha1.Cluster, ...) error
- func InstallPolicyEngineSilent(ctx context.Context, clusterCfg *v1alpha1.Cluster, ...) error
- func InstallPostCNIComponents(cmd *cobra.Command, clusterCfg *v1alpha1.Cluster, ...) error
- func NeedsMetricsServerInstall(clusterCfg *v1alpha1.Cluster) bool
- func RunDockerStage(cmd *cobra.Command, tmr timer.Timer, info StageInfo, ...) error
- type ComponentRequirements
- type DockerClientInvoker
- type InstallerFactories
- type StageInfo
Constants ¶
This section is empty.
Variables ¶
var ( ErrCertManagerInstallerFactoryNil = errors.New("cert-manager installer factory is nil") ErrArgoCDInstallerFactoryNil = errors.New("argocd installer factory is nil") ErrKubeletCSRApproverInstallerFactoryNil = errors.New( "kubelet-csr-approver installer factory is nil", ) ErrClusterConfigNil = errors.New("cluster config is nil") )
Errors for component installation.
var ErrCSIInstallerFactoryNil = errors.New("CSI installer factory is nil")
ErrCSIInstallerFactoryNil is returned when the CSI installer factory is nil.
var ErrPolicyEngineDisabled = errors.New("policy engine is disabled")
ErrPolicyEngineDisabled is returned when the policy engine is disabled.
var ErrPolicyEngineInstallerFactoryNil = errors.New("policy engine installer factory is nil")
ErrPolicyEngineInstallerFactoryNil is returned when the policy engine installer factory is nil.
var ErrUnsupportedCNI = errors.New("unsupported CNI type")
ErrUnsupportedCNI is returned when an unsupported CNI type is encountered.
Functions ¶
func EnsureArgoCDResources ¶
func EnsureArgoCDResources( ctx context.Context, kubeconfig string, clusterCfg *v1alpha1.Cluster, clusterName string, ) error
EnsureArgoCDResources configures default Argo CD resources post-install.
func HelmClientForCluster ¶
HelmClientForCluster creates a Helm client configured for the cluster.
func InstallArgoCDSilent ¶
func InstallArgoCDSilent( ctx context.Context, clusterCfg *v1alpha1.Cluster, factories *InstallerFactories, ) error
InstallArgoCDSilent installs ArgoCD silently for parallel execution.
func InstallCNI ¶
InstallCNI installs the configured CNI for the cluster. Returns true if a CNI was installed, false if using default/none.
func InstallCSISilent ¶
func InstallCSISilent( ctx context.Context, clusterCfg *v1alpha1.Cluster, factories *InstallerFactories, ) error
InstallCSISilent installs CSI silently for parallel execution.
func InstallCertManagerSilent ¶
func InstallCertManagerSilent( ctx context.Context, clusterCfg *v1alpha1.Cluster, factories *InstallerFactories, ) error
InstallCertManagerSilent installs cert-manager silently for parallel execution.
func InstallFluxSilent ¶
func InstallFluxSilent( ctx context.Context, clusterCfg *v1alpha1.Cluster, factories *InstallerFactories, ) error
InstallFluxSilent installs Flux silently for parallel execution.
func InstallKubeletCSRApproverSilent ¶ added in v5.17.0
func InstallKubeletCSRApproverSilent( ctx context.Context, clusterCfg *v1alpha1.Cluster, factories *InstallerFactories, ) error
InstallKubeletCSRApproverSilent installs kubelet-csr-approver silently for parallel execution. kubelet-csr-approver is required when metrics-server is installed with secure TLS enabled, as it automatically approves kubelet serving certificate CSRs.
func InstallMetricsServerSilent ¶
func InstallMetricsServerSilent( ctx context.Context, clusterCfg *v1alpha1.Cluster, factories *InstallerFactories, ) error
InstallMetricsServerSilent installs metrics-server silently for parallel execution.
func InstallPolicyEngineSilent ¶ added in v5.17.0
func InstallPolicyEngineSilent( ctx context.Context, clusterCfg *v1alpha1.Cluster, factories *InstallerFactories, ) error
InstallPolicyEngineSilent installs the policy engine silently for parallel execution.
func InstallPostCNIComponents ¶
func InstallPostCNIComponents( cmd *cobra.Command, clusterCfg *v1alpha1.Cluster, factories *InstallerFactories, tmr timer.Timer, ) error
InstallPostCNIComponents installs all post-CNI components in parallel. This includes metrics-server, CSI, cert-manager, and GitOps engines (Flux/ArgoCD).
func NeedsMetricsServerInstall ¶
NeedsMetricsServerInstall determines if metrics-server needs to be installed. Returns true only when MetricsServer is Enabled AND the distribution doesn't provide it by default. When MetricsServer is Default, we don't install (rely on distribution's default behavior).
func RunDockerStage ¶
func RunDockerStage( cmd *cobra.Command, tmr timer.Timer, info StageInfo, action func(context.Context, client.APIClient) error, dockerInvoker DockerClientInvoker, ) error
RunDockerStage executes a Docker-based stage with standard progress messaging. This provides a consistent pattern for all Docker operations that need to: 1. Track timing via Timer.NewStage() 2. Show a title message with emoji 3. Show an activity message (optional) 4. Execute a Docker action 5. Show success/failure messages
Parameters:
- cmd: The Cobra command for output context
- tmr: Timer for stage timing
- info: Stage display information
- action: The Docker action to execute
- dockerInvoker: Function to create/invoke Docker client (use nil for default)
Types ¶
type ComponentRequirements ¶ added in v5.17.0
type ComponentRequirements struct {
NeedsMetricsServer bool
NeedsKubeletCSRApprover bool
NeedsCSI bool
NeedsCertManager bool
NeedsPolicyEngine bool
NeedsArgoCD bool
NeedsFlux bool
}
ComponentRequirements represents which components need to be installed.
func GetComponentRequirements ¶ added in v5.17.0
func GetComponentRequirements(clusterCfg *v1alpha1.Cluster) ComponentRequirements
GetComponentRequirements determines which components need to be installed based on cluster config.
func (ComponentRequirements) Count ¶ added in v5.17.0
func (r ComponentRequirements) Count() int
Count returns the number of components that need to be installed.
type DockerClientInvoker ¶
DockerClientInvoker is a function that invokes an operation with a Docker client.
func DefaultDockerClientInvoker ¶
func DefaultDockerClientInvoker() DockerClientInvoker
DefaultDockerClientInvoker returns the default Docker client invoker.
type InstallerFactories ¶
type InstallerFactories struct {
Flux func(client helm.Interface, timeout time.Duration) installer.Installer
CertManager func(clusterCfg *v1alpha1.Cluster) (installer.Installer, error)
CSI func(clusterCfg *v1alpha1.Cluster) (installer.Installer, error)
PolicyEngine func(clusterCfg *v1alpha1.Cluster) (installer.Installer, error)
ArgoCD func(clusterCfg *v1alpha1.Cluster) (installer.Installer, error)
KubeletCSRApprover func(clusterCfg *v1alpha1.Cluster) (installer.Installer, error)
// EnsureArgoCDResources configures default Argo CD resources post-install.
EnsureArgoCDResources func(
ctx context.Context, kubeconfig string, clusterCfg *v1alpha1.Cluster, clusterName string,
) error
// EnsureFluxResources enforces default Flux resources post-install.
EnsureFluxResources func(
ctx context.Context, kubeconfig string, clusterCfg *v1alpha1.Cluster, clusterName string,
) error
// HelmClientFactory creates a Helm client for the cluster.
HelmClientFactory func(clusterCfg *v1alpha1.Cluster) (*helm.Client, string, error)
}
InstallerFactories holds factory functions for creating component installers. These can be overridden in tests for dependency injection.
func DefaultInstallerFactories ¶
func DefaultInstallerFactories() *InstallerFactories
DefaultInstallerFactories returns the default installer factories.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package localregistry provides local registry lifecycle operations for cluster commands.
|
Package localregistry provides local registry lifecycle operations for cluster commands. |
|
Package mirrorregistry provides mirror registry setup and connection stages for cluster creation.
|
Package mirrorregistry provides mirror registry setup and connection stages for cluster creation. |