clustermanager

package
v0.21.3 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2024 License: Apache-2.0 Imports: 42 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// DefaultMaxWaitPerMachine is the default max time the cluster manager will wait per a machine.
	DefaultMaxWaitPerMachine = 10 * time.Minute
	// DefaultClusterWait is the default max time the cluster manager will wait for the capi cluster to be in ready state.
	DefaultClusterWait = 60 * time.Minute
	// DefaultControlPlaneWait is the default time the cluster manager will wait for the control plane to be ready.
	DefaultControlPlaneWait = 60 * time.Minute
	// DefaultControlPlaneWaitAfterMove is the default max time the cluster manager will wait for the control plane to be in ready state after the capi move operation.
	DefaultControlPlaneWaitAfterMove = 15 * time.Minute
	// DefaultDeploymentWait is the default max time the cluster manager will wait for the deployment to be available.
	DefaultDeploymentWait = 30 * time.Minute

	// DefaultEtcdWait is the default time the cluster manager will wait for ectd to be ready.
	DefaultEtcdWait = 60 * time.Minute
	// DefaultUnhealthyMachineTimeout is the default timeout for an unhealthy machine health check.
	DefaultUnhealthyMachineTimeout = 5 * time.Minute
	// DefaultNodeStartupTimeout is the default timeout for a machine without a node to be considered to have failed machine health check.
	DefaultNodeStartupTimeout = 10 * time.Minute
	// DefaultClusterctlMoveTimeout is arbitrarily established.  Equal to kubectl wait default timeouts.
	DefaultClusterctlMoveTimeout = 30 * time.Minute
)

Variables

This section is empty.

Functions

func DefaultRetrier added in v0.13.0

func DefaultRetrier() *retrier.Retrier

DefaultRetrier builds a retrier with the default configuration.

func EksaChangeDiff added in v0.7.0

func EksaChangeDiff(currentManagementComponents, newManagementComponents *cluster.ManagementComponents) *types.ChangeDiff

EksaChangeDiff computes the version diff in eksa components between two specs.

Types

type Applier added in v0.18.0

type Applier struct {
	// contains filtered or unexported fields
}

Applier applies the cluster spec to the management cluster and waits until the changes are fully reconciled.

func NewApplier added in v0.18.0

func NewApplier(log logr.Logger, clientFactory ClientFactory, opts ...ApplierOpt) Applier

NewApplier builds an Applier.

func (Applier) Run added in v0.18.0

func (a Applier) Run(ctx context.Context, spec *cluster.Spec, managementCluster types.Cluster) error

Run applies the cluster's spec in the management cluster and waits until the changes are fully reconciled.

type ApplierOpt added in v0.18.0

type ApplierOpt func(*Applier)

ApplierOpt allows to customize a Applier on construction.

func WithApplierApplyClusterTimeout added in v0.18.0

func WithApplierApplyClusterTimeout(timeout time.Duration) ApplierOpt

WithApplierApplyClusterTimeout allows to configure how long the applier retries to apply the objects in case of failure. Generally only used in tests.

func WithApplierNoTimeouts added in v0.18.0

func WithApplierNoTimeouts() ApplierOpt

WithApplierNoTimeouts disables the timeout for all the waits and retries in management upgrader.

func WithApplierRetryBackOff added in v0.18.0

func WithApplierRetryBackOff(backOff time.Duration) ApplierOpt

WithApplierRetryBackOff allows to configure how long the applier waits between requests to update the cluster spec objects and check the status of the Cluster. Generally only used in tests.

func WithApplierWaitForClusterReconcile added in v0.18.0

func WithApplierWaitForClusterReconcile(timeout time.Duration) ApplierOpt

WithApplierWaitForClusterReconcile allows to configure how long the applier waits for the cluster to reach the Ready state after applying changes. Generally only used in tests.

func WithApplierWaitForFailureMessage added in v0.18.0

func WithApplierWaitForFailureMessage(timeout time.Duration) ApplierOpt

WithApplierWaitForFailureMessage allows to configure how long the applier waits for failure message to be empty and check the status of the Cluster. Generally only used in tests.

type AwsIamAuth added in v0.6.0

type AwsIamAuth interface {
	CreateAndInstallAWSIAMAuthCASecret(ctx context.Context, managementCluster *types.Cluster, workloadClusterName string) error
	InstallAWSIAMAuth(ctx context.Context, management, workload *types.Cluster, spec *cluster.Spec) error
	UpgradeAWSIAMAuth(ctx context.Context, cluster *types.Cluster, spec *cluster.Spec) error
	GenerateKubeconfig(ctx context.Context, management, workload *types.Cluster, spec *cluster.Spec) error
	GenerateManagementAWSIAMKubeconfig(ctx context.Context, cluster *types.Cluster) error
}

AwsIamAuth performs operations with AWS IAM.

type CAPIClient added in v0.19.0

type CAPIClient interface {
	BackupManagement(ctx context.Context, cluster *types.Cluster, managementStatePath, clusterName string) error
	MoveManagement(ctx context.Context, from, target *types.Cluster, clusterName string) error
	InitInfrastructure(ctx context.Context, managementComponents *cluster.ManagementComponents, clusterSpec *cluster.Spec, cluster *types.Cluster, provider providers.Provider) error
	GetWorkloadKubeconfig(ctx context.Context, clusterName string, cluster *types.Cluster) ([]byte, error)
}

CAPIClient performs operations on a cluster-api management cluster.

type ClientFactory added in v0.15.0

type ClientFactory interface {
	// BuildClientFromKubeconfig builds a Kubernetes client from a kubeconfig file.
	BuildClientFromKubeconfig(kubeconfigPath string) (kubernetes.Client, error)
}

ClientFactory builds Kubernetes clients.

type ClusterApplier added in v0.19.0

type ClusterApplier interface {
	Run(ctx context.Context, spec *cluster.Spec, managementCluster types.Cluster) error
}

ClusterApplier is responsible for applying the cluster spec to the cluster.

type ClusterClient

type ClusterClient interface {
	CAPIClient
	KubernetesClient
}

ClusterClient is an interface that has both the clusterctl client and the kubernetes retrier client.

type ClusterCreator added in v0.19.0

type ClusterCreator struct {
	ClusterApplier
	// contains filtered or unexported fields
}

ClusterCreator is responsible for applying the cluster config and writing the kubeconfig file.

func NewClusterCreator added in v0.19.0

func NewClusterCreator(applier ClusterApplier, kubeconfigWriter kubeconfig.Writer, fs filewriter.FileWriter) *ClusterCreator

NewClusterCreator creates a ClusterCreator.

func (ClusterCreator) CreateSync added in v0.19.0

func (cc ClusterCreator) CreateSync(ctx context.Context, spec *cluster.Spec, managementCluster *types.Cluster) (*types.Cluster, error)

CreateSync creates a workload cluster using the EKS-A controller and returns the types.Cluster object for that cluster.

type ClusterManager

type ClusterManager struct {
	ClientFactory ClientFactory
	// contains filtered or unexported fields
}

func New

func New(client ClientFactory, clusterClient ClusterClient, writer filewriter.FileWriter, diagnosticBundleFactory diagnostics.DiagnosticBundleFactory, awsIamAuth AwsIamAuth, eksaComponents EKSAComponents, opts ...ClusterManagerOpt) *ClusterManager

New constructs a new ClusterManager.

func (*ClusterManager) AllowDeleteWhilePaused added in v0.20.0

func (c *ClusterManager) AllowDeleteWhilePaused(ctx context.Context, cluster *types.Cluster, clusterSpec *cluster.Spec) error

AllowDeleteWhilePaused allows the deletion of paused clusters.

func (*ClusterManager) ApplyBundles added in v0.6.0

func (c *ClusterManager) ApplyBundles(ctx context.Context, clusterSpec *cluster.Spec, cluster *types.Cluster) error

func (*ClusterManager) ApplyReleases added in v0.17.0

func (c *ClusterManager) ApplyReleases(ctx context.Context, clusterSpec *cluster.Spec, cluster *types.Cluster) error

ApplyReleases applies the EKSARelease manifest.

func (*ClusterManager) BackupCAPI added in v0.14.4

