-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
🌱 Fix error handling when the resource is not found #10907
🌱 Fix error handling when the resource is not found #10907
Conversation
Signed-off-by: sivchari <[email protected]>
Signed-off-by: sivchari <[email protected]>
f0bb8a2
to
0b2867b
Compare
/assign |
/retitle 🐛 Fix error handling when the resource is not found |
/test help |
@chrischdi: The specified target(s) for
The following commands are available to trigger optional jobs:
Use
In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
/test pull-cluster-api-e2e-main |
@@ -152,16 +152,19 @@ func (r *KubeadmConfigReconciler) Reconcile(ctx context.Context, req ctrl.Reques | |||
if apierrors.IsNotFound(err) { | |||
return ctrl.Result{}, nil | |||
} | |||
// Error reading the object - requeue the request. | |||
log.Error(err, "Failed to fetch KubeadmConfig") |
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.
Just a quick first comment. We intentionally try to not log & return errors. The problem is that doing this leads to duplicate error messages in the logs (especially if this is done across multiple levels of a call stack)
(there are some exceptions, but only if we think there is some information that we should immediately surface (e.g. additional key value pairs from the logger)
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.
OK, I'd remove the log later.
The problem is that doing this leads to duplicate error messages in the logs
I've met the this problem many times and I was about to repeat same thing. Thank you for your good review.
Signed-off-by: sivchari <[email protected]>
Signed-off-by: sivchari <[email protected]>
Signed-off-by: sivchari <[email protected]>
Signed-off-by: sivchari <[email protected]>
Signed-off-by: sivchari <[email protected]>
Signed-off-by: sivchari <[email protected]>
cf38757
to
32083e4
Compare
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.
@sivchari one nit, otherwise happy to merge
Signed-off-by: sivchari <[email protected]>
Thx! /lgtm |
LGTM label has been added. Git tree hash: 70b49df707f05f5788970c3bdb0619686f6a9e3b
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: sbueringer The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Not sure if we have a good area label. logging describes at least a subset of the change |
/test pull-cluster-api-e2e-main |
Re-added the labels manually, damn race condition with Prow.. :) |
regenerate CRDs 🌱 test: improve autoscale tests for to/from zero and running autoscaler in bootstrap cluster (kubernetes-sigs#11082) * test: allow deploying autoscaler to management cluster * test: make machine pools optional in autoscaler test * test: implement optional scale from/to zero tests for autoscale * test: allow modification of apigroup for infrastructure * test: wait for rollouts to finish in autoscaler tests * test: drop cleaning up autoscaler for machine pools * review fix * add comment about AutoScaleFromZero * remove autoscale from zero test for unsupported MachinePools * review fixes update cert-manager to 1.15.3 Signed-off-by: Troy Connor <[email protected]> Collect additional logs with CAPD log collector Signed-off-by: Alexandr Demicev <[email protected]> :seedling: Bump tj-actions/changed-files in the all-github-actions group Bumps the all-github-actions group with 1 update: [tj-actions/changed-files](https://github.com/tj-actions/changed-files). Updates `tj-actions/changed-files` from 44.5.7 to 45.0.0 - [Release notes](https://github.com/tj-actions/changed-files/releases) - [Changelog](https://github.com/tj-actions/changed-files/blob/main/HISTORY.md) - [Commits](tj-actions/changed-files@c65cd88...40853de) --- updated-dependencies: - dependency-name: tj-actions/changed-files dependency-type: direct:production update-type: version-update:semver-major dependency-group: all-github-actions ... Signed-off-by: dependabot[bot] <[email protected]> :seedling: Bump google.golang.org/api Bumps the all-go-mod-patch-and-minor group with 1 update in the /hack/tools directory: [google.golang.org/api](https://github.com/googleapis/google-api-go-client). Updates `google.golang.org/api` from 0.193.0 to 0.194.0 - [Release notes](https://github.com/googleapis/google-api-go-client/releases) - [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md) - [Commits](googleapis/google-api-go-client@v0.193.0...v0.194.0) --- updated-dependencies: - dependency-name: google.golang.org/api dependency-type: direct:production update-type: version-update:semver-minor dependency-group: all-go-mod-patch-and-minor ... Signed-off-by: dependabot[bot] <[email protected]> 🌱 Fix error handling when the resource is not found (kubernetes-sigs#10907) * fix: error handling when the resource is not found Signed-off-by: sivchari <[email protected]> * fix: test * fix: owner cluster handling Signed-off-by: sivchari <[email protected]> * remove duplicated error Signed-off-by: sivchari <[email protected]> * remove log variable Signed-off-by: sivchari <[email protected]> * fix error handling when the controller reads the cluster Signed-off-by: sivchari <[email protected]> * revert test modification Signed-off-by: sivchari <[email protected]> * delete log Signed-off-by: sivchari <[email protected]> * remove unnecessary deletion Signed-off-by: sivchari <[email protected]> * add detail of error Signed-off-by: sivchari <[email protected]> --------- Signed-off-by: sivchari <[email protected]> Add nilIsZero to all KSM metric configs where needed Signed-off-by: Tobias Giese <[email protected]> sorted labels and annotations in alphabatical order Signed-off-by: hackeramitkumar <[email protected]> 📖 Fix CAPZ redirection links in quick-start page Trigger Build Trigger Build Add nilIsZero to all KSM metric configs where needed Signed-off-by: Tobias Giese <[email protected]> sorted labels and annotations in alphabatical order Signed-off-by: hackeramitkumar <[email protected]> 📖 Fix CAPZ redirection links in quick-start page Trigger Build 📖 Fix CAPZ redirection links in quick-start page
What this PR does / why we need it:
Currently, there is no unity to handle error when the resource is not found. So I added log and fixed error handling using apierrors.IsNotFound.
In additional, the controller of control plane used requeue when the error occurred, but this behavior should return error. So I fixed it.
Which issue(s) this PR fixes (optional, in
fixes #<issue number>(, fixes #<issue_number>, ...)
format, will close the issue(s) when PR gets merged):Fixes #