Skip to content

Commit 64fb172

Browse files
committed
Allow non-drained updates based on node schedulability and kubelet status
The previous PR (openshift#30318) allowed non-drained updates but also required the node annotation "machineconfiguration.openshift.io/state"="Done". This condition is too strict, as the MCD may not be in the "Done" state when the nodes remain schedulable and fully functional. Signed-off-by: Qi Wang <qiwan@redhat.com>
1 parent 3885a6b commit 64fb172

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

test/e2e/upgrade/upgrade.go

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ import (
4141
"github.com/openshift/origin/test/e2e/upgrade/adminack"
4242
"github.com/openshift/origin/test/e2e/upgrade/dns"
4343
"github.com/openshift/origin/test/e2e/upgrade/manifestdelete"
44-
mc "github.com/openshift/origin/test/extended/machine_config"
4544
"github.com/openshift/origin/test/extended/prometheus"
4645
"github.com/openshift/origin/test/extended/util/disruption"
4746
"github.com/openshift/origin/test/extended/util/operator"
@@ -634,7 +633,7 @@ func clusterUpgrade(f *framework.Framework, c configv1client.Interface, dc dynam
634633

635634
allNodesReady := true
636635
for _, node := range nodes.Items {
637-
if !mc.IsNodeReady(node) {
636+
if !isNodeNotDrained(node) {
638637
allNodesReady = false
639638
break
640639
}
@@ -725,6 +724,26 @@ func recordClusterEvent(client kubernetes.Interface, uid, action string, reason
725724
}
726725
}
727726

727+
// isNodeNotDrained checks if a node is not drained (schedulable and kubelet ready).
728+
// Returns true if the node is not cordoned and kubelet is ready, indicating drain is not needed.
729+
func isNodeNotDrained(node v1.Node) bool {
730+
// If node is cordoned, drain is happening or about to happen
731+
if node.Spec.Unschedulable {
732+
framework.Logf("Node %s is unschedulable", node.Name)
733+
return false
734+
}
735+
// Check kubelet ready status
736+
for _, condition := range node.Status.Conditions {
737+
if condition.Type == v1.NodeReady && condition.Status == v1.ConditionTrue && condition.Reason == "KubeletReady" {
738+
return true
739+
}
740+
}
741+
742+
framework.Logf("Node %s kubelet not ready", node.Name)
743+
744+
return false
745+
}
746+
728747
// TODO(runcom): drop this when MCO types are in openshift/api and we can use the typed client directly
729748
func IsPoolUpdated(dc dynamic.NamespaceableResourceInterface, name string) (poolUpToDate bool, poolIsUpdating bool) {
730749
pool, err := dc.Get(context.Background(), name, metav1.GetOptions{})

0 commit comments

Comments
 (0)