-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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 <shibuuuu5@gmail.com>
Signed-off-by: sivchari <shibuuuu5@gmail.com>
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 <shibuuuu5@gmail.com>
Signed-off-by: sivchari <shibuuuu5@gmail.com>
Signed-off-by: sivchari <shibuuuu5@gmail.com>
Signed-off-by: sivchari <shibuuuu5@gmail.com>
Signed-off-by: sivchari <shibuuuu5@gmail.com>
Signed-off-by: sivchari <shibuuuu5@gmail.com>
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 <shibuuuu5@gmail.com>
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 <troy0820@users.noreply.github.com> Collect additional logs with CAPD log collector Signed-off-by: Alexandr Demicev <alexandr.demicev@suse.com> :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] <support@github.com> :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] <support@github.com> 🌱 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 <shibuuuu5@gmail.com> * fix: test * fix: owner cluster handling Signed-off-by: sivchari <shibuuuu5@gmail.com> * remove duplicated error Signed-off-by: sivchari <shibuuuu5@gmail.com> * remove log variable Signed-off-by: sivchari <shibuuuu5@gmail.com> * fix error handling when the controller reads the cluster Signed-off-by: sivchari <shibuuuu5@gmail.com> * revert test modification Signed-off-by: sivchari <shibuuuu5@gmail.com> * delete log Signed-off-by: sivchari <shibuuuu5@gmail.com> * remove unnecessary deletion Signed-off-by: sivchari <shibuuuu5@gmail.com> * add detail of error Signed-off-by: sivchari <shibuuuu5@gmail.com> --------- Signed-off-by: sivchari <shibuuuu5@gmail.com> Add nilIsZero to all KSM metric configs where needed Signed-off-by: Tobias Giese <tgiese@nvidia.com> sorted labels and annotations in alphabatical order Signed-off-by: hackeramitkumar <amit9116260192@gmail.com> 📖 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 <tgiese@nvidia.com> sorted labels and annotations in alphabatical order Signed-off-by: hackeramitkumar <amit9116260192@gmail.com> 📖 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 #