addon_operator

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2022 License: Apache-2.0 Imports: 32 Imported by: 3 modules, 3 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultHelmMonitorKubeClientMetricLabels = map[string]string{"component": "helm_monitor"}

Important! These labels should be consistent with similar labels in ShellOperator!

Functions

func InitAndStart

func InitAndStart(operator *AddonOperator) error

func QueueHasPendingModuleRunTask

func QueueHasPendingModuleRunTask(q *queue.TaskQueue, moduleName string) bool

QueueHasPendingModuleRunTask returns true if queue has pending tasks with the type "ModuleRun" related to the module "moduleName".

func RegisterAddonOperatorMetrics

func RegisterAddonOperatorMetrics(metricStorage *metric_storage.MetricStorage)

func RegisterHookMetrics

func RegisterHookMetrics(metricStorage *metric_storage.MetricStorage)

Types

type AddonOperator

type AddonOperator struct {
	*shell_operator.ShellOperator

	ModulesDir     string
	GlobalHooksDir string

	KubeConfigManager kube_config_manager.KubeConfigManager

	// ModuleManager is the module manager object, which monitors configuration
	// and variable changes.
	ModuleManager module_manager.ModuleManager

	HelmResourcesManager helm_resources_manager.HelmResourcesManager

	// converge state
	StartupConvergeStarted bool
	StartupConvergeDone    bool
	ConvergeStarted        int64
	ConvergeActivation     string

	HelmMonitorKubeClientMetricLabels map[string]string
	// contains filtered or unexported fields
}

AddonOperator extends ShellOperator with modules and global hooks and with a value storage.

func DefaultOperator

func DefaultOperator() *AddonOperator

func NewAddonOperator

func NewAddonOperator() *AddonOperator

func (*AddonOperator) CheckConvergeStatus

func (op *AddonOperator) CheckConvergeStatus(t sh_task.Task)

func (*AddonOperator) CreateReloadAllTasks

func (op *AddonOperator) CreateReloadAllTasks(onStartup bool, logLabels map[string]string, eventDescription string) []sh_task.Task

CreateReloadAllTasks

func (*AddonOperator) DefineEventHandlers

func (op *AddonOperator) DefineEventHandlers()

func (*AddonOperator) DrainModuleQueues added in v1.0.3

func (op *AddonOperator) DrainModuleQueues(modName string)

func (*AddonOperator) GetHelmMonitorKubeClientMetricLabels

func (op *AddonOperator) GetHelmMonitorKubeClientMetricLabels() map[string]string

func (*AddonOperator) HandleGlobalHookRun

func (op *AddonOperator) HandleGlobalHookRun(t sh_task.Task, labels map[string]string) (res queue.TaskResult)

func (*AddonOperator) HandleModuleHookRun

func (op *AddonOperator) HandleModuleHookRun(t sh_task.Task, labels map[string]string) (res queue.TaskResult)

func (*AddonOperator) HandleModuleRun

func (op *AddonOperator) HandleModuleRun(t sh_task.Task, labels map[string]string) (res queue.TaskResult)

ModuleRun starts module: execute module hook and install a Helm chart. Execution sequence: - onStartup hooks - kubernetes.Synchronization hooks - wait while all Synchronization tasks are done - beforeHelm hooks - install or upgrade a Helm chart - afterHelm hooks ModuleRun is restarted if hook or chart is failed. If ModuleRun is succeeded, then onStartup and kubernetes.Synchronization hooks will not run the next time.

func (*AddonOperator) InitAndStartHookQueues

func (op *AddonOperator) InitAndStartHookQueues()

CreateQueues create all queues defined in hooks

func (*AddonOperator) InitHelmMonitorKubeClient

func (op *AddonOperator) InitHelmMonitorKubeClient() (klient.Client, error)

InitHelmMonitorKubeClient initializes a Kubernetes client for helm monitor.

func (*AddonOperator) InitMetricStorage

func (op *AddonOperator) InitMetricStorage()

InitMetricStorage creates new MetricStorage instance in AddonOperator if it is not initialized yet. Run it before Init() to override default MetricStorage instance in shell-operator.

func (*AddonOperator) InitModuleManager

func (op *AddonOperator) InitModuleManager() error

InitModuleManager initialize objects for addon-operator. This method should run after Init().

Addon-operator settings:

- directory with modules - directory with global hooks - dump file path

Objects: - helm client - kube config manager - module manager

Also set handlers for task types and handlers to emit tasks.

func (*AddonOperator) MainQueueHasConvergeTasks

func (op *AddonOperator) MainQueueHasConvergeTasks() int

func (*AddonOperator) PrepopulateMainQueue

func (op *AddonOperator) PrepopulateMainQueue(tqs *queue.TaskQueueSet)

PrepopulateMainQueue adds tasks to run hooks with OnStartup bindings and tasks to enable kubernetes bindings.

func (*AddonOperator) RunAddonOperatorMetrics

func (op *AddonOperator) RunAddonOperatorMetrics()

func (*AddonOperator) RunDiscoverModulesState

func (op *AddonOperator) RunDiscoverModulesState(discoverTask sh_task.Task, logLabels map[string]string) ([]sh_task.Task, error)

func (*AddonOperator) SetupDebugServerHandles

func (op *AddonOperator) SetupDebugServerHandles()

func (*AddonOperator) SetupHttpServerHandles

func (op *AddonOperator) SetupHttpServerHandles()

func (*AddonOperator) Shutdown

func (op *AddonOperator) Shutdown()

func (*AddonOperator) Start

func (op *AddonOperator) Start()

Run runs all managers, event and queue handlers.

The main process is blocked by the 'for-select' in the queue handler.

func (*AddonOperator) StartModuleManagerEventHandler

func (op *AddonOperator) StartModuleManagerEventHandler()

func (*AddonOperator) Stop

func (op *AddonOperator) Stop()

func (*AddonOperator) TaskHandler

func (op *AddonOperator) TaskHandler(t sh_task.Task) queue.TaskResult

TasksRunner handle tasks in queue.

func (*AddonOperator) UpdateWaitInQueueMetric

func (op *AddonOperator) UpdateWaitInQueueMetric(t sh_task.Task)

TODO pass queue name from handler, not from task

func (*AddonOperator) WithContext

func (op *AddonOperator) WithContext(ctx context.Context) *AddonOperator

func (*AddonOperator) WithGlobalHooksDir

func (op *AddonOperator) WithGlobalHooksDir(dir string)

func (*AddonOperator) WithModulesDir

func (op *AddonOperator) WithModulesDir(dir string)

Jump to

Keyboard shortcuts

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