Repository navigation
Fix #8994 (approach A): widen return type to metav1.Object - #9004
cert-manager-prow[bot] merged 1 commit into
Conversation
Change the return type of EnqueueCertificatesForResourceUsingPredicates from func(U) to func(metav1.Object), adding an internal type assertion that silently skips objects that do not match the concrete type U. This is the minimal fix for the log spam described in cert-manager#8994, caused by the metadata informer delivering *v1.PartialObjectMetadata to a handler typed as func(*corev1.Secret). The return type change makes the handler accept both concrete types from the filtered Secret informer. Fixes: cert-manager#8994 Signed-off-by: Richard Wall <[email protected]> Co-Authored-By: Claude <[email protected]> Signed-off-by: Richard Wall <[email protected]>
erikgb
left a comment
There was a problem hiding this comment.
/lgtm
/approve
/hold
This looks like the simplest quickfix to me. Adding a hold to allow others to chime in.
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: erikgb The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
Updated the description above with the release note and CI log evidence confirming the log spam is gone (0 occurrences in this PR's e2e run vs. 2,065 in the baseline log linked from #8994). Adding this as a comment too since Prow doesn't re-scan the description for label triggers after the fact. /kind bug |
|
/hold cancel |
|
@wallrj-cyberark: once the present PR merges, I will cherry-pick it on top of DetailsIn response to this:
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. |
|
@wallrj-cyberark: new pull request created: #9037 DetailsIn response to this:
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. |
Summary
Minimal fix for #8994 — change the return type of
EnqueueCertificatesForResourceUsingPredicatesfromfunc(U)tofunc(metav1.Object)and add an internal type assertion.*v1.PartialObjectMetadatato handlersthat were previously typed as
func(*corev1.Secret), causing failedtype assertions and log spam.
metav1.Object, theninternally asserts to
U(e.g.*corev1.Secret) — silently skippingobjects that do not match. This is safe because only the typed informer
delivers labelled Secrets; metadata events for non-labelled Secrets are
correctly ignored by the certificate sub-controllers.
This is the smallest possible fix and suitable for backport to
release-1.21.See also:
handler.TypedEventHandler): Fix #8994 (approach C): adopt controller-runtime TypedEventHandler #9006All three PRs target
masterfor review and CI; they are mutuallyexclusive approaches to the same issue.
Motivation
#8994 — discovered shortly after the 1.21.0
release. The generics refactor in #8407 changed the handler signature
from
func(interface{})tofunc(U), which broke the dual-informerSecret handler path.
Test plan
go test ./pkg/controller/certificates/...— all passgo test ./pkg/controller/—TestBlockingEventHandler,TestFilterEventHandlerpassguard
Testing evidence: log spam confirmed fixed in CI
Compared the controller log from this PR's own e2e run against the exact
log linked in #8994's original report:
release-1.21periodic jobpull-cert-manager-master-e2e-v1-36(job succeeded)OnAdd/OnUpdate/OnDeletemissing-object errorsSanity-checked this isn't a false negative from an idle run: the metadata
informer for Secrets is confirmed active in this PR's run
(
"Caches populated" type="*v1.PartialObjectMetadata"at startup), andthere's substantial Secret-related activity throughout (certificate
re-issuance, secret lookups, ~1,285 secret-related log lines) — so the
code path that previously spammed was live and exercised, and is silent
under this fix.
Note on the total line-count difference (4,530 vs. 13,131): this is
explained by run duration, not test scope. The baseline log spans
6m05s (11:34:20–11:40:25) vs. 14m33s (12:36:29–12:51:02) for this PR's
run — a 2.4x longer run. Per-second log rates are comparable (12.4
lines/s baseline vs. 15.0 lines/s here), so the extra lines are simply
from running longer, not from a lighter/different test suite. If
anything this strengthens the result: the baseline log's last 10 lines
are still mid-spam (
OnUpdate missing ObjectOld,OnDelete missing Object), suggesting that artifact is a truncated snapshot of a longerrun rather than a graceful end-of-job log — so the true baseline spam
count over a comparable window would likely be higher, not lower. This
PR's run logged at an equal-or-higher rate over more wall-clock time
and produced zero occurrences of the error.
Release Note