-
Notifications
You must be signed in to change notification settings - Fork 95
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
Fix tenant cascade deletion #747
Conversation
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.
This looks correct to me.
Sometimes the deletion of the API Backend will be accepted in 3scale regardless of existing associations with the API Product – i.e., when the parent Tenant has been marked for destruction as well –, while some other times it won't. This is subject to concurrency and cannot be predicted in cases of cascade deletion.
|
||
// Attempt to remove backend only if backend.Status.ID is present | ||
if backend.Status.ID == nil { | ||
logger.Info("could not remove backend because backend ID is missing for backend name") |
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.
if the ID is nil I think line 305 will be throwing nil pointer?
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.
good catch! I forgot the early return nil
} | ||
|
||
providerAccount, err := controllerhelper.LookupProviderAccount(r.Client(), backend.Namespace, backend.Spec.ProviderAccountRef, logger) | ||
if apierrors.IsNotFound(err) { |
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.
would it be cleaner that way:
if err != nil {
if apierrors.IsNotFound(err) {
logger.Info("backend not deleted from 3scale, provider account not found")
return nil
}
return err
}
Code Climate has analyzed commit e7f80b6 and detected 5 issues on this pull request. Here's the issue category breakdown:
View more on Code Climate. |
Code looks good to me, Good job! /lgtm |
what
Fix cascading deletion issue when provider account secret is not found
Verification steps