Documentation ¶
Overview ¶
Package collections implements collection utilities.
Index ¶
- func ActiveMachines(machine *clusterv1.Machine) bool
- func AdoptableControlPlaneMachines(clusterName string) func(machine *clusterv1.Machine) bool
- func ControlPlaneMachines(clusterName string) func(machine *clusterv1.Machine) bool
- func ControlPlaneSelectorForCluster(clusterName string) labels.Selector
- func HasControllerRef(machine *clusterv1.Machine) bool
- func HasDeletionTimestamp(machine *clusterv1.Machine) bool
- func HasUnhealthyCondition(machine *clusterv1.Machine) bool
- func OwnedMachines(owner client.Object) func(machine *clusterv1.Machine) bool
- func ToMachineList(machines Machines) clusterv1.MachineList
- type Func
- func And(filters ...Func) Func
- func HasAnnotationKey(key string) Func
- func HasNode() Func
- func HasUnhealthyControlPlaneComponents(isEtcdManaged bool) Func
- func HealthyAPIServer() Func
- func InFailureDomains(failureDomains ...*string) Func
- func IsReady() Func
- func MatchesKubernetesVersion(kubernetesVersion string) Func
- func Not(mf Func) Func
- func Or(filters ...Func) Func
- func ShouldRolloutAfter(reconciliationTime, rolloutAfter *metav1.Time) Func
- func ShouldRolloutBefore(reconciliationTime *metav1.Time, rolloutBefore *controlplanev1.RolloutBefore) Func
- func WithVersion() Func
- type Machines
- func (s Machines) AnyFilter(filters ...Func) Machines
- func (s Machines) ConditionGetters() []conditions.Getter
- func (s Machines) DeepCopy() Machines
- func (s Machines) Difference(machines Machines) Machines
- func (s Machines) Filter(filters ...Func) Machines
- func (s Machines) Insert(machines ...*clusterv1.Machine)
- func (s Machines) Len() int
- func (s Machines) LowestVersion() *string
- func (s Machines) Names() []string
- func (s Machines) Newest() *clusterv1.Machine
- func (s Machines) Oldest() *clusterv1.Machine
- func (s Machines) SortedByCreationTimestamp() []*clusterv1.Machine
- func (s Machines) UnsortedList() []*clusterv1.Machine
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ActiveMachines ¶
ActiveMachines returns a filter to find all active machines. Usage: GetFilteredMachinesForCluster(ctx, client, cluster, ActiveMachines).
func AdoptableControlPlaneMachines ¶
AdoptableControlPlaneMachines returns a filter to find all un-controlled control plane machines. Usage: GetFilteredMachinesForCluster(ctx, client, cluster, AdoptableControlPlaneMachines(cluster.Name, controlPlane)).
func ControlPlaneMachines ¶
ControlPlaneMachines returns a filter to find all control plane machines for a cluster, regardless of ownership. Usage: GetFilteredMachinesForCluster(ctx, client, cluster, ControlPlaneMachines(cluster.Name)).
func ControlPlaneSelectorForCluster ¶
ControlPlaneSelectorForCluster returns the label selector necessary to get control plane machines for a given cluster.
func HasControllerRef ¶
HasControllerRef is a filter that returns true if the machine has a controller ref.
func HasDeletionTimestamp ¶
HasDeletionTimestamp returns a filter to find all machines that have a deletion timestamp.
func HasUnhealthyCondition ¶
HasUnhealthyCondition returns a filter to find all machines that have a MachineHealthCheckSucceeded condition set to False, indicating a problem was detected on the machine, and the MachineOwnerRemediated condition set, indicating that KCP is responsible of performing remediation as owner of the machine.
func OwnedMachines ¶
OwnedMachines returns a filter to find all machines owned by specified owner. Usage: GetFilteredMachinesForCluster(ctx, client, cluster, OwnedMachines(controlPlane)).
func ToMachineList ¶
func ToMachineList(machines Machines) clusterv1.MachineList
ToMachineList creates a MachineList from the given Machines.
Types ¶
type Func ¶
Func is the functon definition for a filter.
func HasAnnotationKey ¶
HasAnnotationKey returns a filter to find all machines that have the specified Annotation key present.
func HasNode ¶ added in v1.7.0
func HasNode() Func
HasNode returns a filter to find all machines that have a corresponding Kubernetes node.
func HasUnhealthyControlPlaneComponents ¶ added in v1.6.4
HasUnhealthyControlPlaneComponents returns a filter to find all unhealthy control plane machines that have any of the following control plane component conditions set to False: APIServerPodHealthy, ControllerManagerPodHealthy, SchedulerPodHealthy, EtcdPodHealthy & EtcdMemberHealthy (if using managed etcd). It is different from the HasUnhealthyCondition func which checks MachineHealthCheck conditions.
func HealthyAPIServer ¶ added in v0.4.1
func HealthyAPIServer() Func
HealthyAPIServer returns a filter to find all machines that have a MachineAPIServerPodHealthyCondition set to true.
func InFailureDomains ¶
InFailureDomains returns a filter to find all machines in any of the given failure domains.
func IsReady ¶
func IsReady() Func
IsReady returns a filter to find all machines with the ReadyCondition equals to True.
func MatchesKubernetesVersion ¶
MatchesKubernetesVersion returns a filter to find all machines that match a given Kubernetes version.
func ShouldRolloutAfter ¶
ShouldRolloutAfter returns a filter to find all machines where CreationTimestamp < rolloutAfter < reconciliationTIme.
func ShouldRolloutBefore ¶ added in v1.3.0
func ShouldRolloutBefore(reconciliationTime *metav1.Time, rolloutBefore *controlplanev1.RolloutBefore) Func
ShouldRolloutBefore returns a filter to find all machine whose certificates will expire within the specified days.
func WithVersion ¶ added in v0.4.1
func WithVersion() Func
WithVersion returns a filter to find machine that have a non empty and valid version.
type Machines ¶
Machines is a set of Machines.
func FromMachineList ¶
func FromMachineList(machineList *clusterv1.MachineList) Machines
FromMachineList creates a Machines from the given MachineList.
func FromMachines ¶
FromMachines creates a Machines from a list of values.
func GetFilteredMachinesForCluster ¶
func GetFilteredMachinesForCluster(ctx context.Context, c client.Reader, cluster *clusterv1.Cluster, filters ...Func) (Machines, error)
GetFilteredMachinesForCluster 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 (Machines) AnyFilter ¶
AnyFilter returns a Machines containing only the Machines that match any of the given MachineFilters.
func (Machines) ConditionGetters ¶
func (s Machines) ConditionGetters() []conditions.Getter
ConditionGetters returns the slice with machines converted into conditions.Getter.
func (Machines) Difference ¶
Difference returns a copy without machines that are in the given collection.
func (Machines) Filter ¶
Filter returns a Machines containing only the Machines that match all of the given MachineFilters.
func (Machines) LowestVersion ¶ added in v0.4.1
LowestVersion returns the lowest version among all the machine with defined versions. If no machine has a defined version it returns an empty string.
func (Machines) Names ¶
Names returns a slice of the names of each machine in the collection. Useful for logging and test assertions.
func (Machines) SortedByCreationTimestamp ¶
SortedByCreationTimestamp returns the machines sorted by creation timestamp.
func (Machines) UnsortedList ¶
UnsortedList returns the slice with contents in random order.