Skip to content
Closed
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
4 changes: 2 additions & 2 deletions pkg/controller/node/node_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -452,13 +452,13 @@ func TestGetCandidateMachines(t *testing.T) {
expected: []*corev1.Node{newNodeWithReady("node-3", "v0", "v0", corev1.ConditionTrue)},
}, {
//progress on old stuck node
progress: 1,
progress: 0,
nodes: []*corev1.Node{
newNodeWithReady("node-0", "v1", "v1", corev1.ConditionTrue),
newNodeWithReady("node-1", "v0.1", "v0.2", corev1.ConditionFalse),
newNodeWithReady("node-2", "v0", "v0", corev1.ConditionTrue),
},
expected: []*corev1.Node{newNodeWithReady("node-1", "v0.1", "v0.2", corev1.ConditionFalse)},
expected: []*corev1.Node{},
}}

for idx, test := range tests {
Expand Down
8 changes: 7 additions & 1 deletion pkg/controller/node/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ func isNodeReady(node *corev1.Node) bool {
return true
}

// TODO(runcom): drop currentConfig arg
func getUnavailableMachines(currentConfig string, nodes []*corev1.Node) []*corev1.Node {
var unavail []*corev1.Node
for _, node := range nodes {
Expand All @@ -191,9 +192,14 @@ func getUnavailableMachines(currentConfig string, nodes []*corev1.Node) []*corev
if !ok || cconfig == "" {
continue
}
dstate, ok := node.Annotations[daemonconsts.MachineConfigDaemonStateAnnotationKey]
if !ok || dstate == "" {
continue
}

nodeNotReady := !isNodeReady(node)
if dconfig == currentConfig && (dconfig != cconfig || nodeNotReady) {
// we want to be able to roll back if a bad MC caused an unreconcilable state
if (dconfig != cconfig || nodeNotReady) && dstate != daemonconsts.MachineConfigDaemonStateUnreconcilable {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this makes sense...just a note to self that the function is now not the inverse of getReadyMachines.

(also this PR will conflict with the doc comments I added in the other PR)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this makes sense...just a note to self that the function is now not the inverse of getReadyMachines.

I'm not really sure about this actually, but wanted to check what tests say :(

unavail = append(unavail, node)
glog.V(2).Infof("Node %s unavailable: different configs (desired: %s, current %s) or node not ready %v", node.Name, dconfig, cconfig, nodeNotReady)
}
Expand Down
10 changes: 8 additions & 2 deletions pkg/controller/node/status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,10 @@ func TestGetUnavailableMachines(t *testing.T) {
newNodeWithReady("node-2", "v0", "v2", corev1.ConditionTrue),
},
currentConfig: "v2",
unavail: []*corev1.Node{newNodeWithReady("node-2", "v0", "v2", corev1.ConditionTrue)},
unavail: []*corev1.Node{
newNodeWithReady("node-0", "v0", "v1", corev1.ConditionTrue),
newNodeWithReady("node-2", "v0", "v2", corev1.ConditionTrue),
},
}, {
// 1 node updated, 1 updating, 1 updating but not v2 and is not ready
nodes: []*corev1.Node{
Expand All @@ -248,7 +251,10 @@ func TestGetUnavailableMachines(t *testing.T) {
newNodeWithReady("node-2", "v0", "v2", corev1.ConditionTrue),
},
currentConfig: "v2",
unavail: []*corev1.Node{newNodeWithReady("node-2", "v0", "v2", corev1.ConditionTrue)},
unavail: []*corev1.Node{
newNodeWithReady("node-0", "v0", "v1", corev1.ConditionFalse),
newNodeWithReady("node-2", "v0", "v2", corev1.ConditionTrue),
},
}, {
// 2 node updated, 1 updating
nodes: []*corev1.Node{
Expand Down