shell_operator

package
v1.4.7 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 35 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var WaitQueuesTimeout = time.Second * 10

Functions

func RunDefaultDebugServer added in v1.4.0

func RunDefaultDebugServer(unixSocket, httpServerAddress string) (*debug.Server, error)

RunDefaultDebugServer initialized and run default debug server on unix and http sockets This method is also used in addon-operator

Types

type CombineResult

type CombineResult struct {
	BindingContexts []BindingContext
	MonitorIDs      []string
}

type ManagerEventsHandler

type ManagerEventsHandler struct {
	// contains filtered or unexported fields
}

func (*ManagerEventsHandler) Start

func (m *ManagerEventsHandler) Start()

Start runs events handler. This function is used in addon-operator

func (*ManagerEventsHandler) WithKubeEventHandler

func (m *ManagerEventsHandler) WithKubeEventHandler(fn func(kubeEvent KubeEvent) []task.Task)

WithKubeEventHandler sets custom function for event handling. This function is used inside addon-operator.

func (*ManagerEventsHandler) WithScheduleEventHandler

func (m *ManagerEventsHandler) WithScheduleEventHandler(fn func(crontab string) []task.Task)

WithScheduleEventHandler sets custom scheduler function. This function is used inside addon-operator.

type ShellOperator

type ShellOperator struct {

	// APIServer common http server for liveness and metrics endpoints
	APIServer *baseHTTPServer

	// MetricStorage collects and store metrics for built-in operator primitives, hook execution
	MetricStorage *metric_storage.MetricStorage
	// HookMetricStorage separate metric storage for metrics, which are returned by user hooks
	HookMetricStorage *metric_storage.MetricStorage
	KubeClient        *klient.Client
	ObjectPatcher     *object_patch.ObjectPatcher

	ScheduleManager   schedule_manager.ScheduleManager
	KubeEventsManager kube_events_manager.KubeEventsManager

	TaskQueues *queue.TaskQueueSet

	ManagerEventsHandler *ManagerEventsHandler

	HookManager hook.HookManager

	AdmissionWebhookManager  *admission.WebhookManager
	ConversionWebhookManager *conversion.WebhookManager
	// contains filtered or unexported fields
}

func Init added in v1.0.11

func Init() (*ShellOperator, error)

Init initialize logging, ensures directories and creates a ShellOperator instance with all dependencies.

func NewShellOperator

func NewShellOperator(ctx context.Context) *ShellOperator

func (*ShellOperator) AssembleCommonOperator added in v1.4.0

func (op *ShellOperator) AssembleCommonOperator(listenAddress, listenPort string, kubeEventsManagerLabels map[string]string) (err error)

AssembleCommonOperator instantiate common dependencies. These dependencies may be used for shell-operator derivatives, like addon-operator. requires listenAddress, listenPort to run http server for operator APIs

func (*ShellOperator) CombineBindingContextForHook

func (op *ShellOperator) CombineBindingContextForHook(q *queue.TaskQueue, t task.Task, stopCombineFn func(tsk task.Task) bool) *CombineResult

combineBindingContextForHook combines binding contexts from a sequence of task with similar hook name and task type into array of binding context and delete excess tasks from queue.

Also, sequences of binding contexts with similar group are compacted in one binding context.

If input task has no metadata, result will be nil. Metadata should implement HookNameAccessor, BindingContextAccessor and MonitorIDAccessor interfaces. DEV WARNING! Do not use HookMetadataAccessor here. Use only *Accessor interfaces because this method is used from addon-operator.

func (*ShellOperator) RegisterDebugConfigRoutes added in v1.4.0

func (op *ShellOperator) RegisterDebugConfigRoutes(dbgSrv *debug.Server, runtimeConfig *config.Config)

RegisterDebugConfigRoutes registers routes to manage runtime configuration. This method is also used in addon-operator

func (*ShellOperator) RegisterDebugHookRoutes added in v1.4.0

func (op *ShellOperator) RegisterDebugHookRoutes(dbgSrv *debug.Server)

RegisterDebugHookRoutes register routes for dumping queues

func (*ShellOperator) RegisterDebugQueueRoutes added in v1.4.0

func (op *ShellOperator) RegisterDebugQueueRoutes(dbgSrv *debug.Server)

RegisterDebugQueueRoutes register routes for dumping main queue this method is also used in addon-operator

func (*ShellOperator) SetupEventManagers added in v1.4.0

func (op *ShellOperator) SetupEventManagers()

SetupEventManagers instantiate queues and managers for schedule and Kubernetes events. This function is also used in the addon-operator

func (*ShellOperator) Shutdown

func (op *ShellOperator) Shutdown()

Shutdown pause kubernetes events handling and stop queues. Wait for queues to stop.

func (*ShellOperator) Start

func (op *ShellOperator) Start()

Start run the operator

func (*ShellOperator) Stop

func (op *ShellOperator) Stop()

Jump to

Keyboard shortcuts

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