-
Notifications
You must be signed in to change notification settings - Fork 524
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: release-1.x
Are you sure you want to change the base?
feat: check resource exists before CreateOrUpdate #6472
Conversation
|
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. DetailsInstructions 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 🎉 |
|
|
|
/run-all-tests |
|
/ok-to-test |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## release-1.x #6472 +/- ##
==============================================
Coverage ? 47.72%
==============================================
Files ? 220
Lines ? 32316
Branches ? 0
==============================================
Hits ? 15422
Misses ? 15052
Partials ? 1842
🚀 New features to boost your workflow:
|
|
/run-all-tests |
|
/run-pull-e2e-kind-across-kubernetes |
|
cc @csuzhangxc |
|
[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. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/run-all-tests |
|
/run-all-tests |
|
/run-all-tests |
|
@howardlau1999 may I ask what else I need to do |
|
/run-all-tests |
| err := c.client.Create(context.TODO(), desired) | ||
| if errors.IsAlreadyExists(err) { | ||
| // 1. check whether object exists | ||
| 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.
Get directly to avoid get again if exist
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.
@PetterZhukov I left a comment about this pr. And you have to ensure all tests passed.
|
/run-pull-e2e-kind |
|
/run-pull-e2e-kind |
|
/run-pull-e2e-kind-across-kubernetes |
|
/run-pull-e2e-kind-br |
|
/run-pull-e2e-kind-tikv-scale-simultaneously |
|
Thank you very much for your PR. We’re sorry that we can’t accept it, as it has been pending for too long @PetterZhukov |
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.