Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug 1885867 : Flip to unicast only when MCO set to desired version in all nodes #103

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion pkg/config/node.go
Expand Up @@ -234,7 +234,9 @@ func IsUpgradeStillRunning(kubeconfigPath string) (error, bool) {
}

for _, node := range nodes.Items {
if node.Annotations["machineconfiguration.openshift.io/desiredConfig"] != node.Annotations["machineconfiguration.openshift.io/currentConfig"] {
if node.Annotations["machineconfiguration.openshift.io/desiredConfig"] != node.Annotations["machineconfiguration.openshift.io/currentConfig"] ||
node.Annotations["machineconfiguration.openshift.io/desiredConfig"] != nodes.Items[0].Annotations["machineconfiguration.openshift.io/desiredConfig"] {
Copy link
Member

Choose a reason for hiding this comment

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

So this is essentially checking that the current node matches the first node. Do we know that the first node will always be upgraded first or should we make this check a separate loop where we verify all of the nodes' desiredConfigs match (or I guess we could still use this loop with a bit different logic)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

A. No, we don't know that the first node will be first.

B. This code supposes to check that :
* desiredConfig is equal to currentConfig for each node
and

  • all the nodes has the same desiredConfig

So, If desiredConfig != currentConfig for one of the nodes, we'll fail because of the first condition in the if statement.

And the second condition in the if statement verifies that all the nodes has the same desiredConfig.

I used the below logic to verify that all nodes has the same desiredConfig.
Assuming that we have an array of N (0 - N-1) numbers and we need to check if all values of the array are equal.

So, if for each i between 1 to N-1 Arr[i] == Arr[0] that means that all array members are equal (because whenever x = y and y = z, then also x = z )

Let me know if you still think I should change/update something in this statement
.

Copy link
Member

Choose a reason for hiding this comment

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

Oh, right. This does check that they're all equal. Oops. :-)


return nil, true
}
}
Expand Down