kubernetes-sigs / kubernetes-sigs/node-readiness-controller
RuleReconciler returns RequeueAfter together with an error, which controller-runtime ignores and warns about
- Dominant language
- Go
- Stars
- 163
- Forks
- 74
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 9
Description
### What happened?
Five return sites in `internal/controller/nodereadinessrule_controller.go` (lines 147, 158, 165, 171 and 198 on `main`) return `ctrl.Result{RequeueAfter: time.Minute}, err`. controller-runtime discards `RequeueAfter` whenever the error is non-nil: the request goes back through the rate limiter with exponential backoff, and each such return logs `Warning: Reconciler returned both a result with either RequeueAfter or Requeue set and a non-nil error. RequeueAfter and Requeue will always be ignored if the error is non-nil.` (`pkg/internal/controller/controller.go:491-492` in v0.24.1, the version in `go.mod`). So the one-minute retry the code asks for is not what runs, and a persistent failure adds a warning line on every attempt. `NodeReconciler.Reconcile` returns `ctrl.Result{}, err` on the equivalent path (`node_controller.go:107`), so the two reconcilers disagree.
### Steps to Reproduce
Observed by reading, not by running. Any error that persists across reconciles of a rule, for example the invalid taint value in #467 or a status patch that keeps failing, will show the warning above in the controller log on each attempt, with the gap between attempts growing rather than staying at one minute.
### Expected Behavior
Either `return ctrl.Result{}, err`, so the documented backoff applies without the warning, or, if a fixed one-minute cadence is really wanted, log the error and return `RequeueAfter` with a nil error.
### Controller Version / Image Tag
main (commit 80f59f3)
### Kubernetes Version
Not applicable.
### Controller Logs
The controller-runtime warning quoted above.
### Additional Environment Details
Five-line change. #363 touches the same file, so whichever lands second rebases. I can send it once #466 is through, to keep one PR from me open here at a time.
Contributor guide
Research direction
Start in internal/controller/nodereadinessrule_controller.go at the five return sites on lines 147, 158, 165, 171, and 198, then compare the equivalent path in node_controller.go:107. Review controller-runtime v0.24.1 behavior at pkg/internal/controller/controller.go:491-492 and decide which retry semantics match the issue. Done means the rule reconciler no longer produces the warning and its retry behavior is intentional and covered by the existing checks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, kubernetes
- Domain
- infrastructure
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100