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.
This commit is contained in:
motoki317 2024-11-22 21:19:18 +09:00
parent 4f43d4a78c
commit ae42b6aeaa
No known key found for this signature in database
2 changed files with 5 additions and 8 deletions

View file

@ -417,12 +417,9 @@ func (n *NGINXController) stopWait() {
diff := st.Requests - lastRequests diff := st.Requests - lastRequests
// We assume that there were no client requests to nginx, if and only if // 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. // 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, // 1 is to account for our own stub_status request from this method.
// and the other 1 is to account for the readinessProbe. noChange := 0 <= diff && diff <= 1
// 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
if noChange { if noChange {
noChangeTimes++ noChangeTimes++
if noChangeTimes >= waitUntilNoConnectionsFor { if noChangeTimes >= waitUntilNoConnectionsFor {

View file

@ -68,7 +68,7 @@ var _ = framework.IngressNginxDescribe("[Shutdown] Asynchronous shutdown", func(
// therefore we are still receiving traffic while shutting down // therefore we are still receiving traffic while shutting down
go func() { go func() {
defer ginkgo.GinkgoRecover() defer ginkgo.GinkgoRecover()
for i := 0; i < 120; i++ { for i := 0; i < 30; i++ {
f.HTTPDumbTestClient(). f.HTTPDumbTestClient().
GET("/"). GET("/").
WithURL(fmt.Sprintf("http://%s/", ip)). WithURL(fmt.Sprintf("http://%s/", ip)).
@ -76,7 +76,7 @@ var _ = framework.IngressNginxDescribe("[Shutdown] Asynchronous shutdown", func(
Expect(). Expect().
Status(http.StatusOK) Status(http.StatusOK)
framework.Sleep(250 * time.Millisecond) framework.Sleep(time.Second)
} }
}() }()