-
Notifications
You must be signed in to change notification settings - Fork 100
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
MGMT-19100: Install to the current boot device when CoreosImage is set #1003
base: master
Are you sure you want to change the base?
Conversation
@carbonin: This pull request references MGMT-19100 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "4.19.0" version, but no target version was set. In response to this:
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 openshift-eng/jira-lifecycle-plugin repository. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: carbonin 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 |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1003 +/- ##
==========================================
- Coverage 55.20% 54.81% -0.39%
==========================================
Files 15 15
Lines 3286 3333 +47
==========================================
+ Hits 1814 1827 +13
- Misses 1292 1326 +34
Partials 180 180
|
64dd407
to
5199af9
Compare
src/ops/ops.go
Outdated
@@ -124,6 +125,61 @@ func (o *ops) SystemctlAction(action string, args ...string) error { | |||
return errors.Wrapf(err, "Failed executing systemctl %s %s", action, args) | |||
} | |||
|
|||
func (o *ops) WriteImageToLocalDevice(liveLogger io.Writer, ignitionPath string, rhelCoreOSImage string) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does any test provide coverage of this function?
I can see a code path in here that would conditionally execute according to the outcome of some the the calls to ExecPrivilegeCommand
I also think this is quite mockable/testable and there are pre-existing examples of how to approach this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't see much value since there's no actual logic here and every call would be mocked.
I could pull out the ostree output parsing bit since that's the only bit worth testing, otherwise it doesn't feel worth it to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the parsing part should be pulled out so that we can validate the parsing
src/ops/ops.go
Outdated
return errors.Wrapf(err, "failed to unencapsulate rhcos payload image: %s", out) | ||
} | ||
outputParts := strings.Split(out, " ") | ||
if len(outputParts) != 2 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not 100% sure what the output of the unencapsulate command is meant to look like when supplied the parameters above. But is it possible that these output parts could have exactly two parts while containing content we do not expect?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's fair. I'll build a regex of some sort. The expected output will be in the tests when I write them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW I don't know what all the output could possibly be.
My guess is that if the command is successful we'd only ever see the two parts we're expecting, but better to be sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also just for reference, this is the line I'm parsing https://github.com/ostreedev/ostree-rs-ext/blob/b885f9468829e6af41fa95504d65975c48378d4d/lib/src/cli.rs#L710
src/ops/ops.go
Outdated
@@ -49,6 +49,7 @@ const ( | |||
type Ops interface { | |||
Mkdir(dirName string) error | |||
WriteImageToDisk(liveLogger io.Writer, ignitionPath string, device string, extraArgs []string) error | |||
WriteImageToLocalDevice(liveLogger io.Writer, ignitionPath string, rhelCoreOSImage string) error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any ideas for a better name for this?
Technically all the devices are "local". Maybe "BootDevice"? Is that better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BootDevice seems reasonable.
We are describing the disk we will boot into once the node reboots out of discovery?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but that's true in either case.
The distinction is if we're installing to a device that is currently being used for the rootfs or one that is not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So in both cases they are boot disks, how about
WriteImageToBootDiskWithRootFs
?
or even
WriteImageToRootFSDisk
as it may be redundant to say "boot disk" if the context is already there?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe WriteImageToExistingRoot
to mirror the similar bootc
command (which might be something I can use) called bootc install to-existing-root
eb0683a
to
928a493
Compare
out, err = o.ExecPrivilegeCommand(liveLogger, "ostree", "admin", "deploy", | ||
"--stateroot", "install", | ||
"--karg", "$ignition_firstboot", | ||
"--karg", defaultIgnitionPlatformId, | ||
commit) | ||
if err != nil { | ||
return errors.Wrapf(err, "failed to deploy commit to stateroot: %s", out) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related to #1003 (comment) ...
@eranco74 (or someone you think knows) can/should we use bootc
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bootc is already part of rhcos?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure, that's part of what I'm asking, but I can check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's also present in 4.17 and 4.16. 4.15 is the latest version that doesn't have it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think MCE won't support anything earlier than 4.16 by the time this change gets in so we might be safe there, but if we also want to use this on the SaaS it might not be worth limiting the versions we can install.
Even if bootc
works for this and is the better option maybe we can leave it as a follow up for now?
This indicates the container image that should be installed and booted for the installed host. It also indicates that we should install to the existing root filesystem, in a new stateroot, rather than expecting a device path. https://issues.redhat.com/browse/MGMT-19100
928a493
to
8996860
Compare
@carbonin: The following tests failed, say
Full PR test history. Your PR dashboard. 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-sigs/prow repository. I understand the commands that are listed here. |
This indicates the container image that should be installed and booted for the installed host. It also indicates that we should install to the currently booted disk, in a new stateroot, rather than expecting a device path.
https://issues.redhat.com/browse/MGMT-19100
cc @tsorya @rccrdpccl @eranco74