Documentation ¶
Index ¶
- Variables
- func InitAndStart(operator *AddonOperator) error
- func QueueHasPendingModuleRunTask(q *queue.TaskQueue, moduleName string) bool
- func RegisterAddonOperatorMetrics(metricStorage *metric_storage.MetricStorage)
- func RegisterHookMetrics(metricStorage *metric_storage.MetricStorage)
- type AddonOperator
- func (op *AddonOperator) CheckConvergeStatus(t sh_task.Task)
- func (op *AddonOperator) CreateReloadAllTasks(onStartup bool, logLabels map[string]string, eventDescription string) []sh_task.Task
- func (op *AddonOperator) DefineEventHandlers()
- func (op *AddonOperator) DrainModuleQueues(modName string)
- func (op *AddonOperator) GetHelmMonitorKubeClientMetricLabels() map[string]string
- func (op *AddonOperator) HandleGlobalHookRun(t sh_task.Task, labels map[string]string) (res queue.TaskResult)
- func (op *AddonOperator) HandleModuleHookRun(t sh_task.Task, labels map[string]string) (res queue.TaskResult)
- func (op *AddonOperator) HandleModuleRun(t sh_task.Task, labels map[string]string) (res queue.TaskResult)
- func (op *AddonOperator) InitAndStartHookQueues()
- func (op *AddonOperator) InitHelmMonitorKubeClient() (klient.Client, error)
- func (op *AddonOperator) InitMetricStorage()
- func (op *AddonOperator) InitModuleManager() error
- func (op *AddonOperator) MainQueueHasConvergeTasks() int
- func (op *AddonOperator) PrepopulateMainQueue(tqs *queue.TaskQueueSet)
- func (op *AddonOperator) RunAddonOperatorMetrics()
- func (op *AddonOperator) RunDiscoverModulesState(discoverTask sh_task.Task, logLabels map[string]string) ([]sh_task.Task, error)
- func (op *AddonOperator) SetupDebugServerHandles()
- func (op *AddonOperator) SetupHttpServerHandles()
- func (op *AddonOperator) Shutdown()
- func (op *AddonOperator) Start()
- func (op *AddonOperator) StartModuleManagerEventHandler()
- func (op *AddonOperator) Stop()
- func (op *AddonOperator) TaskHandler(t sh_task.Task) queue.TaskResult
- func (op *AddonOperator) UpdateWaitInQueueMetric(t sh_task.Task)
- func (op *AddonOperator) WithContext(ctx context.Context) *AddonOperator
- func (op *AddonOperator) WithGlobalHooksDir(dir string)
- func (op *AddonOperator) WithModulesDir(dir string)
Constants ¶
This section is empty.
Variables ¶
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 ¶
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 (*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)