Skip to content

reconciler: fix inverted log message and level for UpdateNotReadyErr - #3884

Open
pdudley wants to merge 3 commits into
operator-framework:masterfrom
pdudley:fix/update-pod-not-ready-log-inversion
Open

reconciler: fix inverted log message and level for UpdateNotReadyErr#3884
pdudley wants to merge 3 commits into
operator-framework:masterfrom
pdudley:fix/update-pod-not-ready-log-inversion

Conversation

@pdudley

@pdudley pdudley commented Aug 3, 2026

Copy link
Copy Markdown

Description of the change:

When ensureUpdatePod returns UpdateNotReadyErr — the expected, benign signal that a new update pod hasn't yet reported ready — EnsureRegistryServer logged it at level=error with the message "ensure update pod error is not of type UpdateNotReadyErr". The ok branch fires precisely when the error is UpdateNotReadyErr, so the message was the exact opposite of what happened.

Also addresses review feedback from #3871:

  • Use pod.GetGenerateName() in the ensure-pod wrap (desired pods set GenerateName, so GetName() is empty).
  • Reference the catalog source name when wrapping update-pod ensure failures.
  • Keep the Debug message free of the word "error" (registry server update pod not yet ready).

Motivation for the change:

This mislabeled error was observed flooding logs in production environments where catalog registry pods have long startup times. Every reconcile tick during pod startup hit this path, producing a steady stream of misleading level=error messages that appeared to indicate a failed type-assertion, when the actual state was a completely normal pod-not-ready wait. This made triage and support significantly harder.

Architectural changes:

None. Control flow is unchanged — UpdateNotReadyErr is still returned as-is; only the log message/severity and error-wrap identifiers are corrected.

Testing remarks:

Added a regression unit test Grpc/PollingEnabled/UpdatePodNotReady/ReturnsUpdateNotReadyErr in grpc_test.go that verifies EnsureRegistryServer returns UpdateNotReadyErr (unmodified, not wrapped) when polling is enabled and an update pod exists but has not yet reported ready. All existing tests continue to pass.


Supersedes #3871 (original author unavailable; includes outstanding review feedback).

Credit: @emmahone for the original fix and test; @tmshort for the Debug message wording.

Summary by CodeRabbit

  • Bug Fixes

    • Improved error reporting when registry pods cannot be created or updated.
    • Reconciliation now preserves clear readiness errors for running but not-ready update pods.
    • Error messages include relevant catalog and pod details to make troubleshooting easier.
  • Tests

    • Added coverage for registry polling scenarios where an update pod is running but not ready.

emmahone and others added 3 commits August 3, 2026 16:38
When ensureUpdatePod returns UpdateNotReadyErr (the expected, benign
signal that a new update pod has not yet reported ready), EnsureRegistryServer
logged the error at level=error with the message "ensure update pod error
is not of type UpdateNotReadyErr" — the exact opposite of what happened.

The ok branch fires precisely when the error IS UpdateNotReadyErr, so
the message was backwards. Additionally, logging a normal pod-startup wait
at error level contributed to spurious error floods in environments where
registry pods have long startup times.

This commit:
- Checks for UpdateNotReadyErr before the generic error log, so the
  benign case never fires at level=error.
- Corrects the log message to "update pod not yet ready".
- Downgrades the log to Debug, since this is an expected polling state.
- Adds a regression unit test verifying EnsureRegistryServer returns
  UpdateNotReadyErr (unmodified) when a not-ready update pod is present.
Change message to be more clear this is not an error

Co-authored-by: Todd Short <tmshort@users.noreply.github.com>
Desired registry pods use GenerateName, so GetName() is empty and made
wrapped ensure-pod errors useless. Use GetGenerateName() instead, and
reference the catalog source when wrapping update-pod ensure failures.
Copilot AI review requested due to automatic review settings August 3, 2026 20:48
@openshift-ci
openshift-ci Bot requested review from oceanc80 and perdasilva August 3, 2026 20:49
@openshift-ci openshift-ci Bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Aug 3, 2026
@openshift-ci

openshift-ci Bot commented Aug 3, 2026

Copy link
Copy Markdown

Hi @pdudley. Thanks for your PR.

I'm waiting for a operator-framework member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

Copilot AI 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.

🟢 Ready to approve

The change is narrowly scoped to correcting logging/wrapping behavior for a known benign error path and includes a targeted regression test to prevent recurrence.

This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.

Pull request overview

This PR fixes misleading error-level logging in the gRPC catalog registry reconciler when an update pod is simply not ready yet (the expected UpdateNotReadyErr path), reducing noisy production logs while preserving existing control flow.

Changes:

  • Fix inverted UpdateNotReadyErr log message and lower severity from Error to Debug for the benign “not ready yet” case.
  • Improve error-wrap identifiers by using the registry pod GenerateName (since Name is empty for desired pods) and including the CatalogSource name for update-pod ensure failures.
  • Add a regression unit test covering the polling-enabled “update pod exists but not ready” behavior.
File summaries
File Description
pkg/controller/registry/reconciler/grpc.go Corrects log level/message for UpdateNotReadyErr and improves wrapped error identifiers for ensure-pod/update-pod failures.
pkg/controller/registry/reconciler/grpc_test.go Adds a unit test ensuring EnsureRegistryServer returns UpdateNotReadyErr unchanged when an update pod is running but not yet ready under polling.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Lite

We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.

@tmshort

tmshort commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

/ok-to-test

@openshift-ci openshift-ci Bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 3, 2026

@rashmigottipati rashmigottipati left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/ok-to-test

@tmshort

tmshort commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

@pdudley @emmahone is there a Red Hat Jira ticket associated with this fix?

@emmahone

emmahone commented Aug 4, 2026

Copy link
Copy Markdown

No jira associated. This bug was found while investigating a separate issue. If we need to make an OCPBUGS for this let us know and we can create that.

@tmshort tmshort closed this Aug 7, 2026
@tmshort tmshort reopened this Aug 7, 2026
@tmshort

tmshort commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

@CodeRabbit review
Was hoping that a close/reopen would trigger CodeRabbit

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

@tmshort I will review the current changes.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 1e27f45c-8338-4524-9c95-277e29194d2e

📥 Commits

Reviewing files that changed from the base of the PR and between 6b47aea and b04ce20.

📒 Files selected for processing (2)
  • pkg/controller/registry/reconciler/grpc.go
  • pkg/controller/registry/reconciler/grpc_test.go

📝 Walkthrough

Walkthrough

The gRPC registry reconciler now reports pod creation and update failures with adjusted error handling. Tests cover a polling-enabled catalog source whose running update pod is not ready.

Changes

CatalogSource readiness handling

Layer / File(s) Summary
Update pod errors and reconciliation coverage
pkg/controller/registry/reconciler/grpc.go, pkg/controller/registry/reconciler/grpc_test.go
Pod creation failures use the pod generate name. UpdateNotReadyErr is logged at debug level and returned unchanged. Other update pod failures include the catalog source name. Tests cover polling with a running but not-ready update pod.

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

Possibly related PRs

Suggested reviewers: perdasilva, oceanc80

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main fix to the inverted log message and log level for UpdateNotReadyErr.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

Error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions
The command is terminated due to an error: can't load config: unsupported version of the configuration: "" See https://golangci-lint.run/docs/product/migration-guide for migration instructions


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@tmshort

tmshort commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

/approve

@openshift-ci

openshift-ci Bot commented Aug 7, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tmshort

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 Aug 7, 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. ok-to-test Indicates a non-member PR verified by an org member that is safe to test.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants