Skip to content
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

[TT-9420] Move status update out of CreateOrUpdate to prevent conflicts #642

Merged
merged 7 commits into from
Jul 18, 2023

Conversation

buraksekili
Copy link
Member

@buraksekili buraksekili commented Jul 12, 2023

Description

This PR moves Status updates in r.create method out of CreateOrUpdate function to prevent conflicts.

Related Issue

https://tyktech.atlassian.net/browse/TT-9420

Motivation and Context

While creating an APIDefintiion for the first time, the operations are handled in CreateOrUpdate where the reconciled object will be saved or updated. If before finishing the execution of CreateOrUpdate, any status update operation updates resourceVersion which causes conflicts and retriggers reconciliation.

Test Coverage For This Change

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • Make sure you are requesting to pull a topic/feature/bugfix branch (right side). If PRing from your fork, don't come from your master!
  • Make sure you are making a pull request against our master branch (left side). Also, it would be best if you started your change off our latest master.
  • Make sure you are updating CHANGELOG.md based on your changes.
  • My change requires a change to the documentation.
    • If you've changed APIs, describe what needs to be updated in the documentation.
  • I have updated the documentation accordingly.
  • If you've changed API models, please update CRDs.
    • make manifests
    • make helm
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • Check your code additions will not fail linting checks:
    • gofmt -s -w .
    • go vet ./...
    • golangci-lint run

@sonarcloud
Copy link

sonarcloud bot commented Jul 13, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@buraksekili buraksekili changed the title Fetch the resource before updating it [TT-9420] Move status update to out of CreateOrUpdate to prevent conflicts Jul 13, 2023
@buraksekili buraksekili changed the title [TT-9420] Move status update to out of CreateOrUpdate to prevent conflicts [TT-9420] Move status update out of CreateOrUpdate to prevent conflicts Jul 13, 2023
@buraksekili buraksekili marked this pull request as ready for review July 13, 2023 14:03
@buraksekili buraksekili requested a review from a team as a code owner July 13, 2023 14:03
@buraksekili buraksekili requested review from komalsukhani and removed request for a team July 13, 2023 14:03
@singhpr singhpr merged commit b8a4a51 into master Jul 18, 2023
14 checks passed
@singhpr singhpr deleted the fix/TT-9420/apidef-errors branch July 18, 2023 06:37
buger pushed a commit that referenced this pull request May 22, 2024
…ts (#642)

* Fetch the resource before updating it

Signed-off-by: Burak Sekili <[email protected]>

* copy object onto new one

Signed-off-by: Burak Sekili <[email protected]>

* Use Patch instead of update requests

Signed-off-by: Burak Sekili <[email protected]>

* Bring Status check to back

Signed-off-by: Burak Sekili <[email protected]>

* Move status update out of CreateOrUpdate

Signed-off-by: Burak Sekili <[email protected]>

---------

Signed-off-by: Burak Sekili <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants