engine

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Running   = "Running"
	Suspended = "Suspended"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

type Engine struct {
	Logger                zerolog.Logger
	Mutex                 sync.Mutex
	Wl                    chan v1.Namespace
	MetricsServ           metrics.Server
	RunningNamespacesList map[string]time.Time
	RunningDuration       time.Duration
	Options               Options
}

func New

func New(opt Options) (*Engine, error)

New returns a new engine instance

func (*Engine) Suspender

func (eng *Engine) Suspender(ctx context.Context, cs *kubernetes.Clientset)

Suspender receives namespaces from Watcher and handles them. It means that it will read and write namespaces' annotations, and scale resources.

func (*Engine) Watcher

func (eng *Engine) Watcher(ctx context.Context, cs *kubernetes.Clientset)

Watcher periodically watches the namespaces, and add them to the engine watchlist if they have the 'kube-ns-suspender/desiredState' set.

type Options added in v0.3.0

type Options struct {
	WatcherIdle                       int
	RunningDuration                   string
	LogLevel                          string
	TZ                                string
	Prefix                            string
	DryRun, NoKubeWarnings, HumanLogs bool
	EmbededUI, WebUIOnly              bool
}

Jump to

Keyboard shortcuts

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