Skip to content

Commit

Permalink
fix(shutdown): implement 5 seconds shutdown period
Browse files Browse the repository at this point in the history
will already help prevent false positives from other kubenurse pods when
trying to reach me_ingress through the ingress controller during
teardown. without this 5sec wait, in-flight requests from e.g. the
ingress controller will reach a pod that is already terminated.
Might not be sufficient for similar for "path" errors, as there is no
filter for terminating pods.

Signed-off-by: Clément Nussbaumer <[email protected]>
  • Loading branch information
clementnuss committed Dec 12, 2023
1 parent d1d568a commit cef5f2e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/kubenurse/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,12 @@ func (s *Server) Shutdown(ctx context.Context) error {
s.ready = false
s.mu.Unlock()

// wait 5 second before actually shutting down the http/s server, as the updated
// endpoints for the kubenurse service might not have propagated everywhere
// (other kubenurse/ingress controller) yet, which will lead to
// me_ingress or path errors in other pods
time.Sleep(5 * time.Second)

// stop the scheduled checker
s.checker.StopScheduled()

Expand Down

0 comments on commit cef5f2e

Please sign in to comment.