1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-14 11:57:48 +00:00
kyverno/cmd/internal/signal.go
Charles-Edouard Brétéché a0548898b7
refactor: move leader election code in internal package (#6854)
* refactor: move registry client init in internal package

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* refactor: move leader election code in internal package

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

---------

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-04-12 01:44:49 +08:00

18 lines
354 B
Go

package internal
import (
"context"
"os"
"os/signal"
"syscall"
"github.com/go-logr/logr"
)
var Context = context.Background()
func setupSignals(logger logr.Logger) (context.Context, context.CancelFunc) {
logger = logger.WithName("signals")
logger.Info("setup signals...")
return signal.NotifyContext(Context, os.Interrupt, syscall.SIGTERM)
}