core

package
v1.8.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 5, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// TODO remove dependency on kubernetes see: https://github.com/kumahq/kuma/issues/2798
	Log                   = kube_log.Log
	NewLogger             = kuma_log.NewLogger
	NewLoggerTo           = kuma_log.NewLoggerTo
	NewLoggerWithRotation = kuma_log.NewLoggerWithRotation
	SetLogger             = kube_log.SetLogger
	Now                   = time.Now
	TempDir               = os.TempDir

	SetupSignalHandler = func() (context.Context, context.Context) {
		gracefulCtx, gracefulCancel := context.WithCancel(context.Background())
		ctx, cancel := context.WithCancel(context.Background())
		c := make(chan os.Signal, 3)
		signal.Notify(c, syscall.SIGINT, syscall.SIGTERM)
		go func() {
			s := <-c
			Log.Info("Received signal, stopping instance gracefully", "signal", s.String())
			gracefulCancel()
			s = <-c
			Log.Info("Received second signal, stopping instance", "signal", s.String())
			cancel()
			s = <-c
			Log.Info("Received third signal, force exit", "signal", s.String())
			os.Exit(1)
		}()
		return gracefulCtx, ctx
	}
)

Functions

func NewUUID

func NewUUID() string

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL