Documentation ¶
Index ¶
- Variables
- func RunDefaultDebugServer(unixSocket, httpServerAddress string, logger *unilogger.Logger) (*debug.Server, error)
- type CombineResult
- type ManagerEventsHandler
- type ShellOperator
- func (op *ShellOperator) AssembleCommonOperator(listenAddress, listenPort string, kubeEventsManagerLabels map[string]string) (err error)
- func (op *ShellOperator) CombineBindingContextForHook(q *queue.TaskQueue, t task.Task, stopCombineFn func(tsk task.Task) bool) *CombineResult
- func (op *ShellOperator) RegisterDebugConfigRoutes(dbgSrv *debug.Server, runtimeConfig *config.Config)
- func (op *ShellOperator) RegisterDebugHookRoutes(dbgSrv *debug.Server)
- func (op *ShellOperator) RegisterDebugQueueRoutes(dbgSrv *debug.Server)
- func (op *ShellOperator) SetupEventManagers()
- func (op *ShellOperator) Shutdown()
- func (op *ShellOperator) Start()
- func (op *ShellOperator) Stop()
Constants ¶
This section is empty.
Variables ¶
var WaitQueuesTimeout = time.Second * 10
Functions ¶
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.Manager AdmissionWebhookManager *admission.WebhookManager ConversionWebhookManager *conversion.WebhookManager // contains filtered or unexported fields }
func Init ¶ added in v1.0.11
func Init(logger *unilogger.Logger) (*ShellOperator, error)
Init initialize logging, ensures directories and creates a ShellOperator instance with all dependencies.
func NewShellOperator ¶
func NewShellOperator(ctx context.Context, logger *unilogger.Logger) *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) Stop ¶
func (op *ShellOperator) Stop()