-
Notifications
You must be signed in to change notification settings - Fork 523
feat: check resource exists before CreateOrUpdate #6472
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: master
Are you sure you want to change the base?
feat: check resource exists before CreateOrUpdate #6472
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
Hi @PetterZhukov. Thanks for your PR. I'm waiting for a pingcap member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
|
Welcome @PetterZhukov! It looks like this is your first PR to pingcap/tidb-operator 🎉 |
|
|
| // 1. try to create and see if there is any conflicts | ||
| err := c.client.Create(context.TODO(), desired) | ||
| if errors.IsAlreadyExists(err) { | ||
| exist, err := c.Exist(client.ObjectKeyFromObject(desired), 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.
please also change the comment
|
/run-all-tests |
|
/ok-to-test |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6472 +/- ##
===========================================
- Coverage 57.19% 47.02% -10.18%
===========================================
Files 259 218 -41
Lines 33233 32124 -1109
===========================================
- Hits 19008 15105 -3903
- Misses 12291 15106 +2815
+ Partials 1934 1913 -21
🚀 New features to boost your workflow:
|
|
/run-all-tests |
|
/run-pull-e2e-kind-across-kubernetes |
|
cc @csuzhangxc |
What problem does this PR solve?
There will be a large number of 409 errors when confirming the existence of resources through creation operations in CreateOrUpdate
Modify the logic to confirm the existence of resources through Exist.
Closes #6234 #6322
What is changed and how does it work?
Code changes
Tests
Side effects
Related changes
Release Notes
Please refer to Release Notes Language Style Guide before writing the release note.