From ae42b6aeaa708e373ea126db5355aec0d0bf9311 Mon Sep 17 00:00:00 2001 From: motoki317 Date: Fri, 22 Nov 2024 21:19:18 +0900 Subject: [PATCH] fix: We do not need to account for readinessProbe requests since the probe is handled within ingress-nginx-controller and does not reach nginx process. --- internal/ingress/controller/nginx.go | 9 +++------ test/e2e/gracefulshutdown/k8s_async_shutdown.go | 4 ++-- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/internal/ingress/controller/nginx.go b/internal/ingress/controller/nginx.go index 945d6047bf..07978cee59 100644 --- a/internal/ingress/controller/nginx.go +++ b/internal/ingress/controller/nginx.go @@ -417,12 +417,9 @@ func (n *NGINXController) stopWait() { diff := st.Requests - lastRequests // We assume that there were no client requests to nginx, if and only if - // there were 0 to 2 increase in handled requests from the last scrape. - // 1 is to account for our own stub_status request from this method, - // and the other 1 is to account for the readinessProbe. - // Note that readinessProbe DO happen even when the pod is terminating. - // See: https://github.com/kubernetes/kubernetes/issues/122824#issuecomment-1899224434 - noChange := 0 <= diff && diff <= 2 + // there were 0 to 1 increase in handled requests from the last scrape - + // 1 is to account for our own stub_status request from this method. + noChange := 0 <= diff && diff <= 1 if noChange { noChangeTimes++ if noChangeTimes >= waitUntilNoConnectionsFor { diff --git a/test/e2e/gracefulshutdown/k8s_async_shutdown.go b/test/e2e/gracefulshutdown/k8s_async_shutdown.go index 9a4bc368d7..c627de2d3f 100644 --- a/test/e2e/gracefulshutdown/k8s_async_shutdown.go +++ b/test/e2e/gracefulshutdown/k8s_async_shutdown.go @@ -68,7 +68,7 @@ var _ = framework.IngressNginxDescribe("[Shutdown] Asynchronous shutdown", func( // therefore we are still receiving traffic while shutting down go func() { defer ginkgo.GinkgoRecover() - for i := 0; i < 120; i++ { + for i := 0; i < 30; i++ { f.HTTPDumbTestClient(). GET("/"). WithURL(fmt.Sprintf("http://%s/", ip)). @@ -76,7 +76,7 @@ var _ = framework.IngressNginxDescribe("[Shutdown] Asynchronous shutdown", func( Expect(). Status(http.StatusOK) - framework.Sleep(250 * time.Millisecond) + framework.Sleep(time.Second) } }()