mirror of
https://github.com/kyverno/kyverno.git
synced 2025-01-20 18:52:16 +00:00
a6c8c401ff
* feat: add signal in internal cmd package Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * logger Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
18 lines
354 B
Go
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)
|
|
}
|