-
Notifications
You must be signed in to change notification settings - Fork 40k
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 leaking ingress resources in federated ingress e2e test. #34652
Conversation
@@ -268,6 +276,15 @@ func deleteIngressOrFail(clientset *fedclientset.Clientset, namespace string, in | |||
framework.ExpectNoError(err, "Error deleting ingress %q from namespace %q", ingressName, namespace) | |||
} | |||
|
|||
// TODO: quinton: This is largely a cut 'n paste of the above. Yuck! Refactor as soon as we have a common interface implmented by both fedclientset.Clientset and kubeclientset.Clientset | |||
func deleteClusterIngressOrFail(clusterName string, clientset *kubeclientset.Clientset, namespace string, ingressName string) { |
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.
Instead of passing the clientset, you can pass IngressesGetter or IngressInterface or just a func(namespace, ingressName) that deletes the ingress. You wont need to duplicate the func then.
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.
Agreed, will do in followup PR.
lgtm with one suggestion |
@@ -64,7 +64,7 @@ var _ = framework.KubeDescribe("Federated ingresses [Feature:Federation]", func( | |||
|
|||
It("should be created and deleted successfully", func() { | |||
framework.SkipUnlessFederated(f.Client) | |||
|
|||
framework.SkipUnlessProviderIs("gce", "gke") // TODO: Federated ingress is not yet supported on non-GCP platforms. |
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!
framework.ExpectNoError(err, "Error deleting ingress %q in namespace %q", ingress.Name, ns) | ||
framework.ExpectNoError(err, "Error deleting ingress %q/%q in federation", ns, ingress.Name) | ||
for clusterName, cluster := range clusters { | ||
err := cluster.Ingresses(ns).Delete(ingress.Name, &v1.DeleteOptions{}) |
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.
Is there a reason you cannot use deleteClusterIngressOrFail()
here?
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.
Also, I think you need to do something akin to cleanupServiceShardsAndProviderResources()
(https://github.com/kubernetes/kubernetes/blob/master/test/e2e/federated-ingress.go#L139) to ensure the underlying cloud resources are cleaned up.
For an Ingress specific example, see the Ingress e2e test - https://github.com/kubernetes/kubernetes/blob/master/test/e2e/ingress_utils.go#L311
But let's get this PR in 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.
Regarding your first comment, I followed the existing style used for the deletion of the federated ingresses.
Agreed about the GCE resources. I'll add that in a separate PR.
@k8s-bot test this issue #IGNORE |
@k8s-bot test this [submit-queue is verifying that this PR is safe to merge] |
Automatic merge from submit-queue |
Commit found in the "release-1.4" branch appears to be this PR. Removing the "cherrypick-candidate" label. If this is an error find help to get your PR picked. |
…ck-of-#34652-origin-release-1.4 Automatic merge from submit-queue Automated cherry pick of kubernetes#34652 Cherry pick of kubernetes#34652 on release-1.4. kubernetes#34652: Fix leaking ingress resources in federated ingress e2e test.
Originally the federated ingresses were being deleted, but due to the lack of cascading deletion, the cluster ingresses were never being deleted, leading to leaked GCE loadbalancer resources. This fixes that.
This change is