-
Notifications
You must be signed in to change notification settings - Fork 448
OCPBUGS-62510: Skip rpm-ostree local rebase if no PIS #5333
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2557,12 +2557,17 @@ func (dn *Daemon) updateLayeredOS(config *mcfgv1.MachineConfig) error { | |
return dn.InplaceUpdateViaNewContainer(newURL) | ||
} | ||
|
||
isOsImagePresent := false | ||
isPisConfigured, err := dn.isPinnedImageSetConfigured() | ||
if err != nil { | ||
// Ignore the error and default to remote pull | ||
klog.Errorf("Failed to determine if pinned image set is configured: %v", err) | ||
} | ||
|
||
// not set during firstboot | ||
if dn.fgHandler != nil && dn.fgHandler.Enabled(features.FeatureGatePinnedImages) { | ||
isOsImagePresent, err = isImagePresent(newURL) | ||
if err != nil { | ||
// If PIS is configured check if the image is locally present. If so, rebase using | ||
// the local image | ||
isOsImagePresent := false | ||
if isPisConfigured { | ||
if isOsImagePresent, err = isImagePresent(newURL); err != nil { | ||
return err | ||
} | ||
} | ||
|
@@ -2595,6 +2600,29 @@ func (dn *Daemon) updateLayeredOS(config *mcfgv1.MachineConfig) error { | |
return nil | ||
} | ||
|
||
func (dn *Daemon) isPinnedImageSetConfigured() (bool, error) { | ||
if dn.fgHandler == nil || !dn.fgHandler.Enabled(features.FeatureGatePinnedImages) || dn.node == nil || dn.mcpLister == nil { | ||
// Two options: | ||
// - PIS is not enabled | ||
// - MCD first boot run: No connection to the cluster and node not populated -> Cannot check PIS config | ||
return false, nil | ||
} | ||
|
||
// PIS is enabled. Check if it's configured in any of its pools | ||
pools, _, err := helpers.GetPoolsForNode(dn.mcpLister, dn.node) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, re-reading the PIS implementation, I found it interesting that we used Not something we should worry about for this PR, just something I wanted to raise while we're here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was surprissed too, cause the initial drafy implementation I did used the primary pool but after reviewing what @isabella-janssen did I realized everything was using/considering all pools, unfortunately, that didn't trigger an alarm inside me and I changed the call to this one as it's what we use everywhere for PIS. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here's a thread where this was discussed back in March: https://redhat-internal.slack.com/archives/C076EFZF40M/p1741706350105449. I think there is room to reconsider, especially given the concerns you raised in the bug @pablintino. |
||
if err != nil { | ||
return false, fmt.Errorf("failed to get pools for node %q: %w", dn.node.Name, err) | ||
} | ||
|
||
for _, pool := range pools { | ||
if pool.Spec.PinnedImageSets != nil && len(pool.Spec.PinnedImageSets) > 0 { | ||
return true, nil | ||
} | ||
} | ||
// No pools with PIS configured | ||
return false, nil | ||
} | ||
|
||
// Synchronously invoke a command, writing its stdout to our stdout, | ||
// and gathering stderr into a buffer which will be returned in err | ||
// in case of 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.
Since all versions that would need this fix has already GA'ed PIS, is the additional check here intended to allow for backporting to techpreview versions? Or just additional checks for consistency purposes (until such a time we remove the PIS featuregate entirely)
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 was thinking the exact same thing today. In >4.19.12, does it make sense to preserve the feature gate checks of PIS?
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 would say it is for consistency since the feature gate is technically still defined in the API. Sure, right now we are only putting this fix into versions where PIS is GA, but what if, for some reason we can't see today, someone wants to backport this further and just cherrypicks this PR? It seems Joel plans to raise bugs when it is time to remove feature gates, so I figured until that time we would keep FG checks for consistency (ref Slack message).