From b849ff57b850329331c439c67da61e24591bb7ad Mon Sep 17 00:00:00 2001 From: Antonio Ojea Date: Thu, 4 May 2023 13:04:52 +0000 Subject: [PATCH] e2e reasonable grace termination period timeout The existing termination period of 600 seconds for pods on the e2e test causes that those pods are kept running after the test has finished. 100 seconds is a good compromise to avoid leaving pods lingering and more than enought for the test to finish. Change-Id: I993162a77125345df1829044dc2514e03b13a407 --- test/e2e/network/service.go | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/test/e2e/network/service.go b/test/e2e/network/service.go index 7808c58d3bd..84c8bad8356 100644 --- a/test/e2e/network/service.go +++ b/test/e2e/network/service.go @@ -1765,7 +1765,7 @@ var _ = common.SIGDescribe("Services", func() { t.Name = "slow-terminating-unready-pod" t.Image = imageutils.GetE2EImage(imageutils.Agnhost) port := 80 - terminateSeconds := int64(600) + terminateSeconds := int64(100) service := &v1.Service{ ObjectMeta: metav1.ObjectMeta{ @@ -1987,7 +1987,7 @@ var _ = common.SIGDescribe("Services", func() { } // webserver should continue to serve traffic through the Service after delete since: - // - it has a 600s termination grace period + // - it has a 100s termination grace period // - it is unready but PublishNotReadyAddresses is true err = cs.CoreV1().Pods(ns).Delete(ctx, webserverPod0.Name, metav1.DeleteOptions{}) framework.ExpectNoError(err) @@ -2106,7 +2106,7 @@ var _ = common.SIGDescribe("Services", func() { } // webserver should stop to serve traffic through the Service after delete since: - // - it has a 600s termination grace period + // - it has a 100s termination grace period // - it is unready but PublishNotReadyAddresses is false err = cs.CoreV1().Pods(ns).Delete(ctx, webserverPod0.Name, metav1.DeleteOptions{}) framework.ExpectNoError(err) @@ -2733,9 +2733,9 @@ var _ = common.SIGDescribe("Services", func() { framework.ExpectNoError(err) ginkgo.By("Creating 1 webserver pod to be part of the TCP service") - webserverPod0 := e2epod.NewAgnhostPod(ns, "echo-hostname-0", nil, nil, nil, "netexec", "--http-port", strconv.Itoa(servicePort), "--delay-shutdown", "600") + webserverPod0 := e2epod.NewAgnhostPod(ns, "echo-hostname-0", nil, nil, nil, "netexec", "--http-port", strconv.Itoa(servicePort), "--delay-shutdown", "100") webserverPod0.Labels = jig.Labels - webserverPod0.Spec.TerminationGracePeriodSeconds = utilpointer.Int64(600) + webserverPod0.Spec.TerminationGracePeriodSeconds = utilpointer.Int64(100) e2epod.SetNodeSelection(&webserverPod0.Spec, e2epod.NodeSelection{Name: node0.Name}) _, err = cs.CoreV1().Pods(ns).Create(ctx, webserverPod0, metav1.CreateOptions{}) @@ -2821,9 +2821,9 @@ var _ = common.SIGDescribe("Services", func() { framework.ExpectNoError(err) ginkgo.By("Creating 1 webserver pod to be part of the TCP service") - webserverPod0 := e2epod.NewAgnhostPod(ns, "echo-hostname-0", nil, nil, nil, "netexec", "--http-port", strconv.Itoa(servicePort), "--delay-shutdown", "600") + webserverPod0 := e2epod.NewAgnhostPod(ns, "echo-hostname-0", nil, nil, nil, "netexec", "--http-port", strconv.Itoa(servicePort), "--delay-shutdown", "100") webserverPod0.Labels = jig.Labels - webserverPod0.Spec.TerminationGracePeriodSeconds = utilpointer.Int64(600) + webserverPod0.Spec.TerminationGracePeriodSeconds = utilpointer.Int64(100) e2epod.SetNodeSelection(&webserverPod0.Spec, e2epod.NodeSelection{Name: node0.Name}) _, err = cs.CoreV1().Pods(ns).Create(ctx, webserverPod0, metav1.CreateOptions{}) @@ -2847,7 +2847,7 @@ var _ = common.SIGDescribe("Services", func() { framework.ExpectNoError(e2epod.WaitTimeoutForPodReadyInNamespace(ctx, f.ClientSet, pausePod1.Name, f.Namespace.Name, framework.PodStartTimeout)) // webserver should continue to serve traffic through the Service after delete since: - // - it has a 600s termination grace period + // - it has a 100s termination grace period // - it is the only ready endpoint err = cs.CoreV1().Pods(ns).Delete(ctx, webserverPod0.Name, metav1.DeleteOptions{}) framework.ExpectNoError(err) @@ -2896,9 +2896,9 @@ var _ = common.SIGDescribe("Services", func() { framework.ExpectNoError(err) ginkgo.By("Creating 1 webserver pod to be part of the TCP service") - webserverPod0 := e2epod.NewAgnhostPod(ns, "echo-hostname-0", nil, nil, nil, "netexec", "--http-port", strconv.Itoa(servicePort), "--delay-shutdown", "600") + webserverPod0 := e2epod.NewAgnhostPod(ns, "echo-hostname-0", nil, nil, nil, "netexec", "--http-port", strconv.Itoa(servicePort), "--delay-shutdown", "100") webserverPod0.Labels = jig.Labels - webserverPod0.Spec.TerminationGracePeriodSeconds = utilpointer.Int64(600) + webserverPod0.Spec.TerminationGracePeriodSeconds = utilpointer.Int64(100) e2epod.SetNodeSelection(&webserverPod0.Spec, e2epod.NodeSelection{Name: node0.Name}) _, err = cs.CoreV1().Pods(ns).Create(ctx, webserverPod0, metav1.CreateOptions{}) @@ -2922,7 +2922,7 @@ var _ = common.SIGDescribe("Services", func() { framework.ExpectNoError(e2epod.WaitTimeoutForPodReadyInNamespace(ctx, f.ClientSet, pausePod1.Name, f.Namespace.Name, framework.PodStartTimeout)) // webserver should continue to serve traffic through the Service after delete since: - // - it has a 600s termination grace period + // - it has a 100s termination grace period // - it is the only ready endpoint err = cs.CoreV1().Pods(ns).Delete(ctx, webserverPod0.Name, metav1.DeleteOptions{}) framework.ExpectNoError(err) @@ -2973,9 +2973,9 @@ var _ = common.SIGDescribe("Services", func() { framework.ExpectNoError(err) ginkgo.By("Creating 1 webserver pod to be part of the TCP service") - webserverPod0 := e2epod.NewAgnhostPod(ns, "echo-hostname-0", nil, nil, nil, "netexec", "--http-port", strconv.Itoa(servicePort), "--delay-shutdown", "600") + webserverPod0 := e2epod.NewAgnhostPod(ns, "echo-hostname-0", nil, nil, nil, "netexec", "--http-port", strconv.Itoa(servicePort), "--delay-shutdown", "100") webserverPod0.Labels = jig.Labels - webserverPod0.Spec.TerminationGracePeriodSeconds = utilpointer.Int64(600) + webserverPod0.Spec.TerminationGracePeriodSeconds = utilpointer.Int64(100) e2epod.SetNodeSelection(&webserverPod0.Spec, e2epod.NodeSelection{Name: node0.Name}) _, err = cs.CoreV1().Pods(ns).Create(ctx, webserverPod0, metav1.CreateOptions{}) @@ -2999,7 +2999,7 @@ var _ = common.SIGDescribe("Services", func() { framework.ExpectNoError(e2epod.WaitTimeoutForPodReadyInNamespace(ctx, f.ClientSet, pausePod1.Name, f.Namespace.Name, framework.PodStartTimeout)) // webserver should continue to serve traffic through the Service after delete since: - // - it has a 600s termination grace period + // - it has a 100s termination grace period // - it is the only ready endpoint err = cs.CoreV1().Pods(ns).Delete(ctx, webserverPod0.Name, metav1.DeleteOptions{}) framework.ExpectNoError(err) @@ -3049,9 +3049,9 @@ var _ = common.SIGDescribe("Services", func() { framework.ExpectNoError(err) ginkgo.By("Creating 1 webserver pod to be part of the TCP service") - webserverPod0 := e2epod.NewAgnhostPod(ns, "echo-hostname-0", nil, nil, nil, "netexec", "--http-port", strconv.Itoa(servicePort), "--delay-shutdown", "600") + webserverPod0 := e2epod.NewAgnhostPod(ns, "echo-hostname-0", nil, nil, nil, "netexec", "--http-port", strconv.Itoa(servicePort), "--delay-shutdown", "100") webserverPod0.Labels = jig.Labels - webserverPod0.Spec.TerminationGracePeriodSeconds = utilpointer.Int64(600) + webserverPod0.Spec.TerminationGracePeriodSeconds = utilpointer.Int64(100) e2epod.SetNodeSelection(&webserverPod0.Spec, e2epod.NodeSelection{Name: node0.Name}) _, err = cs.CoreV1().Pods(ns).Create(ctx, webserverPod0, metav1.CreateOptions{}) @@ -3075,7 +3075,7 @@ var _ = common.SIGDescribe("Services", func() { framework.ExpectNoError(e2epod.WaitTimeoutForPodReadyInNamespace(ctx, f.ClientSet, pausePod1.Name, f.Namespace.Name, framework.PodStartTimeout)) // webserver should continue to serve traffic through the Service after delete since: - // - it has a 600s termination grace period + // - it has a 100s termination grace period // - it is the only ready endpoint err = cs.CoreV1().Pods(ns).Delete(ctx, webserverPod0.Name, metav1.DeleteOptions{}) framework.ExpectNoError(err)