Skip to content
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

chore: Fix returning non-empty reconcile result and error #618

Merged

Conversation

jonathan-innis
Copy link
Member

Fixes #N/A

Description

Since controller-runtime kubernetes-sigs/controller-runtime#2451, a warning will be logged if a controller returns an error and a non-zero result (i.e. a result with a RequeueAfter).

This PR changes the logic of our current controllers to not return both a non-zero result and an error at the same time to prevent warnings from being fired.

2023-10-20T01:28:53.2764885Z     logger.go:130: 2023-10-20T01:28:53.275Z	INFO	common/expectations.go:573	2023-10-20T01:28:49.102Z	DEBUG	controller.awsnodetemplate	discovered security groups	{"commit": "dce7385", "awsnodetemplate": "serpentsunset-29-ahjs7gn4mu", "security-groups": ["sg-0273da947dae25bb0", "sg-09513f2623d9d9b79"]}
2023-10-20T01:28:53.2773218Z         2023-10-20T01:28:49.158Z	INFO	controller	Warning: Reconciler returned both a non-zero result and a non-nil error. The result will always be ignored if the error is non-nil and the non-nil error causes reqeueuing with exponential backoff. For more details, see: https://pkg.go.dev/sigs.k8s.io/controller-runtime/pkg/reconcile#Reconciler	{"commit": "dce7385", "controller": "awsnodetemplate", "controllerGroup": "karpenter.k8s.aws", "controllerKind": "***NodeTemplate", "***NodeTemplate": {"name":"serpentsunset-29-ahjs7gn4mu"}, "namespace": "", "name": "serpentsunset-29-ahjs7gn4mu", "reconcileID": "60c54480-e547-4b51-b312-4f2a603b1520"}
2023-10-20T01:28:53.2781222Z         2023-10-20T01:28:49.158Z	ERROR	controller	Reconciler error	{"commit": "dce7385", "controller": "awsnodetemplate", "controllerGroup": "karpenter.k8s.aws", "controllerKind": "***NodeTemplate", "***NodeTemplate": {"name":"serpentsunset-29-ahjs7gn4mu"}, "namespace": "", "name": "serpentsunset-29-ahjs7gn4mu", "reconcileID": "60c54480-e547-4b51-b312-4f2a603b1520", "error": "describing images, InvalidUserID.Malformed: Invalid user id: \"fakeOwnerValue\"\n\tstatus code: 400, request id: 197b5477-2067-4b51-9c8e-9162f8816402"}

How was this change tested?

make presubmit

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@jonathan-innis jonathan-innis requested a review from a team as a code owner October 20, 2023 05:40
@jonathan-innis jonathan-innis requested a review from njtran October 20, 2023 05:40
@jonathan-innis jonathan-innis enabled auto-merge (squash) October 20, 2023 05:41
Copy link
Contributor

@engedaam engedaam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

@jonathan-innis jonathan-innis merged commit e7fbaa2 into kubernetes-sigs:main Oct 20, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants