Documentation
¶
Overview ¶
Package create provides helpers for cluster creation 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 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 InstallMetricsServerSilent(ctx context.Context, clusterCfg *v1alpha1.Cluster, ...) error
- func NeedsMetricsServerInstall(clusterCfg *v1alpha1.Cluster) bool
- type InstallerFactories
- type TestFactories
- type TestOverrides
- func (t *TestOverrides) GetArgoCD() func(*v1alpha1.Cluster) (installer.Installer, error)
- func (t *TestOverrides) GetCSI() func(*v1alpha1.Cluster) (installer.Installer, error)
- func (t *TestOverrides) GetCertManager() func(*v1alpha1.Cluster) (installer.Installer, error)
- func (t *TestOverrides) GetClusterProvisionerFactory() clusterprovisioner.Factory
- func (t *TestOverrides) GetDockerClientInvoker() func(*cobra.Command, func(client.APIClient) error) error
- func (t *TestOverrides) GetEnsureArgoCDResources() func(context.Context, string, *v1alpha1.Cluster) error
- func (t *TestOverrides) SetArgoCD(factory func(*v1alpha1.Cluster) (installer.Installer, error)) func()
- func (t *TestOverrides) SetCSI(factory func(*v1alpha1.Cluster) (installer.Installer, error)) func()
- func (t *TestOverrides) SetCertManager(factory func(*v1alpha1.Cluster) (installer.Installer, error)) func()
- func (t *TestOverrides) SetClusterProvisionerFactory(factory clusterprovisioner.Factory) func()
- func (t *TestOverrides) SetDockerClientInvoker(invoker func(*cobra.Command, func(client.APIClient) error) error) func()
- func (t *TestOverrides) SetEnsureArgoCDResources(fn func(context.Context, string, *v1alpha1.Cluster) error) func()
Constants ¶
This section is empty.
Variables ¶
var ( ErrCertManagerInstallerFactoryNil = errors.New("cert-manager installer factory is nil") ErrArgoCDInstallerFactoryNil = errors.New("argocd 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 GlobalTestOverrides = NewTestOverrides()
GlobalTestOverrides provides a global test override instance. This is used for backward compatibility with existing tests.
Functions ¶
func EnsureArgoCDResources ¶
func EnsureArgoCDResources( ctx context.Context, kubeconfig string, clusterCfg *v1alpha1.Cluster, ) 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 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 InstallMetricsServerSilent ¶
func InstallMetricsServerSilent( ctx context.Context, clusterCfg *v1alpha1.Cluster, factories *InstallerFactories, ) error
InstallMetricsServerSilent installs metrics-server silently for parallel execution.
func NeedsMetricsServerInstall ¶
NeedsMetricsServerInstall determines if metrics-server needs to be installed.
Types ¶
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)
ArgoCD 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) error
// EnsureFluxResources enforces default Flux resources post-install.
EnsureFluxResources func(ctx context.Context, kubeconfig string, clusterCfg *v1alpha1.Cluster) 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.
type TestFactories ¶
type TestFactories struct {
// CertManager overrides the cert-manager installer factory.
CertManager func(*v1alpha1.Cluster) (installer.Installer, error)
// CSI overrides the CSI installer factory.
CSI func(*v1alpha1.Cluster) (installer.Installer, error)
// ArgoCD overrides the ArgoCD installer factory.
ArgoCD func(*v1alpha1.Cluster) (installer.Installer, error)
// EnsureArgoCDResources overrides the ArgoCD resource ensure function.
EnsureArgoCDResources func(context.Context, string, *v1alpha1.Cluster) error
// DockerClientInvoker overrides the Docker client invoker.
DockerClientInvoker func(*cobra.Command, func(client.APIClient) error) error
// ClusterProvisionerFactory overrides the cluster provisioner factory.
ClusterProvisionerFactory clusterprovisioner.Factory
}
TestFactories holds factory function overrides for testing. These allow tests to inject mock implementations without global state.
type TestOverrides ¶
type TestOverrides struct {
// contains filtered or unexported fields
}
TestOverrides provides thread-safe access to test factory overrides. Use SetForTests methods to override specific factories in tests.
func NewTestOverrides ¶
func NewTestOverrides() *TestOverrides
NewTestOverrides creates a new TestOverrides instance.
func (*TestOverrides) GetCertManager ¶
GetCertManager returns the cert-manager installer factory override.
func (*TestOverrides) GetClusterProvisionerFactory ¶
func (t *TestOverrides) GetClusterProvisionerFactory() clusterprovisioner.Factory
GetClusterProvisionerFactory returns the cluster provisioner factory override.
func (*TestOverrides) GetDockerClientInvoker ¶
func (t *TestOverrides) GetDockerClientInvoker() func(*cobra.Command, func(client.APIClient) error) error
GetDockerClientInvoker returns the Docker client invoker override.
func (*TestOverrides) GetEnsureArgoCDResources ¶
func (t *TestOverrides) GetEnsureArgoCDResources() func(context.Context, string, *v1alpha1.Cluster) error
GetEnsureArgoCDResources returns the ArgoCD resource ensure function override.
func (*TestOverrides) SetArgoCD ¶
func (t *TestOverrides) SetArgoCD( factory func(*v1alpha1.Cluster) (installer.Installer, error), ) func()
SetArgoCD sets the ArgoCD installer factory for tests. Returns a restore function that resets the factory to its previous value.
func (*TestOverrides) SetCSI ¶
func (t *TestOverrides) SetCSI( factory func(*v1alpha1.Cluster) (installer.Installer, error), ) func()
SetCSI sets the CSI installer factory for tests. Returns a restore function that resets the factory to its previous value.
func (*TestOverrides) SetCertManager ¶
func (t *TestOverrides) SetCertManager( factory func(*v1alpha1.Cluster) (installer.Installer, error), ) func()
SetCertManager sets the cert-manager installer factory for tests. Returns a restore function that resets the factory to its previous value.
func (*TestOverrides) SetClusterProvisionerFactory ¶
func (t *TestOverrides) SetClusterProvisionerFactory(factory clusterprovisioner.Factory) func()
SetClusterProvisionerFactory sets the cluster provisioner factory for tests. Returns a restore function that resets the factory to nil.
func (*TestOverrides) SetDockerClientInvoker ¶
func (t *TestOverrides) SetDockerClientInvoker( invoker func(*cobra.Command, func(client.APIClient) error) error, ) func()
SetDockerClientInvoker sets the Docker client invoker for tests. Returns a restore function that resets the invoker to its previous value.
func (*TestOverrides) SetEnsureArgoCDResources ¶
func (t *TestOverrides) SetEnsureArgoCDResources( fn func(context.Context, string, *v1alpha1.Cluster) error, ) func()
SetEnsureArgoCDResources sets the ArgoCD resource ensure function for tests. Returns a restore function that resets the function to its previous value.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package registrystage provides registry setup and connection stages for cluster creation.
|
Package registrystage provides registry setup and connection stages for cluster creation. |