Documentation ¶
Index ¶
- type DirectoryConfig
- type KubeConfigManager
- type ModuleManager
- func (mm *ModuleManager) AddExtender(ex extenders.Extender) error
- func (mm *ModuleManager) ApplyBindingActions(moduleHook *hooks.ModuleHook, bindingActions []go_hook.BindingAction) error
- func (mm *ModuleManager) ApplyNewKubeConfigValues(kubeConfig *config.KubeConfig, globalValuesChanged bool) error
- func (mm *ModuleManager) AreModulesInited() bool
- func (mm *ModuleManager) DeleteModule(moduleName string, logLabels map[string]string) error
- func (mm *ModuleManager) DisableModuleHooks(moduleName string)
- func (mm *ModuleManager) EnableModuleScheduleBindings(moduleName string)
- func (mm *ModuleManager) FilterModuleByExtender(extName extenders.ExtenderName, moduleName string, logLabels map[string]string) (*bool, error)
- func (mm *ModuleManager) GetDependencies() *ModuleManagerDependencies
- func (mm *ModuleManager) GetEnabledModuleNames() []string
- func (mm *ModuleManager) GetGlobal() *modules.GlobalModule
- func (mm *ModuleManager) GetGlobalHook(name string) *hooks.GlobalHook
- func (mm *ModuleManager) GetGlobalHooksInOrder(bindingType BindingType) []string
- func (mm *ModuleManager) GetGlobalHooksNames() []string
- func (mm *ModuleManager) GetGraphImage() (image.Image, error)
- func (mm *ModuleManager) GetKubeConfigValid() bool
- func (mm *ModuleManager) GetModule(name string) *modules.BasicModule
- func (mm *ModuleManager) GetModuleEventsChannel() chan events.ModuleEvent
- func (mm *ModuleManager) GetModuleNames() []string
- func (mm *ModuleManager) GetUpdatedByExtender(moduleName string) (string, error)
- func (mm *ModuleManager) GlobalSynchronizationNeeded() bool
- func (mm *ModuleManager) GlobalSynchronizationState() *modules.SynchronizationState
- func (mm *ModuleManager) HandleGlobalEnableKubernetesBindings(hookName string, ...) error
- func (mm *ModuleManager) HandleKubeEvent(kubeEvent KubeEvent, ...)
- func (mm *ModuleManager) HandleModuleEnableKubernetesBindings(moduleName string, ...) error
- func (mm *ModuleManager) HandleScheduleEvent(crontab string, ...)
- func (mm *ModuleManager) Init(logger *log.Logger) error
- func (mm *ModuleManager) IsModuleEnabled(moduleName string) bool
- func (mm *ModuleManager) LoopByBinding(binding BindingType, ...)
- func (mm *ModuleManager) ModuleHasCRDs(moduleName string) bool
- func (mm *ModuleManager) PushRunModuleTask(moduleName string, doModuleStartup bool) error
- func (mm *ModuleManager) RecalculateGraph(logLabels map[string]string) bool
- func (mm *ModuleManager) RefreshEnabledState(logLabels map[string]string) (*ModulesState, error)
- func (mm *ModuleManager) RefreshStateFromHelmReleases(logLabels map[string]string) (*ModulesState, error)
- func (mm *ModuleManager) RegisterModule(_, _ string) error
- func (mm *ModuleManager) RegisterModuleHooks(ml *modules.BasicModule, logLabels map[string]string) error
- func (mm *ModuleManager) RunGlobalHook(hookName string, binding BindingType, bindingContext []BindingContext, ...) (string, string, error)
- func (mm *ModuleManager) RunModule(moduleName string, logLabels map[string]string) (bool, error)
- func (mm *ModuleManager) RunModuleHook(moduleName, hookName string, binding BindingType, ...) (beforeChecksum string, afterChecksum string, err error)
- func (mm *ModuleManager) RunModuleHooks(m *modules.BasicModule, bt sh_op_types.BindingType, ...) error
- func (mm *ModuleManager) RunModuleWithNewOpenAPISchema(moduleName, moduleSource, modulePath string) error
- func (mm *ModuleManager) SchedulerEventCh() chan extenders.ExtenderEvent
- func (mm *ModuleManager) SendModuleEvent(ev events.ModuleEvent)
- func (mm *ModuleManager) SetGlobalDiscoveryAPIVersions(apiVersions []string)
- func (mm *ModuleManager) SetKubeConfigValid(valid bool)
- func (mm *ModuleManager) SetKubeConfigValuesValid(valid bool)
- func (mm *ModuleManager) SetModuleEventsChannel(ec chan events.ModuleEvent)
- func (mm *ModuleManager) SetModuleLoader(ld loader.ModuleLoader)
- func (mm *ModuleManager) SetModulePhaseAndNotify(module *modules.BasicModule, phase modules.ModuleRunPhase)
- func (mm *ModuleManager) Start()
- func (mm *ModuleManager) Stop()
- func (mm *ModuleManager) UpdateModuleHookStatusAndNotify(module *modules.BasicModule, hookName string, err error)
- func (mm *ModuleManager) UpdateModuleLastErrorAndNotify(module *modules.BasicModule, err error)
- func (mm *ModuleManager) UpdateModulesMetrics()
- type ModuleManagerConfig
- type ModuleManagerDependencies
- type ModulesState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DirectoryConfig ¶ added in v1.1.3
DirectoryConfig configures directories for ModuleManager
type KubeConfigManager ¶ added in v1.1.3
type ModuleManager ¶
type ModuleManager struct { // Directories. ModulesDir string GlobalHooksDir string TempDir string // contains filtered or unexported fields }
func NewModuleManager ¶ added in v1.0.6
func NewModuleManager(ctx context.Context, cfg *ModuleManagerConfig, logger *log.Logger) *ModuleManager
NewModuleManager returns new MainModuleManager
func (*ModuleManager) AddExtender ¶ added in v1.4.0
func (mm *ModuleManager) AddExtender(ex extenders.Extender) error
func (*ModuleManager) ApplyBindingActions ¶ added in v1.1.3
func (mm *ModuleManager) ApplyBindingActions(moduleHook *hooks.ModuleHook, bindingActions []go_hook.BindingAction) error
func (*ModuleManager) ApplyNewKubeConfigValues ¶ added in v1.4.0
func (mm *ModuleManager) ApplyNewKubeConfigValues(kubeConfig *config.KubeConfig, globalValuesChanged bool) error
ApplyNewKubeConfigValues validates and applies new config values with config schemas.
func (*ModuleManager) AreModulesInited ¶ added in v1.3.7
func (mm *ModuleManager) AreModulesInited() bool
AreModulesInited returns true if modulemanager's moduleset has already been initialized
func (*ModuleManager) DeleteModule ¶
func (mm *ModuleManager) DeleteModule(moduleName string, logLabels map[string]string) error
func (*ModuleManager) DisableModuleHooks ¶
func (mm *ModuleManager) DisableModuleHooks(moduleName string)
DisableModuleHooks disables monitors/bindings of the module's hooks It's advisable to use this method only if next step is to completely disable the module (as a short-term commitment). Otherwise, as hooks are rather stateless, their confiuration may get overwritten, resulting in unexpected consequences.
func (*ModuleManager) EnableModuleScheduleBindings ¶ added in v1.0.5
func (mm *ModuleManager) EnableModuleScheduleBindings(moduleName string)
func (*ModuleManager) FilterModuleByExtender ¶ added in v1.4.0
func (mm *ModuleManager) FilterModuleByExtender(extName extenders.ExtenderName, moduleName string, logLabels map[string]string) (*bool, error)
FilterModuleByExtender returns filtering result for the specified extender and module
func (*ModuleManager) GetDependencies ¶ added in v1.3.3
func (mm *ModuleManager) GetDependencies() *ModuleManagerDependencies
GetDependencies fetch dependencies struct from ModuleManager note: not the best way but it's required in some hooks
func (*ModuleManager) GetEnabledModuleNames ¶ added in v1.0.6
func (mm *ModuleManager) GetEnabledModuleNames() []string
GetEnabledModuleNames runs corresponding method of the module scheduler
func (*ModuleManager) GetGlobal ¶ added in v1.3.3
func (mm *ModuleManager) GetGlobal() *modules.GlobalModule
func (*ModuleManager) GetGlobalHook ¶
func (mm *ModuleManager) GetGlobalHook(name string) *hooks.GlobalHook
func (*ModuleManager) GetGlobalHooksInOrder ¶
func (mm *ModuleManager) GetGlobalHooksInOrder(bindingType BindingType) []string
func (*ModuleManager) GetGlobalHooksNames ¶ added in v1.0.4
func (mm *ModuleManager) GetGlobalHooksNames() []string
func (*ModuleManager) GetGraphImage ¶ added in v1.4.0
func (mm *ModuleManager) GetGraphImage() (image.Image, error)
func (*ModuleManager) GetKubeConfigValid ¶ added in v1.0.6
func (mm *ModuleManager) GetKubeConfigValid() bool
func (*ModuleManager) GetModule ¶
func (mm *ModuleManager) GetModule(name string) *modules.BasicModule
func (*ModuleManager) GetModuleEventsChannel ¶ added in v1.3.3
func (mm *ModuleManager) GetModuleEventsChannel() chan events.ModuleEvent
GetModuleEventsChannel returns a channel with events that occur during module processing events channel is created only if someone is reading it
func (*ModuleManager) GetModuleNames ¶ added in v1.1.0
func (mm *ModuleManager) GetModuleNames() []string
func (*ModuleManager) GetUpdatedByExtender ¶ added in v1.4.3
func (mm *ModuleManager) GetUpdatedByExtender(moduleName string) (string, error)
GetUpdatedByExtender returns the name of the extender that determined the module's state
func (*ModuleManager) GlobalSynchronizationNeeded ¶
func (mm *ModuleManager) GlobalSynchronizationNeeded() bool
GlobalSynchronizationNeeded is true if there is at least one global kubernetes hook with executeHookOnSynchronization.
func (*ModuleManager) GlobalSynchronizationState ¶ added in v1.0.5
func (mm *ModuleManager) GlobalSynchronizationState() *modules.SynchronizationState
func (*ModuleManager) HandleGlobalEnableKubernetesBindings ¶
func (mm *ModuleManager) HandleGlobalEnableKubernetesBindings(hookName string, createTaskFn func(*hooks.GlobalHook, controller.BindingExecutionInfo)) error
func (*ModuleManager) HandleKubeEvent ¶
func (mm *ModuleManager) HandleKubeEvent(kubeEvent KubeEvent, createGlobalTaskFn func(*hooks.GlobalHook, controller.BindingExecutionInfo), createModuleTaskFn func(*modules.BasicModule, *hooks.ModuleHook, controller.BindingExecutionInfo))
func (*ModuleManager) HandleModuleEnableKubernetesBindings ¶
func (mm *ModuleManager) HandleModuleEnableKubernetesBindings(moduleName string, createTaskFn func(*hooks.ModuleHook, controller.BindingExecutionInfo)) error
func (*ModuleManager) HandleScheduleEvent ¶
func (mm *ModuleManager) HandleScheduleEvent(crontab string, createGlobalTaskFn func(*hooks.GlobalHook, controller.BindingExecutionInfo), createModuleTaskFn func(*modules.BasicModule, *hooks.ModuleHook, controller.BindingExecutionInfo))
func (*ModuleManager) Init ¶
func (mm *ModuleManager) Init(logger *log.Logger) error
Init — initialize module manager
func (*ModuleManager) IsModuleEnabled ¶ added in v1.0.6
func (mm *ModuleManager) IsModuleEnabled(moduleName string) bool
IsModuleEnabled returns current state of the module according to the scheduler
func (*ModuleManager) LoopByBinding ¶ added in v1.1.3
func (mm *ModuleManager) LoopByBinding(binding BindingType, fn func(gh *hooks.GlobalHook, m *modules.BasicModule, mh *hooks.ModuleHook))
func (*ModuleManager) ModuleHasCRDs ¶ added in v1.5.0
func (mm *ModuleManager) ModuleHasCRDs(moduleName string) bool
func (*ModuleManager) PushRunModuleTask ¶ added in v1.3.9
func (mm *ModuleManager) PushRunModuleTask(moduleName string, doModuleStartup bool) error
PushRunModuleTask pushes moduleRun task for a module into the main queue if there is no such a task for the module
func (*ModuleManager) RecalculateGraph ¶ added in v1.4.0
func (mm *ModuleManager) RecalculateGraph(logLabels map[string]string) bool
RecalculateGraph runs corresponding scheduler method that returns true if the graph's state has changed
func (*ModuleManager) RefreshEnabledState ¶ added in v1.0.6
func (mm *ModuleManager) RefreshEnabledState(logLabels map[string]string) (*ModulesState, error)
RefreshEnabledState gets current diff of the graph and forms ModuleState - mm.enabledModules
func (*ModuleManager) RefreshStateFromHelmReleases ¶ added in v1.0.6
func (mm *ModuleManager) RefreshStateFromHelmReleases(logLabels map[string]string) (*ModulesState, error)
RefreshStateFromHelmReleases retrieves all Helm releases. It marks all unknown modules as needed to be purged. Run this method once at startup.
func (*ModuleManager) RegisterModule ¶ added in v1.3.9
func (mm *ModuleManager) RegisterModule(_, _ string) error
RegisterModule checks if a module already exists and reapplies(reloads) its configuration. If it's a new module - converges all modules - EXPERIMENTAL
func (*ModuleManager) RegisterModuleHooks ¶
func (mm *ModuleManager) RegisterModuleHooks(ml *modules.BasicModule, logLabels map[string]string) error
func (*ModuleManager) RunGlobalHook ¶
func (*ModuleManager) RunModule ¶
RunModule runs beforeHelm hook, helm upgrade --install and afterHelm or afterDeleteHelm hook
func (*ModuleManager) RunModuleHook ¶
func (*ModuleManager) RunModuleHooks ¶ added in v1.3.3
func (mm *ModuleManager) RunModuleHooks(m *modules.BasicModule, bt sh_op_types.BindingType, logLabels map[string]string) error
RunOnStartup is a phase of module lifecycle that runs onStartup hooks. It is a handler of task MODULE_RUN Run is a phase of module lifecycle that runs onStartup and beforeHelm hooks, helm upgrade --install command and afterHelm hook. It is a handler of task MODULE_RUN
func (*ModuleManager) RunModuleWithNewOpenAPISchema ¶ added in v1.4.0
func (mm *ModuleManager) RunModuleWithNewOpenAPISchema(moduleName, moduleSource, modulePath string) error
RunModuleWithNewOpenAPISchema updates the module's OpenAPI schema from modulePath directory and pushes RunModuleTask if the module is enabled
func (*ModuleManager) SchedulerEventCh ¶ added in v1.4.0
func (mm *ModuleManager) SchedulerEventCh() chan extenders.ExtenderEvent
func (*ModuleManager) SendModuleEvent ¶ added in v1.3.3
func (mm *ModuleManager) SendModuleEvent(ev events.ModuleEvent)
func (*ModuleManager) SetGlobalDiscoveryAPIVersions ¶ added in v1.5.0
func (mm *ModuleManager) SetGlobalDiscoveryAPIVersions(apiVersions []string)
SetGlobalDiscoveryAPIVersions applies global values patch to .global.discovery.apiVersions key if non-default moduleLoader is in use
func (*ModuleManager) SetKubeConfigValid ¶ added in v1.0.6
func (mm *ModuleManager) SetKubeConfigValid(valid bool)
func (*ModuleManager) SetKubeConfigValuesValid ¶ added in v1.1.3
func (mm *ModuleManager) SetKubeConfigValuesValid(valid bool)
func (*ModuleManager) SetModuleEventsChannel ¶ added in v1.3.10
func (mm *ModuleManager) SetModuleEventsChannel(ec chan events.ModuleEvent)
SetModuleEventsChannel sets an event channel for Module Manager
func (*ModuleManager) SetModuleLoader ¶ added in v1.3.3
func (mm *ModuleManager) SetModuleLoader(ld loader.ModuleLoader)
func (*ModuleManager) SetModulePhaseAndNotify ¶ added in v1.3.10
func (mm *ModuleManager) SetModulePhaseAndNotify(module *modules.BasicModule, phase modules.ModuleRunPhase)
func (*ModuleManager) Stop ¶ added in v1.1.3
func (mm *ModuleManager) Stop()
func (*ModuleManager) UpdateModuleHookStatusAndNotify ¶ added in v1.3.10
func (mm *ModuleManager) UpdateModuleHookStatusAndNotify(module *modules.BasicModule, hookName string, err error)
func (*ModuleManager) UpdateModuleLastErrorAndNotify ¶ added in v1.3.10
func (mm *ModuleManager) UpdateModuleLastErrorAndNotify(module *modules.BasicModule, err error)
func (*ModuleManager) UpdateModulesMetrics ¶ added in v1.5.1
func (mm *ModuleManager) UpdateModulesMetrics()
UpdateModulesMetrics updates modules' states metrics
type ModuleManagerConfig ¶ added in v1.1.4
type ModuleManagerConfig struct { DirectoryConfig DirectoryConfig Dependencies ModuleManagerDependencies }
type ModuleManagerDependencies ¶ added in v1.1.3
type ModuleManagerDependencies struct { KubeObjectPatcher *object_patch.ObjectPatcher KubeEventsManager kube_events_manager.KubeEventsManager KubeConfigManager KubeConfigManager ScheduleManager schedule_manager.ScheduleManager Helm *helm.ClientFactory HelmResourcesManager helm_resources_manager.HelmResourcesManager MetricStorage *metric_storage.MetricStorage HookMetricStorage *metric_storage.MetricStorage TaskQueues *queue.TaskQueueSet }
ModuleManagerDependencies pass dependencies for ModuleManager
type ModulesState ¶
type ModulesState struct { // All enabled modules. AllEnabledModules []string // All enabled modules grouped by order. AllEnabledModulesByOrder map[node.NodeWeight][]string // Modules that should be deleted. ModulesToDisable []string // Modules that was disabled and now are enabled. ModulesToEnable []string // Modules changed after ConfigMap changes ModulesToReload []string // Helm releases without module directory (unknown modules). ModulesToPurge []string }
ModulesState determines which modules should be enabled, disabled or reloaded.
Directories ¶
Path | Synopsis |
---|---|
models
|
|
extenders/mock
a bunch of mocked extenders for tests
|
a bunch of mocked extenders for tests |