machine_config

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2026 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyMachineConfigurationFixture

func ApplyMachineConfigurationFixture(oc *exutil.CLI, fixture string)

Applies a boot image fixture and waits for the MCO to reconcile the status

func CheckMCNConditionStatus

func CheckMCNConditionStatus(mcn *mcfgv1.MachineConfigNode, conditionType mcfgv1.StateProgress, status metav1.ConditionStatus) bool

`CheckMCNConditionStatus` checks that an MCN condition matches the desired status (ex. confirm "Updated" is "False")

func CleanupCreatedNode

func CleanupCreatedNode(oc *exutil.CLI, machineSetName string, desiredReplicaValue int, nodeName string, cleanupCompleted bool) error

`CleanupCreatedNode` scales down the replica count for a given MachineSet and checks whether the created Node provided is deleted.

func CleanupCustomMCP

func CleanupCustomMCP(oc *exutil.CLI, clientSet *machineconfigclient.Clientset, customMCPName string, nodeName string, mcName *string) error

`CleanupCustomMCP` cleans up a custom MCP through the following steps:

  1. Remove the custom MCP role label from the node
  2. Wait for the custom MCP to be updated with no ready machines
  3. Optionally, if a MC has been provided, delete it; if none has been provided, skip to step 4
  4. Wait for the node to have a current config version equal to the config version of the worker MCP
  5. Remove the custom MCP

func CleanupProvisionedMachine

func CleanupProvisionedMachine(oc *exutil.CLI, machineClient *machineclient.Clientset, machineSetName string, desiredReplicaValue int,
	machineName string, cleanupCompleted bool) error

`CleanupProvisionedMachine` scales down the replica count for a given MachineSet and checks whether the provisioned Machine provided is deleted.

func ConfirmUpdatedMCNStatus

func ConfirmUpdatedMCNStatus(clientSet *machineconfigclient.Clientset, mcnName string) bool

`ConfirmUpdatedMCNStatus` confirms that an MCN is in a fully updated state, which requires:

  1. "Updated" = True
  2. All other conditions = False

func ExecCmdOnNode

func ExecCmdOnNode(oc *exutil.CLI, node corev1.Node, subArgs ...string) string

ExecCmdOnNode finds a node's mcd, and oc rsh's into it to execute a command on the node all commands should use /rootfs as root

func ExecCmdOnNodeWithError

func ExecCmdOnNodeWithError(oc *exutil.CLI, node corev1.Node, subArgs ...string) (string, error)

ExecCmdOnNodeWithError behaves like ExecCmdOnNode, with the exception that any errors are returned to the caller for inspection. This allows one to execute a command that is expected to fail; e.g., stat /nonexistant/file.

func FindClusterOperatorStatusCondition

FindClusterOperatorStatusCondition finds the conditionType in conditions.

func GCPISTest

func GCPISTest(oc *exutil.CLI, kubeClient *kubernetes.Clientset, clientSet *mcClient.Clientset, success bool, nodeName, customGcKCFixture, gcImage, pisName string, isMetalDisconnected bool)

`GCPISTest` completes the body of a PIS test including the garbage collection step

func GetAllNodes

func GetAllNodes(oc *exutil.CLI) ([]corev1.Node, error)

`GetAllNodes` gets all nodes from a cluster

func GetDegradedNode

func GetDegradedNode(oc *exutil.CLI, mcpName string) (corev1.Node, error)

`GetDegradedNode` gets a degraded node from a specified MCP

func GetMCNCondition

func GetMCNCondition(mcn *mcfgv1.MachineConfigNode, conditionType mcfgv1.StateProgress) *metav1.Condition

`GetMCNCondition` returns the queried condition or nil if the condition does not exist

func GetMachinesByPhase

func GetMachinesByPhase(machineClient *machineclient.Clientset, machineSetName string, desiredPhase string) (machinev1beta1.Machine, error)

`GetMachinesByPhase` get machine by phase e.g. Running, Provisioning, Provisioned, Deleting etc.

func GetNewReadyNodeInMachine

func GetNewReadyNodeInMachine(oc *exutil.CLI, machineName string) (corev1.Node, error)

`GetNewReadyNodeInMachine` waits up to 4 minutes for the newly provisioned node in a desired machine node to be ready

func GetNodeInMachine

func GetNodeInMachine(oc *exutil.CLI, machineName string) (corev1.Node, error)

`GetNodeInMachine` gets the node associated with a machine

func GetNodesByRole

func GetNodesByRole(oc *exutil.CLI, role string) ([]corev1.Node, error)

`GetNodesByRole` gets all nodes labeled with the desired role

func GetRandomNode

func GetRandomNode(oc *exutil.CLI, role string) corev1.Node

