-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Clean up Istio Servers of a ClusterIngress when deleting the ClusterIngress #3479
Clean up Istio Servers of a ClusterIngress when deleting the ClusterIngress #3479
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.
@ZhiminXiang: 0 warnings.
In response to this:
Fixes #
Proposed Changes
- Introduce
Finalizer
intoClusterIngress
- Clean up Istio Servers of a
ClusterIngress
when deleting the ClusterIngress
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
// finalizers: | ||
// - clusteringresses.networking.internal.knative.dev | ||
var ( | ||
// |
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.
// |
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
This LGTM, but I'm concerned that the Gateway will become a bottleneck / SPOF with this API. IIUC every ClusterIngress is going to be adding Server entries to a single resource. This is going to fail at some scale, we should press Istio for a better API (maybe I'm wrong?). |
Note: I'm obviously not suggestion you fix istio in this PR, leaving open for the other comment 😅 |
Yes, the Gateway is the single resource here. I will follow up with Istio team about this API. |
|
||
mergePatch := map[string]interface{}{ | ||
"metadata": map[string]interface{}{ | ||
"finalizers": finalizers.List(), |
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.
does the order of the finalizers matter?
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, the order does not matter.
An object is deleted when all of the finalizers are removed. The deletion order of finalizers does not matter.
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.
Then if it doesn't matter why do we check that our finalizer is the "first one" below?
} | ||
|
||
gatewayNames := gatewayNamesFromContext(ctx, ci) | ||
logger.Info("Cleaning up Gateway Servers") |
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.
log the key?
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
@@ -410,6 +438,14 @@ func gateway(name, namespace string, servers []v1alpha3.Server) *v1alpha3.Gatewa | |||
} | |||
} | |||
|
|||
func patchAddFinalizerAction(ingressName, finalizer string) clientgotesting.PatchActionImpl { | |||
action := clientgotesting.PatchActionImpl{} |
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.
initialize during creation.
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
/lgtm |
// If our Finalizer is first, delete the `Servers` from Gateway for this ClusterIngress, | ||
// and remove the finalizer. | ||
if len(ci.Finalizers) == 0 || ci.Finalizers[0] != clusterIngressFinalizer { | ||
if !finalizers.Has(clusterIngressFinalizer) { |
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 is now incorrect. We should ONLY process our finalizer when we are "next" (first).
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.
So if the order matters, we can't do Sets(x).List()
above either.
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.
I see. Thanks!
Now I use append
instead of doing Sets(x).List()
in order to keep the order of finalizers.
We also need to do the similar thing for the finalizers of Route.
The following is the coverage report on pkg/.
|
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.
/lgtm
/test pull-knative-serving-upgrade-tests |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mattmoor, ZhiminXiang The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Fixes #
Proposed Changes
Finalizer
intoClusterIngress
ClusterIngress
when deleting the ClusterIngress