-
Notifications
You must be signed in to change notification settings - Fork 100
Mgdapi 3472 3 #723
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
Mgdapi 3472 3 #723
Conversation
eguzki
left a comment
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.
The removeBackend is the key here.
What I would do is to list all the products (in the same namespace as the backend) and remove the current backend from the spec.BackendUsage map where it exists.
I find quite confusing the current implementation. Some clarification would help. Comparing to how I would implement, what is the benefit from this implementation?
I would never update the remote 3scale product entity. The 3scale will do when deleting the backend.
If the 3scale API call to delete the backend fails, the operator should create a openshift event for visibility.
The backend usages is not the only reference from the product to the backend being deleted. Application plan limits and pricing rules also have references to backends. Check out my description in the issue. You are here implementing option a
3e57de6 to
a1c9f5c
Compare
|
Hey @eguzki
The issue here however, was that the reconcile finazilers had to be moved only after backend is removed, this means that |
b49fc90 to
6fa196a
Compare
078a0f6 to
ae4c85b
Compare
| return ctrl.Result{}, err | ||
| } | ||
| } else { | ||
| return ctrl.Result{}, fmt.Errorf("product %s .status.ID is missing, cannot remove product", product.Spec.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.
same comment as for the backend controller
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.
Thanks
| // https://kubernetes.io/docs/concepts/workloads/controllers/garbage-collection/#foreground-cascading-deletion | ||
| if product.DeletionTimestamp != nil { | ||
| if product.GetDeletionTimestamp() != nil && controllerutil.ContainsFinalizer(product, productFinalizer) { | ||
| controllerutil.RemoveFinalizer(product, productFinalizer) |
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.
To be consistent with the backend controller, the finalizer should be removed after removing the product in 3scale
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.
done, thanks
| } | ||
|
|
||
| //Confirm that product has been removed | ||
| products, err := threescaleAPIClient.ListProducts() |
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.
no need to check. If the 3scale API does not return an error, the controller can assume it has been deleted.
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.
true, thanks Eguzki
|
/test test-e2e |
1 similar comment
|
/test test-e2e |
|
Code Climate has analyzed commit d82cc0b and detected 3 issues on this pull request. Here's the issue category breakdown:
View more on Code Climate. |
|
/test test-e2e |
|
good job 🎖️ |
|
/retest |
Jira issues: