framework

package
v0.0.0-...-4378d2d Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CAPINamespace                      = "openshift-cluster-api"
	CAPIOperatorNamespace              = "openshift-cluster-api-operator"
	CompatibilityRequirementsNamespace = "openshift-compatibility-requirements-operator"
	MAPINamespace                      = "openshift-machine-api"

	RetryShort  = 1 * time.Second
	RetryMedium = 5 * time.Second
	RetryLong   = 10 * time.Second
)

Variables

View Source
var (
	WaitShort    = 1 * time.Minute
	WaitMedium   = 3 * time.Minute
	WaitLong     = 15 * time.Minute
	WaitOverLong = 30 * time.Minute
)

Functions

func CreateCoreCluster

func CreateCoreCluster(ctx context.Context, cl client.Client, clusterName, infraClusterKind string) *clusterv1.Cluster

CreateCoreCluster creates a cluster with the given name and returns the cluster object.

func CreateMachineSet

func CreateMachineSet(ctx context.Context, cl client.Client, params machineSetParams) *clusterv1.MachineSet

CreateMachineSet creates a new CAPI MachineSet resource.

func DeleteMachineSets

func DeleteMachineSets(ctx context.Context, cl client.Client, machineSets ...*clusterv1.MachineSet)

func DeleteMachines

func DeleteMachines(ctx context.Context, cl client.Client, namespace string, machines ...*clusterv1.Machine)

DeleteMachines deletes the specified machines.

func DeleteObjects

func DeleteObjects(ctx context.Context, cl client.Client, objs ...client.Object)

DeleteObjects deletes the objects in the given list, tolerating NotFound errors.

func GetAWSMachine

func GetAWSMachine(name string, namespace string) (*awsv1.AWSMachine, error)

GetAWSMachine gets an AWSMachine by its name.

func GetAWSMachineWithRetry

func GetAWSMachineWithRetry(name string, namespace string) *awsv1.AWSMachine

GetAWSMachineWithRetry gets an AWSMachine by its name, retrying until found or timeout.

func GetControlPlaneHostAndPort

func GetControlPlaneHostAndPort(ctx context.Context, cl client.Client) (string, int32, error)

func GetFirstMAPIMachineSet

func GetFirstMAPIMachineSet(ctx context.Context, cl client.Client) *mapiv1beta1.MachineSet

GetFirstMAPIMachineSet lists MAPI MachineSets, sorts by name, and returns the first one.

func GetMAPIProviderSpec

func GetMAPIProviderSpec[T any](ctx context.Context, cl client.Client) *T

GetMAPIProviderSpec lists MAPI MachineSets, sorts by name, and unmarshals the first MachineSet's ProviderSpec into the given type T.

func GetMachine

func GetMachine(name string, namespace string) (*clusterv1.Machine, error)

GetMachine gets a machine by its name.

func GetMachineSet

func GetMachineSet(name string, namespace string) (*clusterv1.MachineSet, error)

GetMachineSet gets a machineset by its name.

func GetMachineSetWithRetry

func GetMachineSetWithRetry(name string, namespace string) *clusterv1.MachineSet

GetMachineSetWithRetry gets a machineset by its name, retrying until found or timeout.

func GetMachineWithRetry

func GetMachineWithRetry(name string, namespace string) *clusterv1.Machine

GetMachineWithRetry gets a machine by its name, retrying until found or timeout.

func GetMachines

func GetMachines(selectors ...*metav1.LabelSelector) []*clusterv1.Machine

GetMachines gets a list of machines from the default cluster API namespace. Optionally, labels may be used to constrain listed machines.

func GetMachinesFromMachineSet

func GetMachinesFromMachineSet(machineSet *clusterv1.MachineSet) []*clusterv1.Machine

GetMachinesFromMachineSet returns an array of machines owned by a given machineSet.

func GetNewestMachineFromMachineSet

func GetNewestMachineFromMachineSet(machineSet *clusterv1.MachineSet) *clusterv1.Machine

GetNewestMachineFromMachineSet returns the newest machine created by a given machineSet.

func GetNodeForMachine

func GetNodeForMachine(ctx context.Context, cl client.Client, m *clusterv1.Machine) (*corev1.Node, error)

GetNodeForMachine retrieves the node backing the given Machine.

func IsFeatureGateEnabled

func IsFeatureGateEnabled(ctx context.Context, cl client.Client, name configv1.FeatureGateName) bool

IsFeatureGateEnabled checks if the named feature gate is enabled for the current cluster version.

func NewMachineSetParams

func NewMachineSetParams(msName, clusterName, failureDomain string, replicas int32, infrastructureRef clusterv1.ContractVersionedObjectReference, userDataSecretName string) machineSetParams

NewMachineSetParams returns a new machineSetParams object.

func ScaleCAPIMachineSet

func ScaleCAPIMachineSet(name string, replicas int32, namespace string)

ScaleCAPIMachineSet scales a machineSet with a given name to the given number of replicas.

func SortListByName

func SortListByName(list client.ObjectList)

SortListByName sorts the Items of a Kubernetes list object in place by metadata name.

func WaitForMachineSet

func WaitForMachineSet(ctx context.Context, cl client.Client, name string, namespace string, timeout ...time.Duration)

WaitForMachineSet waits for all Machines belonging to the named MachineSet to enter the "Running" phase, and for all nodes belonging to those Machines to be ready.

func WaitForMachineSetsDeleted

func WaitForMachineSetsDeleted(machineSets ...*clusterv1.MachineSet)

WaitForMachineSetsDeleted polls until the given MachineSets are not found, and there are zero Machines found matching the MachineSet's label selector.

Types

This section is empty.

Jump to

Keyboard shortcuts

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