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
// 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 {

View file

@ -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)
}
}()