From ef0888f25608d4bf012c22df7d31a5f1b2b76fdc Mon Sep 17 00:00:00 2001 From: SeanLy Date: Wed, 21 Apr 2021 15:29:49 +0800 Subject: [PATCH] [fix] improve k8s libs compatibility (#1542) * [fix] improve k8s libs compatibility * trigger tests --- cmd/core/main.go | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/cmd/core/main.go b/cmd/core/main.go index 572923796..fde44d935 100644 --- a/cmd/core/main.go +++ b/cmd/core/main.go @@ -22,11 +22,9 @@ import ( "fmt" "io" "os" - "os/signal" "path/filepath" "strconv" "strings" - "syscall" "time" "github.com/crossplane/crossplane-runtime/pkg/logging" @@ -217,7 +215,7 @@ func main() { setupLog.Info("starting the vela controller manager") - if err := mgr.Start(makeSignalHandler()); err != nil { + if err := mgr.Start(ctrl.SetupSignalHandler()); err != nil { setupLog.Error(err, "problem running manager") os.Exit(1) } @@ -280,21 +278,3 @@ func waitWebhookSecretVolume(certDir string, timeout, interval time.Duration) er } } } - -func makeSignalHandler() (stopCh <-chan struct{}) { - stop := make(chan struct{}) - c := make(chan os.Signal, 2) - - signal.Notify(c, os.Interrupt, syscall.SIGTERM) - - go func() { - <-c - close(stop) - - // second signal. Exit directly. - <-c - os.Exit(1) - }() - - return stop -}