Skip to content

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

Closed
emmahone wants to merge 2 commits into
operator-framework:masterfrom
emmahone:fix/update-pod-not-ready-log-inversion
Closed

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

Conversation

@emmahone

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.

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 and severity 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.

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.
Copilot AI review requested due to automatic review settings July 20, 2026 21:54
@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 Jul 20, 2026
@openshift-ci

openshift-ci Bot commented Jul 20, 2026

Copy link
Copy Markdown

Hi @emmahone. 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.

@openshift-ci
openshift-ci Bot requested review from oceanc80 and tmshort July 20, 2026 21:55
@openshift-ci

openshift-ci Bot commented Jul 20, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign pedjak for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

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.

Pull request overview

This PR corrects misleading logging in the gRPC registry reconciler when ensureUpdatePod returns the expected UpdateNotReadyErr during catalog polling, reducing noisy/error-level logs during normal update-pod startup behavior.

Changes:

  • Adjust log severity/message for UpdateNotReadyErr from Error with an inverted message to a Debug message indicating the update pod is not yet ready.
  • Add a regression unit test covering the polling-enabled “update pod exists but not ready” path and asserting UpdateNotReadyErr is returned unwrapped.
  • Introduce a small test helper to create a polling-enabled CatalogSource.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
pkg/controller/registry/reconciler/grpc.go Fixes log level/message for the benign UpdateNotReadyErr path in EnsureRegistryServer.
pkg/controller/registry/reconciler/grpc_test.go Adds regression coverage to ensure UpdateNotReadyErr is returned as-is when polling is enabled and the update pod isn’t ready.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}
if err := c.ensurePod(logger, source, sa, defaultPodSecurityConfig, overwritePod); err != nil {
logger.WithError(err).Error("error ensuring registry server: could not ensure registry pod")
return pkgerrors.Wrapf(err, "error ensuring pod: %s", pod.GetName())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If GetName() returns empty, then GetGeneratedName() should be used instead.

Comment thread pkg/controller/registry/reconciler/grpc.go
@grokspawn

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 Jul 21, 2026
@tmshort

tmshort commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

@emmahone Please address the Copilot comments.

Comment thread pkg/controller/registry/reconciler/grpc.go Outdated
Change message to be more clear this is not an error

Co-authored-by: Todd Short <tmshort@users.noreply.github.com>
Copilot AI review requested due to automatic review settings August 3, 2026 15:57

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.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Suppressed comments (1)

pkg/controller/registry/reconciler/grpc.go:348

  • The wrapped error message uses pod.GetName() here, but pod is a desired Pod object built via source.Pod(...) which uses GenerateName (so GetName() is typically empty until it’s created). This can produce an unhelpful message like ... pod: and also refers to the registry pod rather than the update pod being ensured.
		return pkgerrors.Wrapf(err, "error ensuring updated catalog source pod: %s", pod.GetName())

@pdudley

pdudley commented Aug 3, 2026

Copy link
Copy Markdown

Superseded by #3884 — same change plus the outstanding review feedback (GenerateName / catalog-source wrap / Debug wording), since Evan is unavailable.

@tmshort

tmshort commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

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

@emmahone

emmahone commented Aug 4, 2026

Copy link
Copy Markdown
Author

There is not an associated RH jira issue for this PR. This was something we found while investigating unrelated issues (OCPBUGS-95609).

EDIT: If we need a jira tracker, that is fine. Just let me know if that is required and I can make that jira.

@emmahone

emmahone commented Aug 4, 2026

Copy link
Copy Markdown
Author

Closing this PR as it was resubmitted under #3884

@emmahone emmahone closed this Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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