-
Notifications
You must be signed in to change notification settings - Fork 4
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
Controller: PendingError isn't actually an error #59
Conversation
@inteon I'll need a bit of time to refactor the tests. Could you take a look at the general idea of this PR? Thanks. |
I think you are making a valid point. There are two possible options: you fail permanently or you can retry reconciliation.
The relevant error types are PermanentError, PendingError and "normal error". So, maybe we should not log PendingErrors as "errors", but do we log normal errors (errors that might be transient) as errors? |
My concern is that we are conflating two things:
Currently, What I would recommend is to retire Since type Result struct {
// The Retry attempts are subject to an exponential backoff with an
// upper limit of 1 hour.
Retry bool
// Optional. It may be useful for the user to know why the signing is
// still in progress.
RetryReason string
// The SecCondition is useful to store information on the
// CertificateRequest (e.g., a polling ID).
SetCondition Condition
}
// The Sign func may return an error wrapped in TerminalError to signify that the
// signing process has stopped due to a problem that the implementor of Sign thinks
// can't be resolved by retrying. The Sign func doesn't return a Result when an
// error has been returned.
type Sign func(context.Context, CertificateRequestObject, v1alpha1.Issuer) (PEMBundle, Result, error) On an other topic, I went looking at the documentation around WDYT @inteon? |
f8cdd78
to
06af6a3
Compare
bb1a7db
to
c21fd90
Compare
Signed-off-by: Maël Valais <[email protected]>
Signed-off-by: Tim Ramlot <[email protected]>
c21fd90
to
8a07ee5
Compare
Signed-off-by: Tim Ramlot <[email protected]>
This is a great improvement to issuer-lib! |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: inteon 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 |
I dug a bit more into why users of the issuer-lib wouldn't see the recovery of errors by looking at the logs with the default logging level. For example, the logs would show this:
After inspecting the CertificateRequest (CR), the user of an implementation of issuer-lib would realize that the CR has succeeded since then but the logs don't reflect that. They would have expected a positive message saying that the controller has recovered:
Currently, users have to use the logr level 1 (referred as "debug" in the README) in order to see the success message, but the above "Retryable CertificateRequest error" message shows at logr level 0.
Note that the README is currently incorrect: it should say "Succeeded signing the CertificateRequest is logged at the level 1 (debug)":
I think the main reason for this mismatch is because we confused ourselves with
PendingError
. The type iserror
, it has "error" in its name, but it isn't an error after all. By mistake, we (the issuer-lib developers) ended up loggingPendingError
as an error i.e. at level 0 withlog.V(1).Error
(Error ignoresV(1)
entirely, that's why I say that we log it at level 0). These pending error messages get printed regardless of the logging level.What we really wanted is to only show these messages in "debug" mode, similarly as to how we currently log the "Succeeded signing certificate" messages at logr level 1. That way, the logging experience is consistent: someone debugging the logs will be able to see, in debug mode, the progression of the signing of the certificate as well as when it succeeded.
I also propose to change the message associated with the
PendingError
case. It isn't a failure sincePendingError
isn't an error.