Closed trutx closed 3 years ago
Looks good, confirmed is working as expected
level":"error","ts":1602783834.0332706,"logger":"controller-runtime.controller","msg":"Reconciler error","controller":"alertspolicy","request":"default/my-policy","error":"Secret \"nr-api-key\" not found","stacktrace":"github.com/go-logr/zapr...
The initial idea in this PR was to surface the underlying errors that happen when
r.Client.Get()
ing an object from the API which is not found. So i.e. if we try to get a non-existingSecret
we'll now get the actual error instead of a misleadingapi key is blank
error.Additionally, all
Reconcile()
functions now returnctrl.Request{}, err
when ar.Client.Get()
error occurs, thus making use of the retry mechanism which is built-in into the controller.However, some of the strict pre-commit hooks started not passing because of a cyclomatic complexity of 21 in some
Reconcile()
functions, so I ultimately refactored a bunch of them. I basically moved the resource creation/update part out ofReconcile()
and into a newwriteNewRelicAlertCondition()
function.