-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Improve owner not found errors #4369
Improve owner not found errors #4369
Conversation
Signed-off-by: irbekrm <irbekrm@gmail.com>
/kind cleanup |
e2e tests are failing because Venafi Cloud is broken I think |
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.
/lgtm
Looks like a good improvement to me 👍
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: irbekrm, SgtCoDFish The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/test pull-cert-manager-e2e-v1-22 |
1 similar comment
/test pull-cert-manager-e2e-v1-22 |
What this PR does / why we need it:
This PR changes the utility function that enqueues the owner of a resource to not error, but instead log an info message if it does not find the owner in the informers cache.
This is to fix a situation where at the time when the controller is started (often after cert-manager upgrade, when folks are watching the logs) owned resources' handlers run when the owners are not yet in cache and cert-manager throws errors.
In the 'certificaterequests' control loop, we watch for changes to
Order
s and reconcile the owningCertificateRequest
. The owningCertificateRequest
is obtained by getting it from the informers' cache- see the getter func passed as argument toHandleOwnedResourceNamespacedFunc
.At the time when a controller starts each informer needs to sync and it appears that at that time the
Order
s handler runs before theCertificateRequest
s have been cached and we consistently get these errors on startup for eachOrder
present in the cluster:This seems confusing for users who are potentially debugging other issues as the errors reads as if cert-manager was not able to get the
CertificateRequest
from kube API server, see #4345 and various Slack chats here, here, here and other places.Special notes for your reviewer:
Alternatively this could have been solved by not looking up the owner object in cache in the handler, just enqueing the key, but I guess we still want to check that the owner exists and not do extra work if it is i.e deleted.
I considered whether this risks not showing users some actually important errors, but I think that if the owner is actually permanently not found the owned resource would eventually be garbage collected anyway.