func (c *ClusterManager) BackupCAPI(ctx context.Context, cluster *types.Cluster, managementStatePath, clusterName string) error

BackupCAPI takes backup of management cluster's resources during the upgrade process.

func (*ClusterManager) BackupCAPIWaitForInfrastructure added in v0.16.3

func (c *ClusterManager) BackupCAPIWaitForInfrastructure(ctx context.Context, cluster *types.Cluster, managementStatePath, clusterName string) error

BackupCAPIWaitForInfrastructure takes backup of bootstrap cluster's resources during the upgrade process like BackupCAPI but with a retry policy to wait for infrastructure provisioning in addition to network errors.

func (*ClusterManager) CreateEKSANamespace added in v0.11.0

func (c *ClusterManager) CreateEKSANamespace(ctx context.Context, cluster *types.Cluster) error

func (*ClusterManager) CreateRegistryCredSecret added in v0.19.0

func (c *ClusterManager) CreateRegistryCredSecret(ctx context.Context, mgmt *types.Cluster) error

CreateRegistryCredSecret creates the registry-credentials secret on a managment cluster.

func (*ClusterManager) GenerateManagementAWSIAMKubeconfig added in v0.21.2

func (c *ClusterManager) GenerateManagementAWSIAMKubeconfig(ctx context.Context, cluster *types.Cluster) error

GenerateManagementAWSIAMKubeconfig generates a kubeconfig for interacting with the cluster with aws-iam-authenticator client.

func (*ClusterManager) GenerateWorkloadAWSIAMKubeconfig added in v0.21.2

func (c *ClusterManager) GenerateWorkloadAWSIAMKubeconfig(ctx context.Context, management, workload *types.Cluster, spec *cluster.Spec) error

GenerateWorkloadAWSIAMKubeconfig generates a kubeconfig for interacting with the cluster with aws-iam-authenticator client.

func (*ClusterManager) GetCurrentClusterSpec added in v0.6.0

func (c *ClusterManager) GetCurrentClusterSpec(ctx context.Context, clus *types.Cluster, clusterName string) (*cluster.Spec, error)

func (*ClusterManager) InstallCAPI added in v0.6.0

func (c *ClusterManager) InstallCAPI(ctx context.Context, managementComponents *cluster.ManagementComponents, clusterSpec *cluster.Spec, cluster *types.Cluster, provider providers.Provider) error

InstallCAPI installs the cluster-api components in a cluster.

func (*ClusterManager) MoveCAPI added in v0.6.0

func (c *ClusterManager) MoveCAPI(ctx context.Context, from, to *types.Cluster, clusterName string, clusterSpec *cluster.Spec, checkers ...types.NodeReadyChecker) error

func (*ClusterManager) PauseCAPIWorkloadClusters added in v0.16.0

func (c *ClusterManager) PauseCAPIWorkloadClusters(ctx context.Context, managementCluster *types.Cluster) error

PauseCAPIWorkloadClusters pauses all workload CAPI clusters except the management cluster.

func (*ClusterManager) PauseEKSAControllerReconcile

func (c *ClusterManager) PauseEKSAControllerReconcile(ctx context.Context, cluster *types.Cluster, clusterSpec *cluster.Spec, provider providers.Provider) error

func (*ClusterManager) ResumeCAPIWorkloadClusters added in v0.16.0

func (c *ClusterManager) ResumeCAPIWorkloadClusters(ctx context.Context, managementCluster *types.Cluster) error

ResumeCAPIWorkloadClusters resumes all workload CAPI clusters except the management cluster.

func (*ClusterManager) ResumeEKSAControllerReconcile

func (c *ClusterManager) ResumeEKSAControllerReconcile(ctx context.Context, cluster *types.Cluster, clusterSpec *cluster.Spec, provider providers.Provider) error

ResumeEKSAControllerReconcile resumes a paused EKS-Anywhere cluster.

func (*ClusterManager) SaveLogsManagementCluster added in v0.6.0

func (c *ClusterManager) SaveLogsManagementCluster(ctx context.Context, spec *cluster.Spec, cluster *types.Cluster) error

func (*ClusterManager) SaveLogsWorkloadCluster added in v0.6.0

