INNER CODE UNIT · Go
newContext
mariadb-operator/mariadb-operator · cmd/init/main.go:46
func newContext() (context.Context, context.CancelFunc) {
return signal.NotifyContext(context.Background(), []os.Signal{
syscall.SIGINT,
syscall.SIGTERM,
syscall.SIGKILL,
syscall.SIGHUP,
syscall.SIGQUIT}...,
)
}
func getK8sClient() (client.Client, error) {
restConfig, err := ctrl.GetConfig()
if err != nil {
return nil, fmt.Errorf("error getting REST config: %v", err)
}
k8sClient, err := client.New(restConfig, client.Options{Scheme: scheme})
if err != nil {
return nil, fmt.Errorf("error creating Kubernetes client: %v", err)