This repository was archived by the owner on Oct 11, 2024. It is now read-only.
Add an ad-hoc Tyk API call to verify non-existent Policies in delete method#558
Merged
komalsukhani merged 2 commits intomasterfrom Jan 11, 2023
Merged
Add an ad-hoc Tyk API call to verify non-existent Policies in delete method#558komalsukhani merged 2 commits intomasterfrom
komalsukhani merged 2 commits intomasterfrom
Conversation
…n operation Signed-off-by: Burak Sekili <buraksekili@gmail.com>
| // If the Policy does not exist, no need to reconcile again. Otherwise, return err and reconcile. | ||
| _, errTyk := klient.Universal.Portal().Policy().Get(ctx, policy.Status.PolID) | ||
| if opclient.IsNotFound(errTyk) { | ||
| return nil |
Contributor
There was a problem hiding this comment.
Instead of returning here, we should continue to perform operations defined below if.
err := r.updateStatusOfLinkedAPIs(ctx, policy, true)
if err != nil {
return err
}
err = klient.Universal.HotReload(ctx)
if err != nil {
r.Log.Error(err, "Failed to hot-reload Tyk after deleting a Policy",
"Policy", client.ObjectKeyFromObject(policy),
)
return err
}
Author
There was a problem hiding this comment.
I updated can you please re-review again? Now, the execution continues only if errTyk is 404. The other response codes 200 or even 500 make operator continue working.
…oes not found Signed-off-by: Burak Sekili <buraksekili@gmail.com>
|
Kudos, SonarCloud Quality Gate passed! |
komalsukhani
approved these changes
Jan 11, 2023
buger
pushed a commit
that referenced
this pull request
May 22, 2024
…method (#558) * Add an ad-hoc Tyk API call to verify non-existent Policies in deletion operation Signed-off-by: Burak Sekili <buraksekili@gmail.com> * Update if condition flow; so that the execution continues if Policy does not found Signed-off-by: Burak Sekili <buraksekili@gmail.com> Signed-off-by: Burak Sekili <buraksekili@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.








Description
The CI fails due to failures that occurred in security policy deletion. As of today, the Policy API on GW does not return
404while deleting non-existent Policies. Therefore, Operator tries to reconcile and cannot understand the existence of Policies. Until a fix is released on GW, this PR adds an additional step to verify the existence of Policy objects on Tyk level.Related Issue
https://github.com/TykTechnologies/tyk-operator/actions/runs/3873378749/jobs/6603330308#step:8:29
Motivation and Context
Test Coverage For This Change
Screenshots (if appropriate)
Types of changes
Checklist
master!masterbranch (left side). Also, it would be best if you started your change off our latestmaster.make manifestsmake helmgofmt -s -w .go vet ./...golangci-lint run