manifest/raw_bootc: support subscription registration on first boot (HMS-10897)#2528
manifest/raw_bootc: support subscription registration on first boot (HMS-10897)#2528lucasgarfield wants to merge 2 commits into
Conversation
| // insights on boot | ||
| InsightsOnBoot: true, | ||
| UnitPath: osbuild.EtcUnitPath, | ||
| PermissiveRHC: common.ValueOrEmpty(p.OSCustomizations.PermissiveRHC), |
There was a problem hiding this comment.
This isn't actually ever set right? Not a blocker but also just a no-op at the moment.
There was a problem hiding this comment.
Correct. I went ahead and added a comment (// no-op for now: manifestForDisk never sets OSCustomizations.PermissiveRHC) but we could probably also wire it up without too much effort.
|
Needs linter appeasement otherwise OK. |
This only takes effect once callers populate OSCustomizations.Subscription; see the follow-up commit. Previously, the only source of inline data was Customizations.Files. Now we also need to create inline sources for files needed for subscription. For the sake of consistency with the OS pipeline in os.go, we add an inlineData field to RawBootcImage. The getInline() method just becomes a getter for the inlineData field. A new helper, genFileStagesAndRecordInlineData(), roughly mirrors (*OS).addStagesForAllFilesAndInlineData. Unlike the OS pipeline, however, there is no fileRefs() implementation here, so the helper returns an error for URI-backed files; previously these silently produced a manifest referencing a source that was never defined. In addition to files, the subscriptionService() function also enables a service. Instead of enabling it in the subscription code block, we add it to enabledServices later on. This is again similar to how we serialize the OS pipeline and will make supporting Customizations.Services easy to add later. For subscriptionServiceOptions, InsightsOnBoot creates a drop-in that reruns Insights collection on every healthy boot so that after an upgrade the console reflects the new commit hash (see a6ecc32). UnitPath needs to be /etc/ because /usr/ is immutable. For the most part, the tests attempt to mirror the relevant tests for os.go.
Copy the requested subscription options into the image customizations in manifestForDisk, so bootc disk images (qcow2, ami, ...) register on first boot via the machinery added in the previous commit.
5f7fb34 to
02f91aa
Compare
|
|
||
| // single point where enabled services are collected, as in the OS | ||
| // pipeline; OSCustomizations.EnabledServices is not honoured yet | ||
| var enabledServices []string |
There was a problem hiding this comment.
Why have 2 lists for enabled services? You have already populated subscriptionEnabledServices and all this does is copy it.
| // would need to be added to the manifest sources via a | ||
| // fileRefs() implementation like the one in the OS pipeline | ||
| if file.URI() != "" { | ||
| return nil, fmt.Errorf("cannot create file %q from %q: files from an URI are not supported for bootc disk images yet", file.Path(), file.URI()) |
There was a problem hiding this comment.
I'd drop the yet, no need to speculate in error messages and get people's hopes up :)
| return "" | ||
| } | ||
|
|
||
| func collectMkdirPaths(stages []*osbuild.Stage) []string { |
There was a problem hiding this comment.
May as well use this in the TestRawBootcPXE function, probably in a new commit just to keep things clean.
|
Is there a reason you didn't add this to PXE and ISO types? |
Wire up
customizations.subscriptionfor bootc disk images (qcow2, ami, ...).The shared subscriptionService() machinery now runs in the RawBootcImage
pipeline: it creates the first-boot registration unit in /etc (not /usr, which
is immutable ostree content) and reruns Insights collection on boot so the
console reflects the new commit hash after upgrades — same options the
standalone Subscription pipeline uses for ostree systems.
Only the disk variant is wired for now.
While in there, URI-backed file customizations now return a clear error at
manifest generation time — they were previously silently broken in this
pipeline (missing manifest source).