-
Notifications
You must be signed in to change notification settings - Fork 526
OCPBUGS-98210: Use release payload image for OSImageStream rebuild detection #6284
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 |
|---|---|---|
|
|
@@ -96,11 +96,11 @@ func (f *DefaultStreamSourceFactory) Create(ctx context.Context, sysCtx *types.S | |
| return nil, fmt.Errorf("could not find default OSImageStream in the available streams: %w", err) | ||
| } | ||
|
|
||
| return newOSImageStream(createOptions.ExistingOSImageStream, streams, defaultStream), nil | ||
| return newOSImageStream(createOptions.ExistingOSImageStream, streams, defaultStream, createOptions.ReleaseImage), nil | ||
| } | ||
|
Comment on lines
+99
to
100
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. 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Find all callers of Create/CreateOptions to check if ReleaseImageStream path is used without ReleaseImage set
rg -n -B3 -A10 'ReleaseImageStream:' --type=goRepository: openshift/machine-config-operator Length of output: 171 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '\n== pkg/osimagestream/osimagestream.go ==\n'
wc -l pkg/osimagestream/osimagestream.go
sed -n '1,220p' pkg/osimagestream/osimagestream.go
printf '\n== Search for CreateOptions and ReleaseImageStream usage ==\n'
rg -n -S 'type CreateOptions|ReleaseImageStream|ReleaseImage:' pkg . --type=go
printf '\n== Search for newOSImageStream and osImageStreamRequiresRebuild ==\n'
rg -n -S 'newOSImageStream|osImageStreamRequiresRebuild' pkg --type=goRepository: openshift/machine-config-operator Length of output: 15697 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '\n== Candidate files referencing OSImageStream creation ==\n'
git ls-files 'pkg/**/*.go' | rg 'osimagestream|operator/osimagestream'
printf '\n== Search for ReleaseImageStream field and callers across the repo ==\n'
rg -n -S 'ReleaseImageStream|ReleaseImage:' . --type=go
printf '\n== Show the CreateOptions definition and Create implementation ==\n'
sed -n '1,220p' pkg/osimagestream/osimagestream.go
printf '\n== Show osImageStreamRequiresRebuild ==\n'
sed -n '1,220p' pkg/operator/osimagestream_ocp.goRepository: openshift/machine-config-operator Length of output: 21155 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '\n== cmd/machine-config-osimagestream/helpers.go ==\n'
wc -l cmd/machine-config-osimagestream/helpers.go
sed -n '1,160p' cmd/machine-config-osimagestream/helpers.go
printf '\n== pkg/operator/osimagestream_ocp.go rebuild logic ==\n'
sed -n '300,380p' pkg/operator/osimagestream_ocp.go
printf '\n== osimagestream tests covering ReleaseImageStream ==\n'
sed -n '230,520p' pkg/osimagestream/osimagestream_test.goRepository: openshift/machine-config-operator Length of output: 17336 🏁 Script executed: #!/bin/bash
set -euo pipefail
# Show the CLI helper that populates CreateOptions and the rebuild predicate.
sed -n '1,140p' cmd/machine-config-osimagestream/helpers.go
sed -n '315,360p' pkg/operator/osimagestream_ocp.go
# Find every Create(...) call site and whether ReleaseImage is passed alongside ReleaseImageStream.
rg -n -C 4 'Create\(' cmd pkg --type=goRepository: openshift/machine-config-operator Length of output: 50389 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '\n== bootstrap CreateOptions around the call site ==\n'
sed -n '500,545p' pkg/controller/bootstrap/bootstrap.go
printf '\n== CLI option struct and flag wiring ==\n'
rg -n -C 4 'type getOpts|releaseImage|imageStreamPath|imageStream' cmd/machine-config-osimagestream --type=go
printf '\n== Any validation that requires releaseImage when imageStreamPath is used ==\n'
rg -n -C 4 'imageStreamPath|releaseImage' cmd/machine-config-osimagestream --type=goRepository: openshift/machine-config-operator Length of output: 14495 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '\n== ReleasePayloadImageAnnotationKey usage ==\n'
rg -n -C 3 'ReleasePayloadImageAnnotationKey' . --type=go
printf '\n== Any tests asserting the annotation value on OSImageStream creation ==\n'
rg -n -C 3 'ReleasePayloadImageAnnotationKey|Release Image digest|release image annotation' pkg cmd --type=go
printf '\n== Any code paths that read the annotation outside osImageStreamRequiresRebuild ==\n'
rg -n -C 3 'ReleasePayloadImageAnnotationKey' pkg cmd --type=goRepository: openshift/machine-config-operator Length of output: 10810 Pass the resolved release image here
🤖 Prompt for AI Agents
Contributor
Author
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. So it's not stale on every reconcile, just the first reconcile post-bootstrap I believe. The first reconcile should be writing the correct stream for future syncs 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. Oops, something went wrong! Please try again later. 🐰 💔 |
||
|
|
||
| // newOSImageStream assembles the OSImageStream CR from the resolved streams, default, and existing spec. | ||
| func newOSImageStream(existing *mcfgv1.OSImageStream, streams []mcfgv1.OSImageStreamSet, defaultStream string) *mcfgv1.OSImageStream { | ||
| func newOSImageStream(existing *mcfgv1.OSImageStream, streams []mcfgv1.OSImageStreamSet, defaultStream, releaseImage string) *mcfgv1.OSImageStream { | ||
| if existing != nil { | ||
| defaultStream = existing.Spec.DefaultStream | ||
| } | ||
|
|
@@ -110,6 +110,7 @@ func newOSImageStream(existing *mcfgv1.OSImageStream, streams []mcfgv1.OSImageSt | |
| Name: ctrlcommon.ClusterInstanceNameOSImageStream, | ||
| Annotations: map[string]string{ | ||
| ctrlcommon.ReleaseImageVersionAnnotationKey: version.Hash, | ||
| ctrlcommon.ReleasePayloadImageAnnotationKey: releaseImage, | ||
| }, | ||
| }, | ||
| Spec: mcfgv1.OSImageStreamSpec{ | ||
|
|
||
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.
One thing, should we store the digest part only? If the image is mirrored using oc-mirror or similar the digest in disconnected envs will be preserved and no matter where the image is stored we won't rebuild. Not a blocker.
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.
Thanks for the note - I think re-mirroring shouldn't be a constant operation, so we should be fine with a extra rebuild once every so often. I lean towards keeping the full hash for now as a extra redundancy.
Given that you plan on improving the general process, I would lean towards doing this as a followup or rework (so that we don't have to conditionally rebuild). WDYT?
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 fine re-visting this later, let's go with the current state.