Skip to content

Conversation

@PetterZhukov
Copy link

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

  • Has Go code change
  • Has CI related scripts change

Tests

  • Unit test
  • E2E test
  • Manual test
  • No code

Side effects

  • Breaking backward compatibility
  • Other side effects:

Related changes

  • Need to cherry-pick to the release branch
  • Need to update the documentation

Release Notes

Please refer to Release Notes Language Style Guide before writing the release note.

Fix the issue that instead of creating the resource in every sync cycle, first check whether it already exists because just use create-api will cause many 409 responses.

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Sep 25, 2025

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

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.

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Sep 25, 2025

Welcome @PetterZhukov! It looks like this is your first PR to pingcap/tidb-operator 🎉

@pingcap-cla-assistant
Copy link

pingcap-cla-assistant bot commented Sep 25, 2025

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ liubog2008
❌ PetterZhukov
You have signed the CLA already but the status is still pending? Let us recheck it.

@ti-chi-bot ti-chi-bot bot added the size/XS label Sep 25, 2025
@liubog2008
Copy link
Member

/run-all-tests

@liubog2008
Copy link
Member

/ok-to-test

@codecov-commenter
Copy link

codecov-commenter commented Sep 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (release-1.x@b7be2d8). Learn more about missing BASE report.

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           
Flag Coverage Δ
e2e 47.72% <100.00%> (?)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ti-chi-bot ti-chi-bot bot added size/S and removed size/XS labels Sep 29, 2025
@liubog2008
Copy link
Member

/run-all-tests

@liubog2008
Copy link
Member

/run-pull-e2e-kind-across-kubernetes

@liubog2008
Copy link
Member

cc @csuzhangxc

@liubog2008 liubog2008 changed the base branch from master to release-1.x November 20, 2025 06:40
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Nov 20, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign weekface for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@liubog2008
Copy link
Member

/run-all-tests

@liubog2008
Copy link
Member

/run-all-tests

@PetterZhukov
Copy link
Author

/run-all-tests

@PetterZhukov
Copy link
Author

@howardlau1999 may I ask what else I need to do

@liubog2008
Copy link
Member

/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)
Copy link
Member

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

Copy link
Member

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.

@liubog2008
Copy link
Member

/run-pull-e2e-kind
/run-pull-e2e-kind-across-kubernetes
/run-pull-e2e-kind-br
/run-pull-e2e-kind-tikv-scale-simultaneously

@csuzhangxc
Copy link
Member

/run-pull-e2e-kind

@csuzhangxc
Copy link
Member

/run-pull-e2e-kind-across-kubernetes

@csuzhangxc
Copy link
Member

/run-pull-e2e-kind-br

@csuzhangxc
Copy link
Member

/run-pull-e2e-kind-tikv-scale-simultaneously

@cicada-lewis
Copy link

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
We have fixed this at #6653

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tidb-operator v1.6.1 is not fully compatible with k8s v1.33.1, every 30 sec tidb-operator is trying to create second discovery service

5 participants