-
Notifications
You must be signed in to change notification settings - Fork 240
fix: don't ignore not found error in its controller #9823
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
base: main
Are you sure you want to change the base?
Conversation
|
Auto Cherry-pick Instructions |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9823 +/- ##
==========================================
+ Coverage 59.67% 59.71% +0.03%
==========================================
Files 551 551
Lines 59786 59786
==========================================
+ Hits 35679 35701 +22
+ Misses 20848 20826 -22
Partials 3259 3259
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Errors from status calls should also be wrapped to maintain consistency.
|
|
||
| func (b *PlanBuilder) createObject(ctx context.Context, vertex *model.ObjectVertex) error { | ||
| err := b.cli.Create(ctx, vertex.Obj, clientOption(vertex)) | ||
| if err != nil && !apierrors.IsAlreadyExists(err) { |
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.
The IsAlreadyExists error should be ignored too.
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.
You mean should NOT be ingored? I think ignoring IsAlreadyExists is safe. And similarly, I think ignoring IsNotFound in delete operations is also safe.
| } | ||
| if len(finalizer) > 0 && controllerutil.RemoveFinalizer(vertex.Obj, finalizer) { | ||
| err := b.cli.Update(ctx, vertex.Obj, clientOption(vertex)) | ||
| if err != nil && !apierrors.IsNotFound(err) { |
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.
Ditto.
| } | ||
| if !model.IsObjectDeleting(vertex.Obj) { | ||
| err := b.cli.Delete(ctx, vertex.Obj, clientOption(vertex)) | ||
| if err != nil && !apierrors.IsNotFound(err) { |
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.
Ditto.
| if err != nil && !apierrors.IsNotFound(err) { | ||
| b.transCtx.logger.Error(err, fmt.Sprintf("delete %T error: %s", vertex.Obj, vertex.Obj.GetName())) | ||
| return err | ||
| b.transCtx.logger.Error(err, fmt.Sprintf("delete %T error: %s", vertex.Obj, klog.KObj(vertex.Obj))) |
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.
Remove it.
When kb enables IN_PLACE_POD_VERTICAL_SCALING feature gate, but k8s does not, a vscale operation may fail in its because kube-apiserver does not have the "resize" subresource. ITS controller should error emit a warning event like:
But instead, its controller silently ignores this error and makes the reconcilation successful.