Documentation
¶
Index ¶
- Variables
- func ControlPlaneLabelsForCluster(clusterName string) map[string]string
- func ControlPlaneLabelsForClusterWithHash(clusterName string, hash string) map[string]string
- func ControlPlaneSelectorForCluster(clusterName string) *metav1.LabelSelector
- func PickFewest(failureDomains clusterv1.FailureDomains, machines FilterableMachineCollection) *string
- func PickMost(failureDomains clusterv1.FailureDomains, machines FilterableMachineCollection) *string
- type ClusterStatus
- type CoreDNSMigrator
- type FilterableMachineCollection
- func (s FilterableMachineCollection) AnyFilter(filters ...machinefilters.Func) FilterableMachineCollection
- func (s FilterableMachineCollection) DeepCopy() FilterableMachineCollection
- func (s FilterableMachineCollection) Filter(filters ...machinefilters.Func) FilterableMachineCollection
- func (s FilterableMachineCollection) Insert(machines ...*clusterv1.Machine) FilterableMachineCollection
- func (s FilterableMachineCollection) Len() int
- func (s FilterableMachineCollection) Oldest() *clusterv1.Machine
- type HealthCheckResult
- type Management
- func (m *Management) GetMachinesForCluster(ctx context.Context, cluster client.ObjectKey, filters ...machinefilters.Func) (FilterableMachineCollection, error)
- func (m *Management) GetWorkloadCluster(ctx context.Context, clusterKey client.ObjectKey) (WorkloadCluster, error)
- func (m *Management) TargetClusterControlPlaneIsHealthy(ctx context.Context, clusterKey client.ObjectKey, controlPlaneName string) error
- func (m *Management) TargetClusterEtcdIsHealthy(ctx context.Context, clusterKey client.ObjectKey, controlPlaneName string) error
- type ManagementCluster
- type Workload
- func (w *Workload) ClusterStatus(ctx context.Context) (ClusterStatus, error)
- func (w *Workload) ControlPlaneIsHealthy(ctx context.Context) (HealthCheckResult, error)
- func (w *Workload) EtcdIsHealthy(ctx context.Context) (HealthCheckResult, error)
- func (w *Workload) ReconcileKubeletRBACBinding(ctx context.Context, version semver.Version) error
- func (w *Workload) ReconcileKubeletRBACRole(ctx context.Context, version semver.Version) error
- func (w *Workload) RemoveEtcdMemberForMachine(ctx context.Context, machine *clusterv1.Machine) error
- func (w *Workload) RemoveMachineFromKubeadmConfigMap(ctx context.Context, machine *clusterv1.Machine) error
- func (w *Workload) UpdateCoreDNS(ctx context.Context, kcp *controlplanev1.KubeadmControlPlane) error
- func (w *Workload) UpdateEtcdVersionInKubeadmConfigMap(ctx context.Context, imageRepository, imageTag string) error
- func (w *Workload) UpdateKubeProxyImageInfo(ctx context.Context, kcp *controlplanev1.KubeadmControlPlane) error
- func (w *Workload) UpdateKubeletConfigMap(ctx context.Context, version semver.Version) error
- func (w *Workload) UpdateKubernetesVersionInKubeadmConfigMap(ctx context.Context, version semver.Version) error
- type WorkloadCluster
Constants ¶
This section is empty.
Variables ¶
var (
ErrControlPlaneMinNodes = errors.New("cluster has fewer than 2 control plane nodes; removing an etcd member is not supported")
)
var Log = klogr.New()
Log is the global logger for the internal package.
Functions ¶
func ControlPlaneLabelsForCluster ¶
ControlPlaneLabelsForCluster returns a set of labels to add to a control plane machine for this specific cluster.
func ControlPlaneLabelsForClusterWithHash ¶
ControlPlaneLabelsForClusterWithHash returns a set of labels to add to a control plane machine for this specific cluster and configuration hash
func ControlPlaneSelectorForCluster ¶
func ControlPlaneSelectorForCluster(clusterName string) *metav1.LabelSelector
ControlPlaneSelectorForCluster returns the label selector necessary to get control plane machines for a given cluster.
func PickFewest ¶
func PickFewest(failureDomains clusterv1.FailureDomains, machines FilterableMachineCollection) *string
PickFewest returns the failure domain with the fewest number of machines.
func PickMost ¶
func PickMost(failureDomains clusterv1.FailureDomains, machines FilterableMachineCollection) *string
PickMost returns the failure domain with the most number of machines.
Types ¶
type ClusterStatus ¶
type ClusterStatus struct {
// Nodes are a total count of nodes
Nodes int32
// ReadyNodes are the count of nodes that are reporting ready
ReadyNodes int32
// HasKubeadmConfig will be true if the kubeadm config map has been uploaded, false otherwise.
HasKubeadmConfig bool
}
ClusterStatus holds stats information about the cluster.
type CoreDNSMigrator ¶
type CoreDNSMigrator struct{}
type FilterableMachineCollection ¶
FilterableMachineCollection is a set of Machines
func NewFilterableMachineCollection ¶
func NewFilterableMachineCollection(machines ...*clusterv1.Machine) FilterableMachineCollection
NewFilterableMachineCollection creates a FilterableMachineCollection from a list of values.
func NewFilterableMachineCollectionFromMachineList ¶
func NewFilterableMachineCollectionFromMachineList(machineList *clusterv1.MachineList) FilterableMachineCollection
NewFilterableMachineCollectionFromMachineList creates a FilterableMachineCollection from the given MachineList
func (FilterableMachineCollection) AnyFilter ¶
func (s FilterableMachineCollection) AnyFilter(filters ...machinefilters.Func) FilterableMachineCollection
AnyFilter returns a FilterableMachineCollection containing only the Machines that match any of the given MachineFilters
func (FilterableMachineCollection) DeepCopy ¶
func (s FilterableMachineCollection) DeepCopy() FilterableMachineCollection
DeepCopy returns a deep copy
func (FilterableMachineCollection) Filter ¶
func (s FilterableMachineCollection) Filter(filters ...machinefilters.Func) FilterableMachineCollection
Filter returns a FilterableMachineCollection containing only the Machines that match all of the given MachineFilters
func (FilterableMachineCollection) Insert ¶
func (s FilterableMachineCollection) Insert(machines ...*clusterv1.Machine) FilterableMachineCollection
Insert adds items to the set.
func (FilterableMachineCollection) Len ¶
func (s FilterableMachineCollection) Len() int
Len returns the size of the set.
func (FilterableMachineCollection) Oldest ¶
func (s FilterableMachineCollection) Oldest() *clusterv1.Machine
Oldest returns the Machine with the oldest CreationTimestamp
type HealthCheckResult ¶
HealthCheckResult maps nodes that are checked to any errors the node has related to the check.
type Management ¶
type Management struct {
Client ctrlclient.Client
}
Management holds operations on the management cluster.
func (*Management) GetMachinesForCluster ¶
func (m *Management) GetMachinesForCluster(ctx context.Context, cluster client.ObjectKey, filters ...machinefilters.Func) (FilterableMachineCollection, error)
GetMachinesForCluster returns a list of machines that can be filtered or not. If no filter is supplied then all machines associated with the target cluster are returned.
func (*Management) GetWorkloadCluster ¶
func (m *Management) GetWorkloadCluster(ctx context.Context, clusterKey client.ObjectKey) (WorkloadCluster, error)
GetWorkloadCluster builds a cluster object. The cluster comes with an etcd client generator to connect to any etcd pod living on a managed machine.
func (*Management) TargetClusterControlPlaneIsHealthy ¶
func (m *Management) TargetClusterControlPlaneIsHealthy(ctx context.Context, clusterKey client.ObjectKey, controlPlaneName string) error
TargetClusterControlPlaneIsHealthy checks every node for control plane health.
func (*Management) TargetClusterEtcdIsHealthy ¶
func (m *Management) TargetClusterEtcdIsHealthy(ctx context.Context, clusterKey client.ObjectKey, controlPlaneName string) error
TargetClusterEtcdIsHealthy runs a series of checks over a target cluster's etcd cluster. In addition, it verifies that there are the same number of etcd members as control plane Machines.
type ManagementCluster ¶
type ManagementCluster interface {
GetMachinesForCluster(ctx context.Context, cluster client.ObjectKey, filters ...machinefilters.Func) (FilterableMachineCollection, error)
TargetClusterEtcdIsHealthy(ctx context.Context, clusterKey client.ObjectKey, controlPlaneName string) error
TargetClusterControlPlaneIsHealthy(ctx context.Context, clusterKey client.ObjectKey, controlPlaneName string) error
GetWorkloadCluster(ctx context.Context, clusterKey client.ObjectKey) (WorkloadCluster, error)
}
ManagementCluster defines all behaviors necessary for something to function as a management cluster.
type Workload ¶
type Workload struct {
Client ctrlclient.Client
CoreDNSMigrator coreDNSMigrator
// contains filtered or unexported fields
}
Workload defines operations on workload clusters.
func (*Workload) ClusterStatus ¶
func (w *Workload) ClusterStatus(ctx context.Context) (ClusterStatus, error)
ClusterStatus returns the status of the cluster.
func (*Workload) ControlPlaneIsHealthy ¶
func (w *Workload) ControlPlaneIsHealthy(ctx context.Context) (HealthCheckResult, error)
controlPlaneIsHealthy does a best effort check of the control plane components the kubeadm control plane cares about. The return map is a map of node names as keys to error that that node encountered. All nodes will exist in the map with nil errors if there were no errors for that node.
func (*Workload) EtcdIsHealthy ¶
func (w *Workload) EtcdIsHealthy(ctx context.Context) (HealthCheckResult, error)
EtcdIsHealthy runs checks for every etcd member in the cluster to satisfy our definition of healthy. This is a best effort check and nodes can become unhealthy after the check is complete. It is not a guarantee. It's used a signal for if we should allow a target cluster to scale up, scale down or upgrade. It returns a map of nodes checked along with an error for a given node.
func (*Workload) ReconcileKubeletRBACBinding ¶
ReconcileKubeletRBACBinding will create a RoleBinding for the new kubelet version during upgrades. If the role binding already exists this function is a no-op.
func (*Workload) ReconcileKubeletRBACRole ¶
ReconcileKubeletRBACRole will create a Role for the new kubelet version during upgrades. If the role already exists this function is a no-op.
func (*Workload) RemoveEtcdMemberForMachine ¶
func (w *Workload) RemoveEtcdMemberForMachine(ctx context.Context, machine *clusterv1.Machine) error
RemoveEtcdMemberForMachine removes the etcd member from the target cluster's etcd cluster.
func (*Workload) RemoveMachineFromKubeadmConfigMap ¶
func (w *Workload) RemoveMachineFromKubeadmConfigMap(ctx context.Context, machine *clusterv1.Machine) error
RemoveMachineFromKubeadmConfigMap removes the entry for the machine from the kubeadm configmap.
func (*Workload) UpdateCoreDNS ¶
func (w *Workload) UpdateCoreDNS(ctx context.Context, kcp *controlplanev1.KubeadmControlPlane) error
UpdateCoreDNS updates the kubeadm configmap, coredns corefile and coredns deployment.
func (*Workload) UpdateEtcdVersionInKubeadmConfigMap ¶
func (w *Workload) UpdateEtcdVersionInKubeadmConfigMap(ctx context.Context, imageRepository, imageTag string) error
UpdateEtcdVersionInKubeadmConfigMap sets the imageRepository or the imageTag or both in the kubeadm config map.
func (*Workload) UpdateKubeProxyImageInfo ¶
func (w *Workload) UpdateKubeProxyImageInfo(ctx context.Context, kcp *controlplanev1.KubeadmControlPlane) error
UpdateKubeProxyImageInfo updates kube-proxy image in the kube-proxy DaemonSet.
func (*Workload) UpdateKubeletConfigMap ¶
UpdateKubeletConfigMap will create a new kubelet-config-1.x config map for a new version of the kubelet. This is a necessary process for upgrades.
type WorkloadCluster ¶
type WorkloadCluster interface {
ClusterStatus(ctx context.Context) (ClusterStatus, error)
ControlPlaneIsHealthy(ctx context.Context) (HealthCheckResult, error)
EtcdIsHealthy(ctx context.Context) (HealthCheckResult, error)
// Behaviors necessary for upgrade
ReconcileKubeletRBACBinding(ctx context.Context, version semver.Version) error
ReconcileKubeletRBACRole(ctx context.Context, version semver.Version) error
UpdateKubernetesVersionInKubeadmConfigMap(ctx context.Context, version semver.Version) error
UpdateEtcdVersionInKubeadmConfigMap(ctx context.Context, imageRepository, imageTag string) error
UpdateKubeletConfigMap(ctx context.Context, version semver.Version) error
UpdateKubeProxyImageInfo(ctx context.Context, kcp *controlplanev1.KubeadmControlPlane) error
UpdateCoreDNS(ctx context.Context, kcp *controlplanev1.KubeadmControlPlane) error
RemoveEtcdMemberForMachine(ctx context.Context, machine *clusterv1.Machine) error
RemoveMachineFromKubeadmConfigMap(ctx context.Context, machine *clusterv1.Machine) error
}
WorkloadCluster defines all behaviors necessary to upgrade kubernetes on a workload cluster