`GetRandomNode` gets a random node from with a given role and checks whether the node is ready. If no nodes are ready, it will wait for up to 5 minutes for a node to become available.

func GetRolesToTest

func GetRolesToTest(oc *exutil.CLI, machineConfigClient *machineconfigclient.Clientset) []string

`GetRolesToTest` gets the MCPs in a cluster with nodes associated to it. This allows a more robust way to determine the roles to use when selecting nodes and testing their MCP associations in an MCN.

func GetUpdatingNode

func GetUpdatingNode(oc *exutil.CLI, mcpName, originalConfigVersion string) corev1.Node

`GetUpdatingNode` returns the updating node, determined by the node targetting a new desired config, when the corresponding MCP starts updating

func IsClusterOperatorConditionFalse

func IsClusterOperatorConditionFalse(conditions []osconfigv1.ClusterOperatorStatusCondition, conditionType osconfigv1.ClusterStatusConditionType) bool

IsClusterOperatorConditionFalse returns true when the conditionType is present and set to `configv1.ConditionFalse`

func IsClusterOperatorConditionPresentAndEqual

func IsClusterOperatorConditionPresentAndEqual(conditions []osconfigv1.ClusterOperatorStatusCondition, conditionType osconfigv1.ClusterStatusConditionType, status osconfigv1.ConditionStatus) bool

IsClusterOperatorConditionPresentAndEqual returns true when conditionType is present and equal to status.

func IsClusterOperatorConditionTrue

func IsClusterOperatorConditionTrue(conditions []osconfigv1.ClusterOperatorStatusCondition, conditionType osconfigv1.ClusterStatusConditionType) bool

IsClusterOperatorConditionTrue returns true when the conditionType is present and set to `configv1.ConditionTrue`

func IsDisconnected

func IsDisconnected(oc *exutil.CLI, nodeName string) bool

`IsDisconnected` returns true if the cluster is a Disconnected cluster and false otherwise

func IsMachineConfigPoolConditionTrue

func IsMachineConfigPoolConditionTrue(conditions []mcfgv1.MachineConfigPoolCondition, conditionType mcfgv1.MachineConfigPoolConditionType) bool

IsMachineConfigPoolConditionTrue returns true when the conditionType is present and set to `ConditionTrue`

func IsMachineConfigurationConditionFalse

func IsMachineConfigurationConditionFalse(conditions []metav1.Condition, conditionType string) bool

IsMachineConfigurationConditionFalse returns false when the conditionType is present and set to `ConditionFalse`

func IsMetal

func IsMetal(oc *exutil.CLI) bool

`IsMetal` returns true if the cluster is hosted on a Metal Platform and false otherwise

func IsNodeReady

func IsNodeReady(node corev1.Node) bool

`isNodeReady` determines if a given node is ready

func IsSingleNode

func IsSingleNode(oc *exutil.CLI) bool

`IsSingleNode` returns true if the cluster is using single-node topology and false otherwise

func IsTwoNode

func IsTwoNode(oc *exutil.CLI) bool

`IsTwoNode` returns true if the cluster is using two-node topology and false otherwise

func IsTwoNodeArbiter

func IsTwoNodeArbiter(oc *exutil.CLI) bool

`IsTwoNodeArbiter` returns true if the cluster is using two-node arbiter topology and false otherwise

func RecoverFromDegraded

func RecoverFromDegraded(oc *exutil.CLI, mcpName string) error

`RecoverFromDegraded` gets the degraded node in the desired MCP, forces the node to recover by updating its desired config to be its current config, and waits for the MCP to return to an Update=True state

func ScaleMachineSet

func ScaleMachineSet(oc *exutil.CLI, machineSetName string, replicaValue string) error

`ScaleMachineSet` scales the provided MachineSet by updating the replica to be the provided value

func ScaleMachineSetDown

func ScaleMachineSetDown(oc *exutil.CLI, machineSet machinev1beta1.MachineSet, desiredReplicaValue int, cleanupCompleted bool) error

`ScaleMachineSetDown` will determine whether a MachineSet needs to be scaled and, if so, will scale it. A MachineSet needs to be scaled if its desired replica value does not match its current replica value.

func SimplePISTest

func SimplePISTest(oc *exutil.CLI, kubeClient *kubernetes.Clientset, clientSet *mcClient.Clientset, success bool, pisName string, isMetalDisconnected bool)

`GCPISTest` completes the body of a PIS test, validating that the conditions are met for cases where the PIS was expected to be successful and cases where the PIS applied was invalid

func SkipWhenFeatureGateEnabled

func SkipWhenFeatureGateEnabled(configClient configv1client.Interface, featureGate osconfigv1.FeatureGateName)

`SkipWhenFeatureGateEnabled` skips a test if the desired feature gate provided as a parameter is enabled in the test cluster.

func UpdateDeleteMachineAnnotation

func UpdateDeleteMachineAnnotation(oc *exutil.CLI, machineSetName string) error

`UpdateDeleteMachineAnnotation` updates the provided MachineSet's `deletePolicy` to be true. This will ensure the create machine is the one deleted on cleanup.

func ValidateMCNConditionOnNodeDegrade

func ValidateMCNConditionOnNodeDegrade(oc *exutil.CLI, fixture string, isSno bool)

`ValidateMCNConditionOnNodeDegrade` checks that Conditions properly update on a node failure (MCP degrade)

func ValidateMCNConditionTransitionsOnRebootlessUpdate

func ValidateMCNConditionTransitionsOnRebootlessUpdate(oc *exutil.CLI, clientSet *machineconfigclient.Clientset, nodeDisruptionFixture string, nodeDisruptionEmptyFixture string, mcFixture string, mcpFixture string)

`ValidateMCNConditionTransitionsOnRebootlessUpdate` checks that the `Conditions` in an MCN properly update on a node update in a custom MCP. The steps of this function are:

  1. Apply a node disruption policy
  2. Create a custom MCP with one node
  3. Apply a MC
  4. Validate the MCN conditions transition as expected throughout the update
  5. Clean up the test resources

func ValidateMCNConditionTransitionsOnRebootlessUpdateMaster

func ValidateMCNConditionTransitionsOnRebootlessUpdateMaster(oc *exutil.CLI, clientSet *machineconfigclient.Clientset, nodeDisruptionFixture string, nodeDisruptionEmptyFixture string, mcFixture string)

`ValidateMCNConditionTransitionsOnRebootlessUpdateMaster` checks that the `Conditions` in an MCN properly update on a node update in the master MCP. The steps of this function are:

  1. Apply a node disruption policy
  2. Apply a MC
  3. Get the updating node
  4. Validate the MCN conditions transition as expected throughout the update
  5. Clean up the test resources

func ValidateMCNForNodeInPool

func ValidateMCNForNodeInPool(oc *exutil.CLI, clientSet *machineconfigclient.Clientset, node corev1.Node, poolName string) error

`ValidateMCNForNodeInPool` validates the MCN of a node in a given pool. It does the following:

  1. Get node from desired pool
  2. Get the MCN for the node
  3. Validate the MCN against the node properties - Check that `mcn.Spec.Pool.Name` matches provided `poolName` - Check that `mcn.Name` matches the node name - Check that `mcn.Spec.ConfigVersion.Desired` matches the node desired config version - Check that `nmcn.Status.ConfigVersion.Current` matches the node current config version - Check that `mcn.Status.ConfigVersion.Desired` matches the node desired config version

func ValidateMCNOnNodeCreationAndDeletion

func ValidateMCNOnNodeCreationAndDeletion(oc *exutil.CLI)

`ValidateMCNProperties` checks that MCNs with correct properties are created on node creation and deleted on node deletion

func ValidateMCNPropertiesByMCPs

func ValidateMCNPropertiesByMCPs(oc *exutil.CLI)

`ValidateMCNPropertiesByMCPs` checks that MCN properties match the corresponding node properties for a random node in each MCP in the cluster with nodes.

func ValidateMCNPropertiesCustomMCP

func ValidateMCNPropertiesCustomMCP(oc *exutil.CLI, fixture string)

`ValidateMCNPropertiesCustomMCP` checks that MCN properties match the corresponding node properties

func ValidateMCNScopeHappyPathTest

func ValidateMCNScopeHappyPathTest(oc *exutil.CLI)

`ValidateMCNScopeHappyPathTest` checks that MCN updates from the associated MCD are allowed

func ValidateMCNScopeImpersonationPathTest

func ValidateMCNScopeImpersonationPathTest(oc *exutil.CLI)

`ValidateMCNScopeImpersonationPathTest` checks that MCN updates by impersonation of the MCD SA are blocked

func ValidateMCNScopeSadPathTest

func ValidateMCNScopeSadPathTest(oc *exutil.CLI)

`ValidateMCNScopeSadPathTest` checks that MCN updates from a MCD that is not the associated one are blocked. This test skips on SNO clusters.

func WaitForBootImageControllerToComplete

func WaitForBootImageControllerToComplete(oc *exutil.CLI)

WaitForBootImageControllerToComplete waits until the boot image controller is no longer progressing

func WaitForConfigAndPoolComplete

func WaitForConfigAndPoolComplete(oc *exutil.CLI, pool, mcName string) string

WaitForConfigAndPoolComplete is a helper function that gets a renderedConfig and waits for its pool to complete. The return value is the final rendered config.

func WaitForMCNConditionStatus

