Skip to content

NO-ISSUE: Fix incorrect OSImageStreams log - #6338

Open
pablintino wants to merge 1 commit into
openshift:mainfrom
pablintino:fix-wrong-log
Open

NO-ISSUE: Fix incorrect OSImageStreams log#6338
pablintino wants to merge 1 commit into
openshift:mainfrom
pablintino:fix-wrong-log

Conversation

@pablintino

@pablintino pablintino commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

- What I did

The log that prints the available streams once discovered was using the lister instead of the recently built OSImageStream instance. The lister may not have updated the status (refreshed a few lines before) so what the log prints may be incorrect.

- How to verify it

e2e's are enough.

- Description for the changelog
Fix internal OSImageStream controller log that was printing an incorrect value because of a race condition.

Summary by CodeRabbit

  • Bug Fixes
    • Improved reliability and responsiveness of OS image stream synchronization by making sync work context-aware.
    • Enhanced initial-sync behavior to cache and reuse the active OS image stream instance, improving first-sync status logging accuracy and reducing unnecessary re-fetching.
    • Updated update-handling flow to return and reuse the latest OS image stream object, improving correctness during default status updates and error handling.

@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@openshift-ci-robot

Copy link
Copy Markdown
Contributor

@pablintino: This pull request explicitly references no jira issue.

Details

In response to this:

- What I did

The log that prints the available streams once discovered was using the lister instead of the recently built OSImageStream instance. The lister may not have updated the status (refreshed a few lines before) so what the log prints may be incorrect.

- How to verify it

e2e's are enough.

- Description for the changelog
Fix internal OSImageStream controller log that was printing an incorrect value because of a race condition.

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.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jul 24, 2026
@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: bada6269-a943-47af-80a0-e88f6be93b3b

📥 Commits

Reviewing files that changed from the base of the PR and between d0c6690 and 6b9f78b.

📒 Files selected for processing (1)
  • pkg/controller/osimagestream/osimagestream_controller.go

Walkthrough

The OSImageStream controller now propagates context through its worker flow. Build and update operations return the resulting object, allowing syncOSImageStream to reuse it for initial-sync success logging without refetching.

Changes

OSImageStream synchronization

Layer / File(s) Summary
Context propagation through controller workers
pkg/controller/osimagestream/osimagestream_controller.go
Run, worker processing, and syncOSImageStream now pass context.Context into synchronization.
Return updated OSImageStream results
pkg/controller/osimagestream/osimagestream_controller.go
Build and default-update paths return (*mcfgv1.OSImageStream, error), returning nil on failures and the existing, created, or updated object on success.
Reuse the current object during initial sync
pkg/controller/osimagestream/osimagestream_controller.go
syncOSImageStream tracks the rebuilt or updated object and uses it for first-sync success logging.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: sergiordlr, harshwardhanpatil07

🚥 Pre-merge checks | ✅ 15
✅ Passed checks (15 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main change: fixing an incorrect OSImageStream log value.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed No Ginkgo-style titles were added or changed; the touched test files use static Go Test functions and no dynamic It/Describe/Context names.
Test Structure And Quality ✅ Passed No Ginkgo tests were changed; the PR only modifies the controller file, so this test-structure check is not applicable.
Microshift Test Compatibility ✅ Passed No tests were added or modified; the PR only changes osimagestream controller code, so MicroShift test compatibility is not applicable.
Single Node Openshift (Sno) Test Compatibility ✅ Passed No new Ginkgo/e2e tests were added; the PR only changes the OSImageStream controller implementation.
Topology-Aware Scheduling Compatibility ✅ Passed Only OSImageStream controller sync/logging changed; no pod specs, affinity, node selectors, replicas, or topology-aware scheduling logic were added.
Ote Binary Stdout Contract ✅ Passed No process-level stdout writes were added; the diff only changes controller sync plumbing and keeps logging in library-level klog calls.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed No new Ginkgo e2e tests were added; the PR only changes osimagestream controller logic, so IPv4/disconnected-network test compatibility is not applicable.
No-Weak-Crypto ✅ Passed Changed controller code only adds context plumbing/logging; no weak crypto primitives, custom crypto, or secret/token comparisons were introduced.
Container-Privileges ✅ Passed Only a controller Go file changed; no K8s/container manifests or privilege-related settings (privileged, hostPID, hostNetwork, hostIPC, SYS_ADMIN, allowPrivilegeEscalation) were introduced.
No-Sensitive-Data-In-Logs ✅ Passed The changed log only prints OSImageStream set names and the default stream; GetStreamSetsNames returns names only, with no secrets, PII, or hostnames.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@openshift-ci

openshift-ci Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: pablintino

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

The pull request process is described here

Details 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-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 24, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/controller/osimagestream/osimagestream_controller.go`:
- Around line 296-300: Update handleOSImageStreamUpdate and its caller so the
helper returns the updated object, then assign that returned object to current
in the existing != nil path. Propagate any error while preserving the current
behavior for unchanged streams, ensuring initial-sync logging uses the updated
Status.DefaultStream.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 20884649-2b66-4fa4-a4fb-de1fa3a3f68d

📥 Commits

Reviewing files that changed from the base of the PR and between 57a219b and 1c7790f.

📒 Files selected for processing (1)
  • pkg/controller/osimagestream/osimagestream_controller.go

Comment thread pkg/controller/osimagestream/osimagestream_controller.go Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pkg/controller/osimagestream/osimagestream_controller.go`:
- Around line 289-301: Update syncOSImageStream and its callers to accept and
propagate the worker/lifecycle context instead of creating context.TODO() for
buildOSImageStream and handleOSImageStreamUpdate. Ensure the same cancellable
context reaches the underlying Create, Update, and UpdateStatus calls,
preserving cancellation during shutdown; alternatively wrap the sync operation
in an appropriate bounded timeout.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: dcce8326-4df1-4af0-9e7d-20fc521bb707

📥 Commits

Reviewing files that changed from the base of the PR and between 1c7790f and d0c6690.

📒 Files selected for processing (1)
  • pkg/controller/osimagestream/osimagestream_controller.go

Comment thread pkg/controller/osimagestream/osimagestream_controller.go
The log that prints the available streams once discovered was using the
lister instead of the recently built OSImageStream instance. The lister
may not have updated the status (refreshed a few lines before) so what
the log prints may be incorrect.

Signed-off-by: Pablo Rodriguez Nava <git@amail.pablintino.eu>
@openshift-ci

openshift-ci Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

@pablintino: all tests passed!

Full PR test history. Your PR dashboard.

Details

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.

@isabella-janssen

Copy link
Copy Markdown
Member

/hold

Holding to allow the Kube rebase to land in #6321. Please ensure this will not cause merge conflicts for the Kube rebase before unholding this PR.

@openshift-ci openshift-ci Bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 28, 2026
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. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants