Skip to content

Bug 1724155: MCO/MCD: sync deployment before controllerconfig, roll out MCDs before MCC and remove pivot's reboot-needed file - #887

Merged
openshift-merge-robot merged 4 commits into
openshift:masterfrom
runcom:pivot-reboot-needed
Jun 25, 2019
Merged

openshift-merge-robot merged 4 commits into
openshift:masterfrom
runcom:pivot-reboot-needed

Conversation

@runcom

@runcom runcom commented Jun 24, 2019

Copy link
Copy Markdown
Member

This patch set takes care of mainly three issues we've spotted:

  • an osimageurl change from an upgrade can race with the old MCC
  • we can still be running the old MCDs on nodes once the new MCC creates the new rendered
  • if the node has never rebooted and ConditionFirstBoot is thus True, pivot reboots the node causing an upgrade failure

The above have been fixed by:

  • rolling out the new MCC before applying the new osimageurl ConfigMap that is then templated by the new MCC
  • roll out the MCDs before the MCC
  • always remove /etc/pivot/reboot-needed when running pivot from the MCD

@openshift-ci-robot openshift-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jun 24, 2019
@runcom

runcom commented Jun 24, 2019

Copy link
Copy Markdown
Member Author

I'm not sure about the second commit pkg/operator: roll out the MCDs first but wanted to test what's happening in the CI with that at least

@runcom

runcom commented Jun 24, 2019 •

Copy link
Copy Markdown
Member Author

This actually went through and we can see in logs that the MCD waited for the MCC as well to come up and publish the rendered MC on cluster setup.


Now, not related to this PR clearly since I've spotted it elsewhere but I need to write them down before forgetting:

I0624 21:36:38.224136    5027 update.go:723] logger doesn't support --jounald, grepping the journal

The above shouldn't be the case on RHCOS in master, why does it happen

I'll move the above to separate issues tomorrow

@runcom

runcom commented Jun 24, 2019

Copy link
Copy Markdown
Member Author

/retest

@kikisdeliveryservice

kikisdeliveryservice commented Jun 24, 2019 •

Copy link
Copy Markdown
Contributor

Now, not related to this PR clearly since I've spotted it elsewhere but I need to write them down before forgetting:

I0624 21:36:38.224136    5027 update.go:723] logger doesn't support --jounald, grepping the journal

The above shouldn't be the case on RHCOS in master, why does it happen, and:

I'll move the above to separate issues tomorrow

From just poking around maybe bc that logging comes from checkStateOnFirstRun()

