Skip to content

Commit

Permalink
fix: We do not need to account for readinessProbe requests
Browse files Browse the repository at this point in the history
since the probe is handled within ingress-nginx-controller and
does not reach nginx process.
  • Loading branch information
motoki317 committed Nov 28, 2024
1 parent 4f43d4a commit ae42b6a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
9 changes: 3 additions & 6 deletions internal/ingress/controller/nginx.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/gracefulshutdown/k8s_async_shutdown.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@ 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)).
WithHeader("Host", host).
Expect().
Status(http.StatusOK)

framework.Sleep(250 * time.Millisecond)
framework.Sleep(time.Second)
}
}()

Expand Down

0 comments on commit ae42b6a

Please sign in to comment.