func WaitForMCNConditionStatus(clientSet *machineconfigclient.Clientset, mcnName string, conditionType mcfgv1.StateProgress, status metav1.ConditionStatus,
	timeout time.Duration, interval time.Duration) (bool, error)

`WaitForMCNConditionStatus` waits up to a specified timeout for the desired MCN condition to match the desired status (ex. wait until "Updated" is "False"). If the desired condition is "Unknown," the function will also return true if the condition is "True," which ensures that we do not fail when an update progresses quickly through the intermediary "Unknown" phase.

func WaitForMCNToBeDeleted

func WaitForMCNToBeDeleted(clientSet *machineconfigclient.Clientset, mcnName string) error

`WaitForMCNToBeDeleted` up waits to 4 minutes for a MCN to be deleted (no longer exist)

func WaitForMCPConditionStatus

func WaitForMCPConditionStatus(oc *exutil.CLI, mcpName string, conditionType mcfgv1.MachineConfigPoolConditionType, status corev1.ConditionStatus, timeout time.Duration, interval time.Duration) error

`WaitForMCPConditionStatus` waits up to the desired timeout for the desired MCP condition to match the desired status (ex. wait until "Updating" is "True")

func WaitForMCPToBeReady

func WaitForMCPToBeReady(oc *exutil.CLI, machineConfigClient *machineconfigclient.Clientset, poolName string, readyMachineCount int32)

`WaitForMCPToBeReady` waits up to 5 minutes for a pool to be in an updated state with a specified number of ready machines

func WaitForMachineConfigurationStatusUpdate

func WaitForMachineConfigurationStatusUpdate(oc *exutil.CLI)

WaitForMachineConfigurationStatus waits until the MCO syncs the operator status to the latest spec

func WaitForMachineInState

func WaitForMachineInState(machineClient *machineclient.Clientset, machineName string, desiredPhase string) error

`WaitForMachineInState` waits up to 7 minutes for the desired machine to be in the desired state

func WaitForMachineToBeDeleted

func WaitForMachineToBeDeleted(machineClient *machineclient.Clientset, machineName string) error

`WaitForMachineToBeDeleted` waits up to 10 minutes for a machine to be deleted (no longer exist)

func WaitForNodeCurrentConfig

func WaitForNodeCurrentConfig(oc *exutil.CLI, nodeName string, config string)

`WaitForNodeCurrentConfig` waits up to 5 minutes for a input node to have a current config equal to the `config` parameter

func WaitForNodeToBeDeleted

func WaitForNodeToBeDeleted(oc *exutil.CLI, nodeName string) error

`WaitForNodeToBeDeleted` waits up to 10 minutes for a node to be deleted (no longer exist)

func WaitForOneMasterNodeToBeReady

func WaitForOneMasterNodeToBeReady(oc *exutil.CLI) error

WaitForOneMasterNodeToBeReady waits until atleast one master node has completed an update

func WaitForPoolComplete

func WaitForPoolComplete(oc *exutil.CLI, pool, target string) error

WaitForPoolComplete polls a pool until it has completed an update to target

func WaitForRenderedConfig

func WaitForRenderedConfig(oc *exutil.CLI, pool, mcName string) (string, error)

WaitForRenderedConfig polls a MachineConfigPool until it has included the given mcName in its config, and returns the new rendered config name.

func WaitForRenderedConfigs

func WaitForRenderedConfigs(oc *exutil.CLI, pool string, mcNames ...string) (string, error)

WaitForRenderedConfigs polls a MachineConfigPool until it has included the given mcNames in its config, and returns the new rendered config name.

func WaitForValidMCNProperties

func WaitForValidMCNProperties(clientSet *machineconfigclient.Clientset, node corev1.Node) error

`WaitForValidMCNProperties` waits for the MCN of a node to be valid. To be valid, the following must be true:

  • MCN with name equivalent to node name exists (waits up to 20 sec)
  • Pool name in MCN spec matches node MCP association (waits up to 1 min)
  • Desired config version of node matches desired config version in MCN spec (waits up to 1 min)
  • Current config version of node matches current config version in MCN status (waits up to 2 min)
  • Desired config version of node matches desired config version in MCN status (waits up to 1 min)

func WorkersCanBeScaled

func WorkersCanBeScaled(oc *exutil.CLI, machineClient *machineclient.Clientset) (bool, error)

`WorkersCanBeScaled` checks whether the worker nodes in a cluster can be scaled. Cases where scaling worker nodes is NOT possible include:

  • Baremetal platform
  • MachineAPI is disabled
  • Error getting list of MachineSets / no MachineSets exist
  • All MachineSets have 0 worker nodes

Types

This section is empty.

Jump to

Keyboard shortcuts

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