sarapprover: ignore authz errors
This commit is contained in:
@@ -135,7 +135,11 @@ func (cc *CertificateController) processNextWorkItem() bool {
|
||||
|
||||
if err := cc.syncFunc(cKey.(string)); err != nil {
|
||||
cc.queue.AddRateLimited(cKey)
|
||||
utilruntime.HandleError(fmt.Errorf("Sync %v failed with : %v", cKey, err))
|
||||
if _, ignorable := err.(ignorableError); !ignorable {
|
||||
utilruntime.HandleError(fmt.Errorf("Sync %v failed with : %v", cKey, err))
|
||||
} else {
|
||||
glog.V(4).Infof("Sync %v failed with : %v", cKey, err)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -181,3 +185,17 @@ func (cc *CertificateController) syncFunc(key string) error {
|
||||
|
||||
return cc.handler(csr)
|
||||
}
|
||||
|
||||
// IgnorableError returns an error that we shouldn't handle (i.e. log) because
|
||||
// it's spammy and usually user error. Instead we will log these errors at a
|
||||
// higher log level. We still need to throw these errors to signal that the
|
||||
// sync should be retried.
|
||||
func IgnorableError(s string, args ...interface{}) ignorableError {
|
||||
return ignorableError(fmt.Sprintf(s, args...))
|
||||
}
|
||||
|
||||
type ignorableError string
|
||||
|
||||
func (e ignorableError) Error() string {
|
||||
return string(e)
|
||||
}
|
||||
|
Reference in New Issue
Block a user