func (c *ClusterManager) SaveLogsWorkloadCluster(ctx context.Context, provider providers.Provider, spec *cluster.Spec, cluster *types.Cluster) error

func (*ClusterManager) Upgrade added in v0.13.0

func (c *ClusterManager) Upgrade(ctx context.Context, cluster *types.Cluster, currentManagementComponents, newManagementComponents *cluster.ManagementComponents, newSpec *cluster.Spec) (*types.ChangeDiff, error)

Upgrade updates the eksa components in a cluster according to a Spec.

type ClusterManagerOpt

type ClusterManagerOpt func(*ClusterManager)

func WithControlPlaneWaitTimeout added in v0.12.0

func WithControlPlaneWaitTimeout(timeout time.Duration) ClusterManagerOpt

func WithExternalEtcdWaitTimeout added in v0.12.0

func WithExternalEtcdWaitTimeout(timeout time.Duration) ClusterManagerOpt

func WithMachineBackoff added in v0.12.0

func WithMachineBackoff(machineBackoff time.Duration) ClusterManagerOpt

func WithMachineMaxWait added in v0.12.0

func WithMachineMaxWait(machineMaxWait time.Duration) ClusterManagerOpt

func WithMachineMinWait added in v0.12.0

func WithMachineMinWait(machineMinWait time.Duration) ClusterManagerOpt

func WithNoTimeouts added in v0.14.4

func WithNoTimeouts() ClusterManagerOpt

WithNoTimeouts disables the timeout for all the waits and retries in cluster manager.

func WithNodeStartupTimeout added in v0.14.1

func WithNodeStartupTimeout(timeout time.Duration) ClusterManagerOpt

WithNodeStartupTimeout sets the timeout of a machine without a node to be considered to have failed machine health check.

func WithRetrier added in v0.6.0

func WithRetrier(retrier *retrier.Retrier) ClusterManagerOpt

func WithUnhealthyMachineTimeout added in v0.13.0

func WithUnhealthyMachineTimeout(timeout time.Duration) ClusterManagerOpt

WithUnhealthyMachineTimeout sets the timeout of an unhealthy machine health check.

type CreateClusterShim added in v0.13.0

type CreateClusterShim struct {
	// contains filtered or unexported fields
}

CreateClusterShim is a shim that implements the workload.Cluster interface. It leverages existing ClusterManager behavior to create a cluster for new workflows.

func NewCreateClusterShim added in v0.13.0

func NewCreateClusterShim(
	spec *cluster.Spec,
	provider providers.Provider,
) *CreateClusterShim

NewCreateClusterShim returns a new CreateClusterShim instance.

func (CreateClusterShim) CreateAsync added in v0.13.0

func (s CreateClusterShim) CreateAsync(ctx context.Context, management *types.Cluster) error

CreateAsync satisfies the workload.Cluster interface.

func (CreateClusterShim) GetName added in v0.13.0

func (s CreateClusterShim) GetName() string

GetName satisfies the workload.Cluster interface.

func (CreateClusterShim) WaitUntilControlPlaneAvailable added in v0.13.0

func (s CreateClusterShim) WaitUntilControlPlaneAvailable(ctx context.Context, management *types.Cluster) error

WaitUntilControlPlaneAvailable satisfies the workload.Cluster interface.

func (CreateClusterShim) WaitUntilReady added in v0.13.0

func (s CreateClusterShim) WaitUntilReady(ctx context.Context, management *types.Cluster) error

WaitUntilReady satisfies the workload.Cluster interface.

func (CreateClusterShim) WriteKubeconfig added in v0.13.0

func (s CreateClusterShim) WriteKubeconfig(ctx context.Context, w io.Writer, management *types.Cluster) error

WriteKubeconfig satisfies the workload.Cluster interface.

type Deleter added in v0.19.0

type Deleter struct {
	// contains filtered or unexported fields
}

Deleter deletes the cluster from the management cluster and waits until the deletions are fully reconciled.

func NewDeleter added in v0.19.0

func NewDeleter(log logr.Logger, clientFactory ClientFactory, opts ...DeleterOpt) Deleter

NewDeleter builds an Deleter.

func (Deleter) Run added in v0.19.0

func (a Deleter) Run(ctx context.Context, spec *cluster.Spec, managementCluster types.Cluster) error

Run deletes the cluster's spec in the management cluster and waits until the changes are fully reconciled.

type DeleterOpt added in v0.19.0

type DeleterOpt func(*Deleter)

DeleterOpt allows to customize a Deleter on construction.

func WithDeleterApplyClusterTimeout added in v0.19.0

func WithDeleterApplyClusterTimeout(timeout time.Duration) DeleterOpt

WithDeleterApplyClusterTimeout allows to configure how long the deleter retries to delete the objects in case of failure. Generally only used in tests.

func WithDeleterNoTimeouts added in v0.19.0

func WithDeleterNoTimeouts() DeleterOpt

WithDeleterNoTimeouts disables the timeout for all the waits and retries in management upgrader.

func WithDeleterRetryBackOff added in v0.19.0

func WithDeleterRetryBackOff(backOff time.Duration) DeleterOpt

WithDeleterRetryBackOff allows to configure how long the deleter waits between requests to update the cluster spec objects and check the status of the Cluster. Generally only used in tests.

type EKSAComponentGenerator added in v0.13.0

type EKSAComponentGenerator struct {
	// contains filtered or unexported fields
}

EKSAComponentGenerator generates and configures eks-a components.

type EKSAComponents added in v0.13.0

type EKSAComponents interface {
	Install(ctx context.Context, log logr.Logger, cluster *types.Cluster, managementComponents *cluster.ManagementComponents, spec *cluster.Spec) error
	Upgrade(ctx context.Context, log logr.Logger, cluster *types.Cluster, currentManagementComponents, newManagementComponents *cluster.ManagementComponents, newSpec *cluster.Spec) (*types.ChangeDiff, error)
}

EKSAComponents allows to manage the eks-a components installation in a cluster.

type EKSAInstaller added in v0.13.0

type EKSAInstaller struct {
	// contains filtered or unexported fields
}

EKSAInstaller allows to install eks-a components in a cluster.

func NewEKSAInstaller added in v0.13.0

func NewEKSAInstaller(client KubernetesClient, reader manifests.FileReader, opts ...EKSAInstallerOpt) *EKSAInstaller

NewEKSAInstaller constructs a new EKSAInstaller.

func (*EKSAInstaller) Install added in v0.13.0

func (i *EKSAInstaller) Install(ctx context.Context, log logr.Logger, cluster *types.Cluster, managementComponents *cluster.ManagementComponents, spec *cluster.Spec) error

Install configures and applies eks-a components in a cluster accordingly to a spec.

func (*EKSAInstaller) Upgrade added in v0.13.0

func (i *EKSAInstaller) Upgrade(ctx context.Context, log logr.Logger, c *types.Cluster, currentManagementComponents, newManagementComponents *cluster.ManagementComponents, newSpec *cluster.Spec) (*types.ChangeDiff, error)

Upgrade re-installs the eksa components in a cluster if the VersionBundle defined in the new spec has a different eks-a components version. Workload clusters are ignored.

type EKSAInstallerOpt added in v0.14.4

type EKSAInstallerOpt func(*EKSAInstaller)

EKSAInstallerOpt updates an EKSAInstaller.

func WithEKSAInstallerNoTimeouts added in v0.14.4

func WithEKSAInstallerNoTimeouts() EKSAInstallerOpt

WithEKSAInstallerNoTimeouts disables the timeout when waiting for a deployment to be ready.

type KubernetesClient added in v0.13.0

