Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -353,3 +353,8 @@ replace (
// The cadvisor version used in k8s v1.32.1 (v0.51.0) relies on code present on this version
// This can be removed once it's no longer used in o/k
replace github.com/containerd/errdefs => github.com/containerd/errdefs v0.1.0

// The following replace commands are in place to allow the simultaneous merge of the API (PR #2255) & origin for making use of the V1 MCN API
replace github.com/openshift/api => github.com/isabella-janssen/openshift-api v0.0.0-20250423163652-3d76f1835b2c

replace github.com/openshift/client-go => github.com/isabella-janssen/openshift-client-go v0.0.0-20250423165717-b84d4e80502c
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,10 @@ github.com/ianlancetaylor/demangle v0.0.0-20210905161508-09a460cdf81d/go.mod h1:
github.com/ianlancetaylor/demangle v0.0.0-20230524184225-eabc099b10ab/go.mod h1:gx7rwoVhcfuVKG5uya9Hs3Sxj7EIvldVofAWIUtGouw=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/isabella-janssen/openshift-api v0.0.0-20250423163652-3d76f1835b2c h1:ZXr+C67yjbTVngH2A0aJF+/TkRA0bMxz9xuOWoQE8p8=
github.com/isabella-janssen/openshift-api v0.0.0-20250423163652-3d76f1835b2c/go.mod h1:yk60tHAmHhtVpJQo3TwVYq2zpuP70iJIFDCmeKMIzPw=
github.com/isabella-janssen/openshift-client-go v0.0.0-20250423165717-b84d4e80502c h1:2zTo28G79Fs9TfhlRJimpsZRj4TZag/i03fzzTdnR8E=
github.com/isabella-janssen/openshift-client-go v0.0.0-20250423165717-b84d4e80502c/go.mod h1:Ee2bsd/VaaRLMVFFn2qWZ3Cl9jwAeUjzCiPvMTnGkGI=
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A=
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo=
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
Expand Down Expand Up @@ -597,14 +601,10 @@ github.com/opencontainers/runtime-spec v1.2.0 h1:z97+pHb3uELt/yiAWD691HNHQIF07bE
github.com/opencontainers/runtime-spec v1.2.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
github.com/opencontainers/selinux v1.11.1 h1:nHFvthhM0qY8/m+vfhJylliSshm8G1jJ2jDMcgULaH8=
github.com/opencontainers/selinux v1.11.1/go.mod h1:E5dMC3VPuVvVHDYmi78qvhJp8+M586T4DlDRYpFkyec=
github.com/openshift/api v0.0.0-20250405052455-aa882942241d h1:OWknR960jKxORjMEEeMc30m/wHit6w/Wxqb3XtToVdE=
github.com/openshift/api v0.0.0-20250405052455-aa882942241d/go.mod h1:yk60tHAmHhtVpJQo3TwVYq2zpuP70iJIFDCmeKMIzPw=
github.com/openshift/apiserver-library-go v0.0.0-20250127121756-dc9a973f14ce h1:w0Up6YV1APcn20v/1h5IfuToz96o2pVqZyjzbw0yotU=
github.com/openshift/apiserver-library-go v0.0.0-20250127121756-dc9a973f14ce/go.mod h1:kkSwH4osgejnRIyHfsfkv0V0xfmgH4Yk/VDObaJukHU=
github.com/openshift/build-machinery-go v0.0.0-20250102153059-e85a1a7ecb5c h1:6XcszPFZpan4qll5XbdLll7n1So3IsPn28aw2j1obMo=
github.com/openshift/build-machinery-go v0.0.0-20250102153059-e85a1a7ecb5c/go.mod h1:8jcm8UPtg2mCAsxfqKil1xrmRMI3a+XU2TZ9fF8A7TE=
github.com/openshift/client-go v0.0.0-20250324153519-f0faeb0f2f2e h1:OfOI0eTTUdwqaUHgm0YsinRYtOj4OGO+ioauVNPuDeQ=
github.com/openshift/client-go v0.0.0-20250324153519-f0faeb0f2f2e/go.mod h1:MWRA5YlclrxlrDIOni+AaeOrHchTslLvLTs9pIWuCiw=
github.com/openshift/cluster-network-operator v0.0.0-20240708200319-1cd8678b38fb h1:Dr0dbSQTAU9UaoAvimGjR+fsvwx2twJ5KR0s/jyAz88=
github.com/openshift/cluster-network-operator v0.0.0-20240708200319-1cd8678b38fb/go.mod h1:LnhqxbWhAnhPwilJ4yX1/ly7wCMCYJKkaiSJQSh+Wjg=
github.com/openshift/kubernetes v1.30.1-0.20250320083338-1601b9e27d85 h1:GGa1y6SWhlKjw9Utv+Q5bNH4dEk5ArVFRwaqlYsNS2Q=
Expand Down
31 changes: 15 additions & 16 deletions test/extended/machine_config/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
osconfigv1 "github.com/openshift/api/config/v1"
machinev1beta1 "github.com/openshift/api/machine/v1beta1"
mcfgv1 "github.com/openshift/api/machineconfiguration/v1"
mcfgv1alpha1 "github.com/openshift/api/machineconfiguration/v1alpha1"
opv1 "github.com/openshift/api/operator/v1"
machineclient "github.com/openshift/client-go/machine/clientset/versioned"
machineconfigclient "github.com/openshift/client-go/machineconfiguration/clientset/versioned"
Expand Down Expand Up @@ -353,7 +352,7 @@ func ValidateMCNForNodeInPool(oc *exutil.CLI, clientSet *machineconfigclient.Cli

// Get node MCN
framework.Logf("Getting MCN for node '%v'.", node.Name)
mcn, mcnErr := clientSet.MachineconfigurationV1alpha1().MachineConfigNodes().Get(context.TODO(), node.Name, metav1.GetOptions{})
mcn, mcnErr := clientSet.MachineconfigurationV1().MachineConfigNodes().Get(context.TODO(), node.Name, metav1.GetOptions{})
if mcnErr != nil {
framework.Logf("Could not get MCN for node '%v'.", node.Name)
return mcnErr
Expand Down Expand Up @@ -542,16 +541,16 @@ func WaitForMCPConditionStatus(oc *exutil.CLI, mcpName string, conditionType mcf
}

// `WaitForMCNConditionStatus` waits up to a specified timeout for the desired MCN condition to match the desired status (ex. wait until "Updated" is "False")
func WaitForMCNConditionStatus(clientSet *machineconfigclient.Clientset, mcnName string, conditionType mcfgv1alpha1.StateProgress, status metav1.ConditionStatus,
func WaitForMCNConditionStatus(clientSet *machineconfigclient.Clientset, mcnName string, conditionType mcfgv1.StateProgress, status metav1.ConditionStatus,
timeout time.Duration, interval time.Duration) (bool, error) {

conditionMet := false
var conditionErr error
var workerNodeMCN *mcfgv1alpha1.MachineConfigNode
var workerNodeMCN *mcfgv1.MachineConfigNode
if err := wait.PollUntilContextTimeout(context.TODO(), interval, timeout, true, func(_ context.Context) (bool, error) {
framework.Logf("Waiting for MCN '%v' %v condition to be %v.", mcnName, conditionType, status)

workerNodeMCN, conditionErr = clientSet.MachineconfigurationV1alpha1().MachineConfigNodes().Get(context.TODO(), mcnName, metav1.GetOptions{})
workerNodeMCN, conditionErr = clientSet.MachineconfigurationV1().MachineConfigNodes().Get(context.TODO(), mcnName, metav1.GetOptions{})
// Record if an error occurs when getting the MCN resource
if conditionErr != nil {
framework.Logf("Error getting MCN for node '%v': %v", mcnName, conditionErr)
Expand All @@ -577,13 +576,13 @@ func WaitForMCNConditionStatus(clientSet *machineconfigclient.Clientset, mcnName
}

// `CheckMCNConditionStatus` checks that an MCN condition matches the desired status (ex. confirm "Updated" is "False")
func CheckMCNConditionStatus(mcn *mcfgv1alpha1.MachineConfigNode, conditionType mcfgv1alpha1.StateProgress, status metav1.ConditionStatus) bool {
func CheckMCNConditionStatus(mcn *mcfgv1.MachineConfigNode, conditionType mcfgv1.StateProgress, status metav1.ConditionStatus) bool {
conditionStatus := getMCNConditionStatus(mcn, conditionType)
return conditionStatus == status
}

// `getMCNConditionStatus` returns the status of the desired condition type for MCN, or an empty string if the condition does not exist
func getMCNConditionStatus(mcn *mcfgv1alpha1.MachineConfigNode, conditionType mcfgv1alpha1.StateProgress) metav1.ConditionStatus {
func getMCNConditionStatus(mcn *mcfgv1.MachineConfigNode, conditionType mcfgv1.StateProgress) metav1.ConditionStatus {
// Loop through conditions and return the status of the desired condition type
conditions := mcn.Status.Conditions
for _, condition := range conditions {
Expand All @@ -600,16 +599,16 @@ func getMCNConditionStatus(mcn *mcfgv1alpha1.MachineConfigNode, conditionType mc
// 2. All other conditions = False
func ConfirmUpdatedMCNStatus(clientSet *machineconfigclient.Clientset, mcnName string) bool {
// Get MCN
workerNodeMCN, workerErr := clientSet.MachineconfigurationV1alpha1().MachineConfigNodes().Get(context.TODO(), mcnName, metav1.GetOptions{})
workerNodeMCN, workerErr := clientSet.MachineconfigurationV1().MachineConfigNodes().Get(context.TODO(), mcnName, metav1.GetOptions{})
o.Expect(workerErr).NotTo(o.HaveOccurred())

// Loop through conditions and return the status of the desired condition type
conditions := workerNodeMCN.Status.Conditions
for _, condition := range conditions {
if condition.Type == string(mcfgv1alpha1.MachineConfigNodeUpdated) && condition.Status != metav1.ConditionTrue {
if condition.Type == string(mcfgv1.MachineConfigNodeUpdated) && condition.Status != metav1.ConditionTrue {
framework.Logf("Node '%s' update is not complete; 'Updated' condition status is '%v'", mcnName, condition.Status)
return false
} else if condition.Type != string(mcfgv1alpha1.MachineConfigNodeUpdated) && condition.Status != metav1.ConditionFalse {
} else if condition.Type != string(mcfgv1.MachineConfigNodeUpdated) && condition.Status != metav1.ConditionFalse {
framework.Logf("Node '%s' is updated but MCN is invalid; '%v' codition status is '%v'", mcnName, condition.Type, condition.Status)
return false
}
Expand Down Expand Up @@ -878,7 +877,7 @@ func WaitForValidMCNProperties(clientSet *machineconfigclient.Clientset, node co
framework.Logf("Checking MCN exists and name matches node name '%v'.", node.Name)
o.Eventually(func() bool {
// Get the desired MCN
newMCN, newMCNErr := clientSet.MachineconfigurationV1alpha1().MachineConfigNodes().Get(context.TODO(), node.Name, metav1.GetOptions{})
newMCN, newMCNErr := clientSet.MachineconfigurationV1().MachineConfigNodes().Get(context.TODO(), node.Name, metav1.GetOptions{})
if newMCNErr != nil {
framework.Logf("Failed getting MCN '%v'.", node.Name)
return false
Expand All @@ -901,7 +900,7 @@ func WaitForValidMCNProperties(clientSet *machineconfigclient.Clientset, node co
}
o.Eventually(func() bool {
// Get the desired MCN
newMCN, newMCNErr := clientSet.MachineconfigurationV1alpha1().MachineConfigNodes().Get(context.TODO(), node.Name, metav1.GetOptions{})
newMCN, newMCNErr := clientSet.MachineconfigurationV1().MachineConfigNodes().Get(context.TODO(), node.Name, metav1.GetOptions{})
if newMCNErr != nil {
framework.Logf("Failed getting MCN '%v'.", node.Name)
return false
Expand All @@ -916,7 +915,7 @@ func WaitForValidMCNProperties(clientSet *machineconfigclient.Clientset, node co
framework.Logf("Waiting for node desired config version to match desired config version in MCN '%v' spec.", node.Name)
o.Eventually(func() bool {
// Get the desired MCN
newMCN, newMCNErr := clientSet.MachineconfigurationV1alpha1().MachineConfigNodes().Get(context.TODO(), node.Name, metav1.GetOptions{})
newMCN, newMCNErr := clientSet.MachineconfigurationV1().MachineConfigNodes().Get(context.TODO(), node.Name, metav1.GetOptions{})
if newMCNErr != nil {
framework.Logf("Failed getting MCN '%v'.", node.Name)
return false
Expand All @@ -931,7 +930,7 @@ func WaitForValidMCNProperties(clientSet *machineconfigclient.Clientset, node co
framework.Logf("Waiting for node current config version to match current config version in MCN '%v' status.", node.Name)
o.Eventually(func() bool {
// Get the desired MCN
newMCN, newMCNErr := clientSet.MachineconfigurationV1alpha1().MachineConfigNodes().Get(context.TODO(), node.Name, metav1.GetOptions{})
newMCN, newMCNErr := clientSet.MachineconfigurationV1().MachineConfigNodes().Get(context.TODO(), node.Name, metav1.GetOptions{})
if newMCNErr != nil {
framework.Logf("Failed getting MCN '%v'.", node.Name)
return false
Expand All @@ -946,7 +945,7 @@ func WaitForValidMCNProperties(clientSet *machineconfigclient.Clientset, node co
framework.Logf("Waiting for node desired config version to match desired config version in MCN '%v' status.", node.Name)
o.Eventually(func() bool {
// Get the desired MCN
newMCN, newMCNErr := clientSet.MachineconfigurationV1alpha1().MachineConfigNodes().Get(context.TODO(), node.Name, metav1.GetOptions{})
newMCN, newMCNErr := clientSet.MachineconfigurationV1().MachineConfigNodes().Get(context.TODO(), node.Name, metav1.GetOptions{})
if newMCNErr != nil {
framework.Logf("Failed getting MCN '%v'.", node.Name)
return false
Expand Down Expand Up @@ -1046,7 +1045,7 @@ func WaitForMCNToBeDeleted(clientSet *machineconfigclient.Clientset, mcnName str
framework.Logf("Check if MCN '%v' is deleted.", mcnName)

// Check if MCN still exists
_, mcnErr := clientSet.MachineconfigurationV1alpha1().MachineConfigNodes().Get(context.TODO(), mcnName, metav1.GetOptions{})
_, mcnErr := clientSet.MachineconfigurationV1().MachineConfigNodes().Get(context.TODO(), mcnName, metav1.GetOptions{})
if apierrors.IsNotFound(mcnErr) {
framework.Logf("MCN '%v' has been deleted.", mcnName)
return true
Expand Down
Loading