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 HasDeletionTimestamp(machine *clusterv1.Machine) bool
- func PickFewest(failureDomains clusterv1.FailureDomains, machines FilterableMachineCollection) *string
- func PickMost(failureDomains clusterv1.FailureDomains, machines FilterableMachineCollection) *string
- type Cluster
- func (c *Cluster) ClusterStatus(ctx context.Context) (ClusterStatus, error)
- func (c *Cluster) ReconcileKubeletRBACBinding(ctx context.Context, version semver.Version) error
- func (c *Cluster) ReconcileKubeletRBACRole(ctx context.Context, version semver.Version) error
- func (c *Cluster) RemoveEtcdMemberForMachine(ctx context.Context, machine *clusterv1.Machine) error
- func (c *Cluster) RemoveMachineFromKubeadmConfigMap(ctx context.Context, machine *clusterv1.Machine) error
- func (c *Cluster) UpdateKubeletConfigMap(ctx context.Context, version semver.Version) error
- func (c *Cluster) UpdateKubernetesVersionInKubeadmConfigMap(ctx context.Context, version string) error
- type ClusterStatus
- type FilterableMachineCollection
- func (s FilterableMachineCollection) AnyFilter(filters ...MachineFilter) FilterableMachineCollection
- func (s FilterableMachineCollection) DeepCopy() FilterableMachineCollection
- func (s FilterableMachineCollection) Filter(filters ...MachineFilter) FilterableMachineCollection
- func (s FilterableMachineCollection) Insert(machines ...*clusterv1.Machine) FilterableMachineCollection
- func (s FilterableMachineCollection) Len() int
- func (s FilterableMachineCollection) Oldest() *clusterv1.Machine
- type MachineFilter
- func And(filters ...MachineFilter) MachineFilter
- func HasAnnotationKey(key string) MachineFilter
- func InFailureDomains(failureDomains ...*string) MachineFilter
- func MatchesConfigurationHash(configHash string) MachineFilter
- func Not(mf MachineFilter) MachineFilter
- func OlderThan(t *metav1.Time) MachineFilter
- func Or(filters ...MachineFilter) MachineFilter
- func OwnedControlPlaneMachines(controlPlaneName string) MachineFilter
- type ManagementCluster
- func (m *ManagementCluster) GetEtcdCerts(ctx context.Context, cluster client.ObjectKey) ([]byte, []byte, error)
- func (m *ManagementCluster) GetMachinesForCluster(ctx context.Context, cluster client.ObjectKey, filters ...MachineFilter) (FilterableMachineCollection, error)
- func (m *ManagementCluster) GetWorkloadCluster(ctx context.Context, clusterKey client.ObjectKey) (*Cluster, error)
- func (m *ManagementCluster) TargetClusterControlPlaneIsHealthy(ctx context.Context, clusterKey client.ObjectKey, controlPlaneName string) error
- func (m *ManagementCluster) TargetClusterEtcdIsHealthy(ctx context.Context, clusterKey client.ObjectKey, controlPlaneName string) error
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 HasDeletionTimestamp ¶
HasDeletionTimestamp is a MachineFilter to find all machines that have a deletion timestamp.
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 Cluster ¶
type Cluster struct { Client ctrlclient.Client EtcdClientGenerator etcdClientFor }
Cluster are operations on workload clusters.
func (*Cluster) ClusterStatus ¶
func (c *Cluster) ClusterStatus(ctx context.Context) (ClusterStatus, error)
ClusterStatus returns the status of the cluster.
func (*Cluster) 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 (*Cluster) 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 (*Cluster) RemoveEtcdMemberForMachine ¶
RemoveEtcdMemberForMachine removes the etcd member from the target cluster's etcd cluster.
func (*Cluster) RemoveMachineFromKubeadmConfigMap ¶
func (c *Cluster) RemoveMachineFromKubeadmConfigMap(ctx context.Context, machine *clusterv1.Machine) error
RemoveMachineFromKubeadmConfigMap removes the entry for the machine from the kubeadm configmap.
func (*Cluster) 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 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 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 ...MachineFilter) 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 ...MachineFilter) 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 MachineFilter ¶
func And ¶
func And(filters ...MachineFilter) MachineFilter
And returns a MachineFilter function that returns true if all of the given MachineFilters returns true
func HasAnnotationKey ¶
func HasAnnotationKey(key string) MachineFilter
HasAnnotationKey returns a MachineFilter function to find all machines that have the specified Annotation key present
func InFailureDomains ¶
func InFailureDomains(failureDomains ...*string) MachineFilter
InFailureDomains returns a MachineFilter function to find all machines in any of the given failure domains
func MatchesConfigurationHash ¶
func MatchesConfigurationHash(configHash string) MachineFilter
MatchesConfigurationHash returns a MachineFilter function to find all machines that match a given KubeadmControlPlane configuration hash.
func Not ¶
func Not(mf MachineFilter) MachineFilter
Not returns a MachineFilter function that returns the opposite of the given MachineFilter
func OlderThan ¶
func OlderThan(t *metav1.Time) MachineFilter
OlderThan returns a MachineFilter function to find all machines that have a CreationTimestamp earlier than the given time.
func Or ¶
func Or(filters ...MachineFilter) MachineFilter
Or returns a MachineFilter function that returns true if any of the given MachineFilters returns true
func OwnedControlPlaneMachines ¶
func OwnedControlPlaneMachines(controlPlaneName string) MachineFilter
OwnedControlPlaneMachines returns a MachineFilter function to find all owned control plane machines. Usage: managementCluster.GetMachinesForCluster(ctx, cluster, OwnedControlPlaneMachines(controlPlane.Name))
type ManagementCluster ¶
type ManagementCluster struct {
Client ctrlclient.Client
}
ManagementCluster holds operations on the ManagementCluster.
func (*ManagementCluster) GetEtcdCerts ¶
func (m *ManagementCluster) GetEtcdCerts(ctx context.Context, cluster client.ObjectKey) ([]byte, []byte, error)
GetEtcdCerts returns the EtcdCA Cert and Key for a given cluster.
func (*ManagementCluster) GetMachinesForCluster ¶
func (m *ManagementCluster) GetMachinesForCluster(ctx context.Context, cluster client.ObjectKey, filters ...MachineFilter) (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 (*ManagementCluster) GetWorkloadCluster ¶
func (m *ManagementCluster) GetWorkloadCluster(ctx context.Context, clusterKey client.ObjectKey) (*Cluster, 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 (*ManagementCluster) TargetClusterControlPlaneIsHealthy ¶
func (m *ManagementCluster) TargetClusterControlPlaneIsHealthy(ctx context.Context, clusterKey client.ObjectKey, controlPlaneName string) error
TargetClusterControlPlaneIsHealthy checks every node for control plane health.
func (*ManagementCluster) TargetClusterEtcdIsHealthy ¶
func (m *ManagementCluster) 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.