type KubernetesClient interface {
	Apply(ctx context.Context, kubeconfigPath string, obj runtime.Object, opts ...kubernetes.KubectlApplyOption) error
	ApplyKubeSpecFromBytes(ctx context.Context, cluster *types.Cluster, data []byte) error
	ApplyKubeSpecFromBytesWithNamespace(ctx context.Context, cluster *types.Cluster, data []byte, namespace string) error
	ApplyKubeSpecFromBytesForce(ctx context.Context, cluster *types.Cluster, data []byte) error
	WaitForDeployment(ctx context.Context, cluster *types.Cluster, timeout string, condition string, target string, namespace string) error
	UpdateAnnotationInNamespace(ctx context.Context, resourceType, objectName string, annotations map[string]string, cluster *types.Cluster, namespace string) error
	RemoveAnnotationInNamespace(ctx context.Context, resourceType, objectName, key string, cluster *types.Cluster, namespace string) error
	CreateNamespaceIfNotPresent(ctx context.Context, kubeconfig string, namespace string) error
	PauseCAPICluster(ctx context.Context, cluster, kubeconfig string) error
	ResumeCAPICluster(ctx context.Context, cluster, kubeconfig string) error
	ListObjects(ctx context.Context, resourceType, namespace, kubeconfig string, list kubernetes.ObjectList) error
	DeleteGitOpsConfig(ctx context.Context, cluster *types.Cluster, name string, namespace string) error
	DeleteEKSACluster(ctx context.Context, cluster *types.Cluster, name string, namespace string) error
	DeleteAWSIamConfig(ctx context.Context, cluster *types.Cluster, name string, namespace string) error
	DeleteOIDCConfig(ctx context.Context, cluster *types.Cluster, name string, namespace string) error
	DeleteCluster(ctx context.Context, cluster, clusterToDelete *types.Cluster) error
	WaitForClusterReady(ctx context.Context, cluster *types.Cluster, timeout string, clusterName string) error
	WaitForControlPlaneAvailable(ctx context.Context, cluster *types.Cluster, timeout string, newClusterName string) error
	WaitForControlPlaneReady(ctx context.Context, cluster *types.Cluster, timeout string, newClusterName string) error
	WaitForControlPlaneNotReady(ctx context.Context, cluster *types.Cluster, timeout string, newClusterName string) error
	WaitForManagedExternalEtcdReady(ctx context.Context, cluster *types.Cluster, timeout string, newClusterName string) error
	WaitForManagedExternalEtcdNotReady(ctx context.Context, cluster *types.Cluster, timeout string, newClusterName string) error
	GetEksaGitOpsConfig(ctx context.Context, gitOpsConfigName string, kubeconfigFile string, namespace string) (*v1alpha1.GitOpsConfig, error)
	GetEksaFluxConfig(ctx context.Context, fluxConfigName string, kubeconfigFile string, namespace string) (*v1alpha1.FluxConfig, error)
	GetEksaOIDCConfig(ctx context.Context, oidcConfigName string, kubeconfigFile string, namespace string) (*v1alpha1.OIDCConfig, error)
	GetEksaAWSIamConfig(ctx context.Context, awsIamConfigName string, kubeconfigFile string, namespace string) (*v1alpha1.AWSIamConfig, error)
	SaveLog(ctx context.Context, cluster *types.Cluster, deployment *types.Deployment, fileName string, writer filewriter.FileWriter) error
	GetMachines(ctx context.Context, cluster *types.Cluster, clusterName string) ([]types.Machine, error)
	GetClusters(ctx context.Context, cluster *types.Cluster) ([]types.CAPICluster, error)
	GetEksaCluster(ctx context.Context, cluster *types.Cluster, clusterName string) (*v1alpha1.Cluster, error)
	GetEksaVSphereDatacenterConfig(ctx context.Context, VSphereDatacenterName string, kubeconfigFile string, namespace string) (*v1alpha1.VSphereDatacenterConfig, error)
	UpdateEnvironmentVariablesInNamespace(ctx context.Context, resourceType, resourceName string, envMap map[string]string, cluster *types.Cluster, namespace string) error
	GetEksaVSphereMachineConfig(ctx context.Context, VSphereDatacenterName string, kubeconfigFile string, namespace string) (*v1alpha1.VSphereMachineConfig, error)
	GetEksaCloudStackMachineConfig(ctx context.Context, cloudstackMachineConfigName string, kubeconfigFile string, namespace string) (*v1alpha1.CloudStackMachineConfig, error)
	SetEksaControllerEnvVar(ctx context.Context, envVar, envVarVal, kubeconfig string) error
	ValidateControlPlaneNodes(ctx context.Context, cluster *types.Cluster, clusterName string) error
	ValidateWorkerNodes(ctx context.Context, clusterName string, kubeconfigFile string) error
	CountMachineDeploymentReplicasReady(ctx context.Context, clusterName string, kubeconfigFile string) (int, int, error)
	GetBundles(ctx context.Context, kubeconfigFile, name, namespace string) (*releasev1alpha1.Bundles, error)
	GetApiServerUrl(ctx context.Context, cluster *types.Cluster) (string, error)
	KubeconfigSecretAvailable(ctx context.Context, kubeconfig string, clusterName string, namespace string) (bool, error)
	DeleteOldWorkerNodeGroup(ctx context.Context, machineDeployment *clusterv1.MachineDeployment, kubeconfig string) error
	GetKubeadmControlPlane(ctx context.Context, cluster *types.Cluster, clusterName string, opts ...executables.KubectlOpt) (*controlplanev1.KubeadmControlPlane, error)
	GetMachineDeploymentsForCluster(ctx context.Context, clusterName string, opts ...executables.KubectlOpt) ([]clusterv1.MachineDeployment, error)
	GetMachineDeployment(ctx context.Context, workerNodeGroupName string, opts ...executables.KubectlOpt) (*clusterv1.MachineDeployment, error)
	GetEksdRelease(ctx context.Context, name, namespace, kubeconfigFile string) (*eksdv1alpha1.Release, error)
	GetConfigMap(ctx context.Context, kubeconfigFile, name, namespace string) (*corev1.ConfigMap, error)
}

KubernetesClient allows to interact with the k8s api server.

type KubernetesRetrierClient added in v0.19.0

type KubernetesRetrierClient struct {
	KubernetesClient
	// contains filtered or unexported fields
}

KubernetesRetrierClient wraps around a KubernetesClient, offering retry functionality for some operations.

func NewRetrierClient added in v0.6.0

func NewRetrierClient(client KubernetesClient, retrier *retrier.Retrier) *KubernetesRetrierClient

NewRetrierClient constructs a new RetrierClient.

func (*KubernetesRetrierClient) Apply added in v0.19.0

func (c *KubernetesRetrierClient) Apply(ctx context.Context, kubeconfigPath string, obj runtime.Object, opts ...kubernetes.KubectlApplyOption) error

Apply creates/updates an object against the api server following a client side apply mechanism.

func (*KubernetesRetrierClient) ApplyKubeSpecFromBytes added in v0.19.0

func (c *KubernetesRetrierClient) ApplyKubeSpecFromBytes(ctx context.Context, cluster *types.Cluster, data []byte) error

ApplyKubeSpecFromBytes creates/updates the objects defined in a yaml manifest against the api server following a client side apply mechanism.

func (*KubernetesRetrierClient) ApplyKubeSpecFromBytesForce added in v0.19.0

func (c *KubernetesRetrierClient) ApplyKubeSpecFromBytesForce(ctx context.Context, cluster *types.Cluster, data []byte) error

ApplyKubeSpecFromBytesForce creates/updates the objects defined in a yaml manifest against the api server following a client side apply mechanism. It forces the operation, so if api validation failed, it will delete and re-create the object.

func (*KubernetesRetrierClient) ApplyKubeSpecFromBytesWithNamespace added in v0.19.0

func (c *KubernetesRetrierClient) ApplyKubeSpecFromBytesWithNamespace(ctx context.Context, cluster *types.Cluster, data []byte, namespace string) error

ApplyKubeSpecFromBytesWithNamespace creates/updates the objects defined in a yaml manifest against the api server following a client side apply mechanism. It applies all objects in the given namespace.

func (*KubernetesRetrierClient) DeleteAWSIamConfig added in v0.19.0

func (c *KubernetesRetrierClient) DeleteAWSIamConfig(ctx context.Context, cluster *types.Cluster, name string, namespace string) error

DeleteAWSIamConfig deletes an AWSIamConfig object from the cluster.

func (*KubernetesRetrierClient) DeleteCluster added in v0.19.0

func (c *KubernetesRetrierClient) DeleteCluster(ctx context.Context, cluster, clusterToDelete *types.Cluster) error

DeleteCluster deletes a CAPI Cluster from the cluster.

