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

daemon: Handle osImageURL bootstrap #362

Merged

Conversation

cgwalters
Copy link
Member

We need special handling for the initial case where we boot
into a target config, but we may be using an old OS image. Currently
the MCD would treat this as "config drift" and go degraded.

Today we write the node annotations to a file in /etc as part of the
rendered Ignition. Use that as a "bootstrap may be required" flag,
and handle it specially - if we need to pivot, do just that and
reboot.

We also clean things up by unlinking that node annotation file; after
that, if the osImageURL drifts from the expected config, we'll go
degraded, just like if someone modified a file.

@openshift-ci-robot openshift-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 1, 2019
@cgwalters
Copy link
Member Author

This is hoisted out of #324
and should do nothing today.

if err != nil {
if os.IsNotExist(err) {
Copy link
Member

Choose a reason for hiding this comment

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

Why check if nothing different is done?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch, fixed thanks!

@ashcrow
Copy link
Member

ashcrow commented Feb 1, 2019

/retest

We need special handling for the *initial* case where we boot
into a target config, but we may be using an old OS image.  Currently
the MCD would treat this as "config drift" and go degraded.

Today we write the node annotations to a file in `/etc` as part of the
rendered Ignition.  Use that as a "bootstrap may be required" flag,
and handle it specially - if we need to pivot, do *just* that and
reboot.

We also clean things up by unlinking that node annotation file; after
that, if the `osImageURL` drifts from the expected config, we'll go
degraded, just like if someone modified a file.
Copy link
Member

@jlebon jlebon left a comment

Choose a reason for hiding this comment

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

Looks sane to me! Will give others time to review.
/approve

// currentConfig's osImageURL should now be *truth*.
// In other words if it drifts somehow, we go degraded.
if err := os.Remove(InitialNodeAnnotationsFilePath); err != nil {
return errors.Wrapf(err, "Removing initial node annotations file")
Copy link
Member

Choose a reason for hiding this comment

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

Oh neat, I like Wrapf.

@jlebon
Copy link
Member

jlebon commented Feb 1, 2019

Logs from PR:

I0201 19:21:18.433038    5397 start.go:52] Version: 3.11.0-545-gb78dd54b-dirty
I0201 19:21:18.434009    5397 start.go:88] starting node writer
I0201 19:21:18.439488    5397 run.go:22] Running captured: chroot /rootfs rpm-ostree status --json
I0201 19:21:18.506006    5397 daemon.go:150] Booted osImageURL: registry.svc.ci.openshift.org/rhcos/maipo@sha256:043c2d1b1a427b4847975a3d5e38bb42a72c97f56f00b25134eff2708fd908ff (47.294)
I0201 19:21:18.507056    5397 daemon.go:219] Managing node: ip-10-0-145-215.ec2.internal
I0201 19:21:18.524467    5397 node.go:44] Setting initial node config: worker-ce3379b6ec80ed2b90075cbaa84b198e
I0201 19:21:18.549826    5397 start.go:139] Calling chroot("/rootfs")
I0201 19:21:18.549883    5397 daemon.go:380] In bootstrap mode
I0201 19:21:18.592370    5397 daemon.go:408] Current+desired config: worker-ce3379b6ec80ed2b90075cbaa84b198e
I0201 19:21:18.592398    5397 daemon.go:767] No target osImageURL provided
I0201 19:21:18.592409    5397 daemon.go:497] No bootstrap pivot required; unlinking bootstrap node annotations

Though of course it's not doing anything yet.

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Feb 1, 2019
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

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

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

The pull request process is described here

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 0117a52 into openshift:master Feb 1, 2019
osherdp pushed a commit to osherdp/machine-config-operator that referenced this pull request Apr 13, 2021
Remove hello-openshift imagestream
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. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants