From 4e44064e75ebdf63c740cf2e13824298deca2d17 Mon Sep 17 00:00:00 2001 From: lucian Date: Fri, 29 Jul 2022 10:44:02 +0300 Subject: [PATCH] refactor GracefulStop (#36) --- cmd/rusid/sidecar.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmd/rusid/sidecar.go b/cmd/rusid/sidecar.go index 8fdf162..1596806 100644 --- a/cmd/rusid/sidecar.go +++ b/cmd/rusid/sidecar.go @@ -5,6 +5,8 @@ import ( "flag" "k8s.io/klog/v2" "net/http" + "syscall" + //_ "net/http/pprof" "os" "os/signal" @@ -88,7 +90,7 @@ func main() { func shutdownOnInterrupt(cancel func()) { c := make(chan os.Signal, 1) - signal.Notify(c, os.Interrupt) + signal.Notify(c, os.Interrupt, syscall.SIGTERM) go func() { <-c