func (*KubernetesRetrierClient) DeleteEKSACluster added in v0.19.0

func (c *KubernetesRetrierClient) DeleteEKSACluster(ctx context.Context, cluster *types.Cluster, name string, namespace string) error

DeleteEKSACluster deletes an EKSA Cluster object from the cluster.

func (*KubernetesRetrierClient) DeleteGitOpsConfig added in v0.19.0

func (c *KubernetesRetrierClient) DeleteGitOpsConfig(ctx context.Context, cluster *types.Cluster, name string, namespace string) error

DeleteGitOpsConfig deletes a GitOpsConfigObject from the cluster.

func (*KubernetesRetrierClient) DeleteOIDCConfig added in v0.19.0

func (c *KubernetesRetrierClient) DeleteOIDCConfig(ctx context.Context, cluster *types.Cluster, name string, namespace string) error

DeleteOIDCConfig deletes a OIDCConfig object from the cluster.

func (*KubernetesRetrierClient) ListObjects added in v0.19.0

func (c *KubernetesRetrierClient) ListObjects(ctx context.Context, resourceType, namespace, kubeconfig string, list kubernetes.ObjectList) error

ListObjects reads all Objects of a particular resource type in a namespace.

func (*KubernetesRetrierClient) PauseCAPICluster added in v0.19.0

func (c *KubernetesRetrierClient) PauseCAPICluster(ctx context.Context, cluster, kubeconfig string) error

PauseCAPICluster adds a `spec.Paused: true` to the CAPI cluster resource. This will cause all downstream CAPI + provider controllers to skip reconciling on the paused cluster's objects.

func (*KubernetesRetrierClient) RemoveAnnotationInNamespace added in v0.19.0

func (c *KubernetesRetrierClient) RemoveAnnotationInNamespace(ctx context.Context, resourceType, objectName, key string, cluster *types.Cluster, namespace string) error

RemoveAnnotationInNamespace deletes an annotation for the given kubernetes resource if present.

func (*KubernetesRetrierClient) ResumeCAPICluster added in v0.19.0

func (c *KubernetesRetrierClient) ResumeCAPICluster(ctx context.Context, cluster, kubeconfig string) error

ResumeCAPICluster removes the `spec.Paused` on the CAPI cluster resource. This will cause all downstream CAPI + provider controllers to resume reconciling on the paused cluster's objects.

func (*KubernetesRetrierClient) UpdateAnnotationInNamespace added in v0.19.0

func (c *KubernetesRetrierClient) UpdateAnnotationInNamespace(ctx context.Context, resourceType, objectName string, annotations map[string]string, cluster *types.Cluster, namespace string) error

UpdateAnnotationInNamespace adds/updates an annotation for the given kubernetes resource.

type Mover added in v0.20.0

type Mover struct {
	// contains filtered or unexported fields
}

Mover applies the cluster spec to the management cluster and waits until the changes are fully reconciled.

func NewMover added in v0.20.0

func NewMover(log logr.Logger, clientFactory ClientFactory, opts ...MoverOpt) *Mover

NewMover builds an Mover.

func (*Mover) Move added in v0.20.0

func (m *Mover) Move(ctx context.Context, spec *cluster.Spec, fromClient, toClient kubernetes.Client) error

Move applies the cluster's namespace and spec without checking for reconcile conditions.

type MoverOpt added in v0.20.0

type MoverOpt func(*Mover)

MoverOpt allows to customize a Mover on construction.

func WithMoverApplyClusterTimeout added in v0.20.0

func WithMoverApplyClusterTimeout(timeout time.Duration) MoverOpt

WithMoverApplyClusterTimeout allows to configure how long the mover retries to apply the objects in case of failure. Generally only used in tests.

func WithMoverNoTimeouts added in v0.20.0

func WithMoverNoTimeouts() MoverOpt

WithMoverNoTimeouts disables the timeout for all the waits and retries in management upgrader.

func WithMoverRetryBackOff added in v0.20.0

func WithMoverRetryBackOff(backOff time.Duration) MoverOpt

WithMoverRetryBackOff allows to configure how long the mover waits between requests to update the cluster spec objects and check the status of the Cluster. Generally only used in tests.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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