Skip to content
This repository was archived by the owner on Oct 11, 2024. It is now read-only.

TT-6389 - Recreate nonexistent ApiDefinitions during update calls#566

Merged
singhpr merged 4 commits intomasterfrom
fix/TT-6389/recreate-nonexistent-apis
Feb 21, 2023
Merged

TT-6389 - Recreate nonexistent ApiDefinitions during update calls#566
singhpr merged 4 commits intomasterfrom
fix/TT-6389/recreate-nonexistent-apis

Conversation

@buraksekili
Copy link

Description

If ApiDefinition exists in the k8s state but not in Tyk, Operator fails to reconcile since the update method fails to update nonexistent ApiDefinition objects. In order to solve this issue, add an additional API call to verify the existence of an ApiDefinition. if the ApiDefinition does not exist, first try to create it; otherwise, just update it.

Related Issue

Whenever Operator tries to reconcile over nonexistent ApiDefinitions, the following errors are observed in Tyk Cloud (4.3.1):

{"level":"info","ts":1676274220.044372,"logger":"controllers.ApiDefinition","msg":"Call","ApiDefinition":"default/httpbin-blacklist","Method":"GET","URL":"${TYK_URL}/api/apis/ZGVmYXVsdC9odHRwYmluLWJsYWNrbGlzdA","Status":400}
{"level":"info","ts":1676274220.044399,"logger":"controllers.ApiDefinition","msg":"Bad Request","ApiDefinition":"default/httpbin-blacklist","body":"{\"Status\":\"Error\",\"Message\":\"Could not retrieve Api detail\",\"Meta\":null}"}

Motivation and Context

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

Signed-off-by: Burak Sekili <buraksekili@gmail.com>
@buraksekili buraksekili requested a review from a team as a code owner February 13, 2023 07:52
@buraksekili buraksekili requested review from komalsukhani and removed request for a team February 13, 2023 07:52
@buraksekili buraksekili changed the title Recreate nonexistent ApiDefinitions during update calls TT-6389 - Recreate nonexistent ApiDefinitions during update calls Feb 13, 2023
Signed-off-by: Burak Sekili <buraksekili@gmail.com>
…kTechnologies/tyk-operator into fix/TT-6389/recreate-nonexistent-apis
@sonarqubecloud
Copy link

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

@singhpr singhpr merged commit ad6dd3d into master Feb 21, 2023
@singhpr singhpr deleted the fix/TT-6389/recreate-nonexistent-apis branch February 21, 2023 08:26
buger pushed a commit that referenced this pull request May 22, 2024
* Recreate nonexistent ApiDefinitions during update calls

Signed-off-by: Burak Sekili <buraksekili@gmail.com>

* Update CHANGELOG.md

---------

Signed-off-by: Burak Sekili <buraksekili@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants