clustermanager

package
v0.17.3 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2023 License: Apache-2.0 Imports: 53 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(currentSpec, newSpec *cluster.Spec) *types.ChangeDiff

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

Types

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
}

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 ClusterClient

type ClusterClient interface {
	KubernetesClient
	BackupManagement(ctx context.Context, cluster *types.Cluster, managementStatePath, clusterName string) error
	MoveManagement(ctx context.Context, from, target *types.Cluster, clusterName string) 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
	GetWorkloadKubeconfig(ctx context.Context, clusterName string, cluster *types.Cluster) ([]byte, 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)
	DeleteCluster(ctx context.Context, managementCluster, clusterToDelete *types.Cluster) error
	DeleteGitOpsConfig(ctx context.Context, managementCluster *types.Cluster, gitOpsName, namespace string) error
	DeleteOIDCConfig(ctx context.Context, managementCluster *types.Cluster, oidcConfigName, oidcConfigNamespace string) error
	DeleteAWSIamConfig(ctx context.Context, managementCluster *types.Cluster, awsIamConfigName, awsIamConfigNamespace string) error
	DeleteEKSACluster(ctx context.Context, managementCluster *types.Cluster, eksaClusterName, eksaClusterNamespace string) error
	DeletePackageResources(ctx context.Context, managementCluster *types.Cluster, clusterName string) error
	InitInfrastructure(ctx context.Context, clusterSpec *cluster.Spec, cluster *types.Cluster, provider providers.Provider) error
	WaitForDeployment(ctx context.Context, cluster *types.Cluster, timeout string, condition string, target string, namespace string) 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)
	PauseCAPICluster(ctx context.Context, cluster, kubeconfig string) error
	ResumeCAPICluster(ctx context.Context, cluster, kubeconfig string) 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
	CreateNamespaceIfNotPresent(ctx context.Context, kubeconfig string, namespace 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)
	ListObjects(ctx context.Context, resourceType, namespace, kubeconfig string, list kubernetes.ObjectList) error
}

type ClusterManager

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

func New

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

New constructs a new ClusterManager.

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) CreateAwsIamAuthCaSecret added in v0.6.0

func (c *ClusterManager) CreateAwsIamAuthCaSecret(ctx context.Context, managementCluster *types.Cluster, workloadClusterName string) error

func (*ClusterManager) CreateEKSANamespace added in v0.11.0

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

func (*ClusterManager) CreateEKSAResources

func (c *ClusterManager) CreateEKSAResources(ctx context.Context, cluster *types.Cluster, clusterSpec *cluster.Spec,
	datacenterConfig providers.DatacenterConfig, machineConfigs []providers.MachineConfig,
) error

CreateEKSAResources applies the eks-a cluster specs (cluster, datacenterconfig, machine configs, etc.), as well as the release bundle to the cluster. Before applying the spec, we pause eksa controller cluster and datacenter webhook validation so that the cluster spec can be created or updated in the cluster without webhook validation error.

func (*ClusterManager) CreateWorkloadCluster

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

CreateWorkloadCluster creates a workload cluster in the provider that the customer has specified. It applied the kubernetes manifest file on the management cluster, waits for the control plane to be ready, and then generates the kubeconfig for the cluster. It returns a struct of type Cluster containing the name and the kubeconfig of the cluster.

func (*ClusterManager) DeleteCluster

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

func (*ClusterManager) DeletePackageResources added in v0.12.0

func (c *ClusterManager) DeletePackageResources(ctx context.Context, managementCluster *types.Cluster, clusterName string) error

func (*ClusterManager) EKSAClusterSpecChanged

func (c *ClusterManager) EKSAClusterSpecChanged(ctx context.Context, clus *types.Cluster, newClusterSpec *cluster.Spec) (bool, error)

EKSAClusterSpecChanged checks if a cluster's new Spec is different from the current Spec.

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) InstallAwsIamAuth added in v0.6.0

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

InstallAwsIamAuth applies the aws-iam-authenticator manifest based on cluster spec inputs. Generates a kubeconfig for interacting with the cluster with aws-iam-authenticator client.

func (*ClusterManager) InstallCAPI added in v0.6.0

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

func (*ClusterManager) InstallCustomComponents

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

func (*ClusterManager) InstallMachineHealthChecks

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

InstallMachineHealthChecks installs machine health checks for a given eksa cluster.

func (*ClusterManager) InstallNetworking

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

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

func (*ClusterManager) RunPostCreateWorkloadCluster added in v0.10.1

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

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, currentSpec, newSpec *cluster.Spec) (*types.ChangeDiff, error)

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

func (*ClusterManager) UpgradeCluster

func (c *ClusterManager) UpgradeCluster(ctx context.Context, managementCluster, workloadCluster *types.Cluster, newClusterSpec *cluster.Spec, provider providers.Provider) error

func (*ClusterManager) UpgradeNetworking added in v0.7.0

func (c *ClusterManager) UpgradeNetworking(ctx context.Context, cluster *types.Cluster, currentSpec, newSpec *cluster.Spec, provider providers.Provider) (*types.ChangeDiff, error)

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,
	manager *ClusterManager,
	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 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, spec *cluster.Spec) error
	Upgrade(ctx context.Context, log logr.Logger, cluster *types.Cluster, currentSpec, 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, 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, currentSpec, 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 KubeProxyCLIUpgrader added in v0.15.0

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

KubeProxyCLIUpgrader prepares a cluster for a kube-proxy upgrade. It's mostly a wrapper around KubeProxyUpgrader to be used from the CLI. It builds clients from kubeconfig files and facilitates mocking. It also uses a retrier around KubeProxyCLIUpgrader to deal with transient errors.

func NewKubeProxyCLIUpgrader added in v0.15.0

func NewKubeProxyCLIUpgrader(log logr.Logger, factory ClientFactory, opts ...KubeProxyCLIUpgraderOpt) KubeProxyCLIUpgrader

NewKubeProxyCLIUpgrader builds a new KubeProxyCLIUpgrader.

func (KubeProxyCLIUpgrader) CleanupAfterUpgrade added in v0.15.0

func (u KubeProxyCLIUpgrader) CleanupAfterUpgrade(ctx context.Context,
	spec *cluster.Spec,
	managementClusterKubeconfigPath, workloadClusterKubeconfigPath string,
) error

CleanupAfterUpgrade perfoms the necessary steps after an upgrade.

func (KubeProxyCLIUpgrader) PrepareUpgrade added in v0.15.0

func (u KubeProxyCLIUpgrader) PrepareUpgrade(ctx context.Context,
	spec *cluster.Spec,
	managementClusterKubeconfigPath, workloadClusterKubeconfigPath string,
) error

PrepareUpgrade perfoms the necessary steps prior to a kube-proxy upgrade.

type KubeProxyCLIUpgraderOpt added in v0.15.0

type KubeProxyCLIUpgraderOpt func(*KubeProxyCLIUpgrader)

KubeProxyCLIUpgraderOpt allows to customize a KubeProxyCLIUpgrader on construction.

func KubeProxyCLIUpgraderRetrier added in v0.15.0

func KubeProxyCLIUpgraderRetrier(retrier retrier.Retrier) KubeProxyCLIUpgraderOpt

KubeProxyCLIUpgraderRetrier allows to use a custom retrier.

type KubeProxyUpgrader added in v0.15.0

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

KubeProxyUpgrader prepares a cluster for a kube-proxy upgrade.

func NewKubeProxyUpgrader added in v0.15.0

func NewKubeProxyUpgrader(opts ...KubeProxyUpgraderOpt) KubeProxyUpgrader

NewKubeProxyUpgrader builds a new KubeProxyUpgrader.

func (KubeProxyUpgrader) CleanupAfterUpgrade added in v0.15.0

func (u KubeProxyUpgrader) CleanupAfterUpgrade(ctx context.Context, log logr.Logger, managementClusterClient, workloadClusterClient kubernetes.Client, spec *cluster.Spec) error

CleanupAfterUpgrade cleanups all the leftover changes made by PrepareForUpgrade. It's idempotent so it can be call multiple timesm even if PrepareForUpgrade wasn't called before.

func (KubeProxyUpgrader) PrepareForUpgrade added in v0.15.0

func (u KubeProxyUpgrader) PrepareForUpgrade(ctx context.Context, log logr.Logger, managementClusterClient, workloadClusterClient kubernetes.Client, spec *cluster.Spec) error

PrepareForUpgrade gets the workload cluster ready for a smooth transition between the old kube-proxy that always uses iptables legacy and the new one that detects the host preference and is able to work with nft as well. This is idempotent, so it can be called in a loop if transient errors are a risk.

type KubeProxyUpgraderOpt added in v0.15.0

type KubeProxyUpgraderOpt func(*KubeProxyUpgrader)

KubeProxyUpgraderOpt allows to customize a KubeProxyUpgraderOpt on construction.

func WithUpdateKubeProxyTiming added in v0.15.0

func WithUpdateKubeProxyTiming(retries int, backoff time.Duration) KubeProxyUpgraderOpt

WithUpdateKubeProxyTiming allows to customize the retry paramenter for the kube-proxy version update. This is for unit tests.

type KubernetesClient added in v0.13.0

type KubernetesClient interface {
	Apply(ctx context.Context, kubeconfigPath string, obj runtime.Object) 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
}

KubernetesClient allows to interact with the k8s api server.

type Networking

type Networking interface {
	Install(ctx context.Context, cluster *types.Cluster, clusterSpec *cluster.Spec, namespaces []string) error
	Upgrade(ctx context.Context, cluster *types.Cluster, currentSpec, newSpec *cluster.Spec, namespaces []string) (*types.ChangeDiff, error)
	RunPostControlPlaneUpgradeSetup(ctx context.Context, cluster *types.Cluster) error
}

type RetrierClient added in v0.13.0

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

RetrierClient wraps around a ClusterClient, offering retry functionality for some operations.

func NewRetrierClient added in v0.6.0

func NewRetrierClient(client ClusterClient, retrier *retrier.Retrier) *RetrierClient

NewRetrierClient constructs a new RetrierClient.

func (*RetrierClient) Apply added in v0.13.0

func (c *RetrierClient) Apply(ctx context.Context, kubeconfigPath string, obj runtime.Object) error

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

func (*RetrierClient) ApplyKubeSpecFromBytes added in v0.13.0

func (c *RetrierClient) 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 (*RetrierClient) ApplyKubeSpecFromBytesForce added in v0.13.0

func (c *RetrierClient) 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 (*RetrierClient) ApplyKubeSpecFromBytesWithNamespace added in v0.13.0

func (c *RetrierClient) 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 (*RetrierClient) DeleteAWSIamConfig added in v0.13.0

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

DeleteAWSIamConfig deletes an AWSIamConfig object from the cluster.

func (*RetrierClient) DeleteCluster added in v0.13.0

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

DeleteCluster deletes a CAPI Cluster from the cluster.

func (*RetrierClient) DeleteEKSACluster added in v0.13.0

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

DeleteEKSACluster deletes an EKSA Cluster object from the cluster.

func (*RetrierClient) DeleteGitOpsConfig added in v0.13.0

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

DeleteGitOpsConfig deletes a GitOpsConfigObject from the cluster.

func (*RetrierClient) DeleteOIDCConfig added in v0.13.0

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

DeleteOIDCConfig deletes a OIDCConfig object from the cluster.

func (*RetrierClient) ListObjects added in v0.13.0

func (c *RetrierClient) 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 (*RetrierClient) PauseCAPICluster added in v0.16.0

func (c *RetrierClient) 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 (*RetrierClient) RemoveAnnotationInNamespace added in v0.13.0

func (c *RetrierClient) 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 (*RetrierClient) ResumeCAPICluster added in v0.16.0

func (c *RetrierClient) 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 (*RetrierClient) UpdateAnnotationInNamespace added in v0.13.0

func (c *RetrierClient) 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.

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