func (dn *Daemon) checkStateOnFirstRun() error {
the default value (false) of var loggerSupportsJournal is being used instead of the set value of true that is done here:
loggerSupportsJournal := true

From looking through the files that's the only way outside of being a RHEL7 that it would retain the value of false.

@runcom
runcom force-pushed the pivot-reboot-needed branch 3 times, most recently from aec9f7e to 3bdf661 Compare June 25, 2019 10:05
@runcom

runcom commented Jun 25, 2019

Copy link
Copy Markdown
Member Author

working as expected now and MCDs roll out before MCC

@cgwalters

cgwalters commented Jun 25, 2019 •

Copy link
Copy Markdown
Member

All the code looks good to me, and I know you wanted to test this in CI but - I am going to be a pain about the commit message bodies being empty. Mind doing e.g. git rebase -i origin/master, then do r on each commit to reword, and add the text you've written in the PR body into some of the commits? Even just a single line can help later.

I use git blame a lot to find historical context and having the text in the commit message directly is a lot faster than trying to go back to Github to find the PR text. I specifically use the "Gitlens" "Toggle file blame annotations" in VS code frequently.

Another important thing is...5 years down the line, maybe the GH business model isn't quite working out and they let go one of their database people and then later some of the historical PR discussions get lost... but with git, it's forever. (I still wish sometimes we backed up even the PR review discussions reliably but that's another issue)

@runcom

runcom commented Jun 25, 2019

Copy link
Copy Markdown
Member Author

All the code looks good to me, and I know you wanted to test this in CI but - I am going to be a pain about the commit message bodies being empty. Mind doing e.g. git rebase -i origin/master, then do r on each commit to reword, and add the text you've written in the PR body into some of the commits? Even just a single line can help later.

no pain, I usually do that anyway but forget from time to time and I agree it's freaking important to have it (I look it up from vscode as well!)

Comment thread pkg/daemon/rpm-ostree.go Outdated

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.

Also this one could really use a comment like:

// This is written by code injected by the MCS, but we always want the MCD to be in control of reboots

runcom added 4 commits June 25, 2019 14:49
An osimageurl change from an upgrade can race with the old MCC. This
patch makes sure we roll out the new MCC before applying the new
osimageurl ConfigMap that is then templated by the new MCC.
We can still be running the old MCDs on nodes once the new MCC creates the new rendered
so fix that by rolling out the MCDs first and then the new MCC.
If the node has never rebooted and ConditionFirstBoot is thus True, pivot reboots the node causing an upgrade failure
The reboot-needed file controls that but we want the MCD to be the only
in charge of reboots so always remove it when running pivot from the
MCDs.
if we're inDesiredConfig but Degraded it means we failed somehow the
very first actions (i.e. 404 on the rendered MC). But if we're in
Desired config there's no reason NOT to set Done when everything
reconciles back to current == desired.
@runcom
runcom force-pushed the pivot-reboot-needed branch from 3bdf661 to acc0950 Compare June 25, 2019 12:54
@runcom

runcom commented Jun 25, 2019

Copy link
Copy Markdown
Member Author

Took care of @cgwalters comments!

Comment thread pkg/daemon/daemon.go
// if we're degraded here, it means we got an error likely on startup and we retried
// if it's the case, clear it out
if state.state == constants.MachineConfigDaemonStateDegraded {
if err := dn.nodeWriter.SetDone(dn.kubeClient.CoreV1().Nodes(), dn.nodeLister, dn.name, state.currentConfig.GetName()); err != nil {

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.

Would it be better to just call completeUpdate as the code right above this is doing in case there's somehow still a cordon? I wonder if we should always call SetDone here like this:

diff --git a/pkg/daemon/daemon.go b/pkg/daemon/daemon.go
index 0c8630d2..ff33afa0 100644
--- a/pkg/daemon/daemon.go
+++ b/pkg/daemon/daemon.go
@@ -895,9 +895,6 @@ func (dn *Daemon) checkStateOnFirstRun() error {
 		if dn.recorder != nil {
 			dn.recorder.Eventf(getNodeRef(dn.node), corev1.EventTypeNormal, "NodeDone", fmt.Sprintf("Setting node %s, currentConfig %s to Done", dn.node.Name, state.pendingConfig.GetName()))
 		}
-		if err := dn.nodeWriter.SetDone(dn.kubeClient.CoreV1().Nodes(), dn.nodeLister, dn.name, state.pendingConfig.GetName()); err != nil {
-			return errors.Wrap(err, "error setting node's state to Done")
-		}
 		if out, err := dn.storePendingState(state.pendingConfig, 0); err != nil {
 			return errors.Wrapf(err, "failed to reset pending config: %s", string(out))
 		}
@@ -922,6 +919,11 @@ func (dn *Daemon) checkStateOnFirstRun() error {
 			}
 		}
 
+		if state.state != constants.MachineConfigDaemonStateDone {
+			if err := dn.nodeWriter.SetDone(dn.kubeClient.CoreV1().Nodes(), dn.nodeLister, dn.name, state.pendingConfig.GetName()); err != nil {
+				return errors.Wrap(err, "error setting node's state to Done")
+			}
+		}
 		glog.Infof("In desired config %s", state.currentConfig.GetName())
 
 		// All good!

?

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.

Eh...it's OK we can do this type of detail in a later followup.

@cgwalters

Copy link
Copy Markdown
Member

/approve

@cgwalters

Copy link
Copy Markdown
Member

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jun 25, 2019
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cgwalters, runcom

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-robot
openshift-merge-robot merged commit 1fdd2aa into openshift:master Jun 25, 2019
@runcom
runcom deleted the pivot-reboot-needed branch June 25, 2019 14:29
@runcom

runcom commented Jun 25, 2019

Copy link
Copy Markdown
Member Author

/cherrypick release-4.1

@openshift-cherrypick-robot

Copy link
Copy Markdown

@runcom: #887 failed to apply on top of branch "release-4.1":

error: Failed to merge in the changes.
Using index info to reconstruct a base tree...
M	pkg/operator/sync.go
Falling back to patching base and 3-way merge...
Auto-merging pkg/operator/sync.go
CONFLICT (content): Merge conflict in pkg/operator/sync.go
Patch failed at 0001 pkg/operator: sync deployment before controllerconfig

Details

In response to this:

/cherrypick release-4.1

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@runcom

runcom commented Jun 25, 2019

Copy link
Copy Markdown
Member Author

I knew it -.-

@runcom

runcom commented Jun 25, 2019

Copy link
Copy Markdown
Member Author

working on a patch for 4.1

@runcom runcom changed the title MCO/MCD: sync deployment before controllerconfig, roll out MCDs before MCC and remove pivot's reboot-needed file Bug 1724155: MCO/MCD: sync deployment before controllerconfig, roll out MCDs before MCC and remove pivot's reboot-needed file Jun 26, 2019
@openshift-ci-robot openshift-ci-robot added the bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. label Jun 26, 2019
@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@runcom: This pull request references a valid Bugzilla bug.

Details

In response to this:

Bug 1724155: MCO/MCD: sync deployment before controllerconfig, roll out MCDs before MCC and remove pivot's reboot-needed file

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@cgwalters cgwalters mentioned this pull request Jun 28, 2019
ptalgulk01 pushed a commit to ptalgulk01/machine-config-operator that referenced this pull request May 15, 2026
MCO/MCD: sync deployment before controllerconfig, roll out MCDs before MCC and remove pivot's reboot-needed file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants