-
Notifications
You must be signed in to change notification settings - Fork 562
fix(operatorconditions): don't retry on 404 #2679
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -93,39 +93,34 @@ var _ reconcile.Reconciler = &OperatorConditionReconciler{} | |
|
||
func (r *OperatorConditionReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { | ||
// Set up a convenient log object so we don't have to type request over and over again | ||
log := r.log.WithValues("request", req) | ||
log.V(2).Info("reconciling operatorcondition") | ||
log := r.log.WithValues("request", req).V(1) | ||
log.Info("reconciling") | ||
metrics.EmitOperatorConditionReconcile(req.Namespace, req.Name) | ||
|
||
operatorCondition := &operatorsv2.OperatorCondition{} | ||
err := r.Client.Get(context.TODO(), req.NamespacedName, operatorCondition) | ||
if err != nil { | ||
log.V(1).Error(err, "Unable to find operatorcondition") | ||
return ctrl.Result{}, err | ||
if err := r.Client.Get(ctx, req.NamespacedName, operatorCondition); err != nil { | ||
log.Info("Unable to find OperatorCondition") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
return ctrl.Result{}, client.IgnoreNotFound(err) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Non-nil errors returned from |
||
} | ||
|
||
err = r.ensureOperatorConditionRole(operatorCondition) | ||
if err != nil { | ||
log.V(1).Error(err, "Error ensuring OperatorCondition Role") | ||
return ctrl.Result{Requeue: true}, err | ||
if err := r.ensureOperatorConditionRole(operatorCondition); err != nil { | ||
log.Info("Error ensuring OperatorCondition Role") | ||
return ctrl.Result{}, err | ||
} | ||
|
||
err = r.ensureOperatorConditionRoleBinding(operatorCondition) | ||
if err != nil { | ||
log.V(1).Error(err, "Error ensuring OperatorCondition RoleBinding") | ||
return ctrl.Result{Requeue: true}, err | ||
if err := r.ensureOperatorConditionRoleBinding(operatorCondition); err != nil { | ||
log.Info("Error ensuring OperatorCondition RoleBinding") | ||
return ctrl.Result{}, err | ||
} | ||
|
||
err = r.ensureDeploymentEnvVars(operatorCondition) | ||
if err != nil { | ||
log.V(1).Error(err, "Error ensuring OperatorCondition Deployment EnvVars") | ||
return ctrl.Result{Requeue: true}, err | ||
if err := r.ensureDeploymentEnvVars(operatorCondition); err != nil { | ||
log.Info("Error ensuring OperatorCondition Deployment EnvVars") | ||
return ctrl.Result{}, err | ||
} | ||
|
||
err = r.syncOperatorConditionStatus(operatorCondition) | ||
if err != nil { | ||
log.V(1).Error(err, "Error syncing OperatorCondition Status") | ||
return ctrl.Result{Requeue: true}, err | ||
if err := r.syncOperatorConditionStatus(operatorCondition); err != nil { | ||
log.Info("Error syncing OperatorCondition Status") | ||
return ctrl.Result{}, err | ||
} | ||
|
||
return ctrl.Result{}, nil | ||
|
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.
V(1)
is debug level for the underlying logr implementation,zapr
.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.
lol - of course it is. Why would you call it...
Debug
...?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.
logr
doesn't have named levels, really. It has error logs and info logs. info logs can have varying degrees of importance, so the number reflects the verbosity. Higher number = higher verbosity.However logr is just an interface. There's an implementation of this interface for all the major logging libraries, so if the underlying implementation has named levels, they end up being mapped to a verbosity number in logr.
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.
Also... in logr, the verbosity is additive. So
log.V(1).V(1)
is the same aslog.V(2)
, It's somewhat misleading to saylog.V(1)
is equivalent toDebug
since it depends on what the base verbosity oflog
is.Uh oh!
There was an error while loading. Please reload this page.
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.
Yeah, I'm not sure I'm a huge fan of the
logr
api from a user perspective.I'll try to look for some more examples of this being used in the wild. Maybe there's some wrapper/conventions around setting the level that we're missing.