Documentation
¶
Index ¶
- type BasicModule
- func (bm *BasicModule) ApplyNewSchemaStorage(schema *validation.SchemaStorage) error
- func (bm *BasicModule) DeregisterHooks()
- func (bm *BasicModule) GenerateNewConfigValues(kubeConfigValues utils.Values, validate bool) (utils.Values, error)
- func (bm *BasicModule) GetConfigValues(withPrefix bool) utils.Values
- func (bm *BasicModule) GetEnabledScriptResult() *bool
- func (bm *BasicModule) GetHookByName(name string) *hooks.ModuleHook
- func (bm *BasicModule) GetHookErrorsSummary() string
- func (bm *BasicModule) GetHooks(bt ...sh_op_types.BindingType) []*hooks.ModuleHook
- func (bm *BasicModule) GetLastHookError() error
- func (bm *BasicModule) GetModuleError() error
- func (bm *BasicModule) GetName() string
- func (bm *BasicModule) GetOrder() uint32
- func (bm *BasicModule) GetPath() string
- func (bm *BasicModule) GetPhase() ModuleRunPhase
- func (bm *BasicModule) GetSchemaStorage() *validation.SchemaStorage
- func (bm *BasicModule) GetValues(withPrefix bool) utils.Values
- func (bm *BasicModule) GetValuesPatches() []utils.ValuesPatch
- func (bm *BasicModule) GetValuesStorage() *ValuesStorage
- func (bm *BasicModule) HasKubernetesHooks() bool
- func (bm *BasicModule) HooksControllersReady() bool
- func (bm *BasicModule) RegisterHooks(logger *log.Entry) ([]*hooks.ModuleHook, error)
- func (bm *BasicModule) ResetState()
- func (bm *BasicModule) RunEnabledScript(tmpDir string, precedingEnabledModules []string, logLabels map[string]string) (bool, error)
- func (bm *BasicModule) RunHookByName(hookName string, binding sh_op_types.BindingType, ...) (string, string, error)
- func (bm *BasicModule) RunHooksByBinding(binding sh_op_types.BindingType, logLabels map[string]string) error
- func (bm *BasicModule) SaveConfigValues(configV utils.Values)
- func (bm *BasicModule) SaveHookError(hookName string, err error)
- func (bm *BasicModule) SetError(err error)
- func (bm *BasicModule) SetHooksControllersReady()
- func (bm *BasicModule) SetPhase(phase ModuleRunPhase)
- func (bm *BasicModule) SetStateEnabled(e bool)
- func (bm *BasicModule) Synchronization() *SynchronizationState
- func (bm *BasicModule) SynchronizationNeeded() bool
- func (bm *BasicModule) Validate() error
- func (bm *BasicModule) ValidateConfigValues() error
- func (bm *BasicModule) ValidateValues() error
- func (bm *BasicModule) WithDependencies(dep *hooks.HookExecutionDependencyContainer)
- type EnabledPatchReport
- type GlobalModule
- func (gm *GlobalModule) EnabledReportChannel() chan *EnabledPatchReport
- func (gm *GlobalModule) GenerateNewConfigValues(kubeConfigValues utils.Values, validate bool) (utils.Values, error)
- func (gm *GlobalModule) GetConfigValues(withPrefix bool) utils.Values
- func (gm *GlobalModule) GetHookByName(name string) *hooks.GlobalHook
- func (gm *GlobalModule) GetHooks(bt ...sh_op_types.BindingType) []*hooks.GlobalHook
- func (gm *GlobalModule) GetName() string
- func (gm *GlobalModule) GetSchemaStorage() *validation.SchemaStorage
- func (gm *GlobalModule) GetValues(withPrefix bool) utils.Values
- func (gm *GlobalModule) GetValuesPatches() []utils.ValuesPatch
- func (gm *GlobalModule) RegisterHooks() ([]*hooks.GlobalHook, error)
- func (gm *GlobalModule) RunHookByName(hookName string, binding sh_op_types.BindingType, ...) (string, string, error)
- func (gm *GlobalModule) SaveConfigValues(configV utils.Values)
- func (gm *GlobalModule) SetEnabledModules(enabledModules []string)
- type HelmModule
- type HelmModuleDependencies
- type HelmResourceManager
- type HelmValuesValidator
- type HooksStorage
- type MetricsStorage
- type ModuleRunPhase
- type SynchronizationState
- type ValuesStorage
- func (vs *ValuesStorage) CommitValues() error
- func (vs *ValuesStorage) GenerateNewConfigValues(configV utils.Values, validate bool) (utils.Values, error)
- func (vs *ValuesStorage) GetConfigValues(withPrefix bool) utils.Values
- func (vs *ValuesStorage) GetSchemaStorage() *validation.SchemaStorage
- func (vs *ValuesStorage) GetValues(withPrefix bool) utils.Values
- func (vs *ValuesStorage) SaveConfigValues(configV utils.Values)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BasicModule ¶
type BasicModule struct { // required Name string // required Order uint32 // required Path string // contains filtered or unexported fields }
BasicModule is a basic representation of the Module, which addon-operator works with any Module has the next parameters:
- name of the module
- order of the module execution
- path of the module on a filesystem
- values storage - config and calculated values for the module
- hooks of the module
- current module state
func NewBasicModule ¶
func NewBasicModule(name, path string, order uint32, staticValues utils.Values, configBytes, valuesBytes []byte) (*BasicModule, error)
NewBasicModule creates new BasicModule staticValues - are values from modules/values.yaml and /modules/<module-name>/values.yaml, they could not be changed during the runtime
func (*BasicModule) ApplyNewSchemaStorage ¶ added in v1.4.0
func (bm *BasicModule) ApplyNewSchemaStorage(schema *validation.SchemaStorage) error
ApplyNewSchemaStorage updates schema storage of the basic module
func (*BasicModule) DeregisterHooks ¶
func (bm *BasicModule) DeregisterHooks()
DeregisterHooks clean up all module hooks
func (*BasicModule) GenerateNewConfigValues ¶
func (*BasicModule) GetConfigValues ¶
func (bm *BasicModule) GetConfigValues(withPrefix bool) utils.Values
func (*BasicModule) GetEnabledScriptResult ¶ added in v1.3.10
func (bm *BasicModule) GetEnabledScriptResult() *bool
GetEnabledScriptResult returns a bool pointer to the enabled script results
func (*BasicModule) GetHookByName ¶
func (bm *BasicModule) GetHookByName(name string) *hooks.ModuleHook
GetHookByName returns hook by its name
func (*BasicModule) GetHookErrorsSummary ¶ added in v1.3.10
func (bm *BasicModule) GetHookErrorsSummary() string
GetHookErrorsSummary get hooks errors summary report
func (*BasicModule) GetHooks ¶
func (bm *BasicModule) GetHooks(bt ...sh_op_types.BindingType) []*hooks.ModuleHook
GetHooks returns module hooks, they could be filtered by BindingType optionally
func (*BasicModule) GetLastHookError ¶
func (bm *BasicModule) GetLastHookError() error
GetLastHookError get error of the last executed hook
func (*BasicModule) GetModuleError ¶
func (bm *BasicModule) GetModuleError() error
func (*BasicModule) GetName ¶
func (bm *BasicModule) GetName() string
GetName returns the module name
func (*BasicModule) GetOrder ¶
func (bm *BasicModule) GetOrder() uint32
GetOrder returns the module order
func (*BasicModule) GetPath ¶
func (bm *BasicModule) GetPath() string
GetPath returns the module path on a filesystem
func (*BasicModule) GetSchemaStorage ¶ added in v1.3.13
func (bm *BasicModule) GetSchemaStorage() *validation.SchemaStorage
GetSchemaStorage returns current schema storage of the basic module
func (*BasicModule) GetValuesPatches ¶
func (bm *BasicModule) GetValuesPatches() []utils.ValuesPatch
GetValuesPatches returns patches for debug output
func (*BasicModule) GetValuesStorage ¶ added in v1.3.13
func (bm *BasicModule) GetValuesStorage() *ValuesStorage
func (*BasicModule) HasKubernetesHooks ¶
func (bm *BasicModule) HasKubernetesHooks() bool
HasKubernetesHooks is true if module has at least one kubernetes hook.
func (*BasicModule) HooksControllersReady ¶ added in v1.3.9
func (bm *BasicModule) HooksControllersReady() bool
HooksControllersReady returns controllersReady status of the hook storage
func (*BasicModule) RegisterHooks ¶
func (bm *BasicModule) RegisterHooks(logger *log.Entry) ([]*hooks.ModuleHook, error)
RegisterHooks find and registers all module hooks from a filesystem or GoHook Registry
func (*BasicModule) ResetState ¶
func (bm *BasicModule) ResetState()
ResetState drops the module state
func (*BasicModule) RunEnabledScript ¶
func (bm *BasicModule) RunEnabledScript(tmpDir string, precedingEnabledModules []string, logLabels map[string]string) (bool, error)
RunEnabledScript execute enabled script
func (*BasicModule) RunHookByName ¶
func (bm *BasicModule) RunHookByName(hookName string, binding sh_op_types.BindingType, bindingContext []binding_context.BindingContext, logLabels map[string]string) (string, string, error)
RunHookByName runs some specified hook by its name
func (*BasicModule) RunHooksByBinding ¶
func (bm *BasicModule) RunHooksByBinding(binding sh_op_types.BindingType, logLabels map[string]string) error
RunHooksByBinding gets all hooks for binding, for each hook it creates a BindingContext, sets KubernetesSnapshots and runs the hook.
func (*BasicModule) SaveConfigValues ¶
func (bm *BasicModule) SaveConfigValues(configV utils.Values)
func (*BasicModule) SaveHookError ¶
func (bm *BasicModule) SaveHookError(hookName string, err error)
SaveHookError ...
func (*BasicModule) SetHooksControllersReady ¶ added in v1.3.9
func (bm *BasicModule) SetHooksControllersReady()
SetHooksControllersReady sets controllersReady status of the hook storage to true
func (*BasicModule) SetStateEnabled ¶
func (bm *BasicModule) SetStateEnabled(e bool)
SetStateEnabled ...
func (*BasicModule) Synchronization ¶
func (bm *BasicModule) Synchronization() *SynchronizationState
Synchronization xxx TODO: don't like this honestly, i think we can remake it
func (*BasicModule) SynchronizationNeeded ¶
func (bm *BasicModule) SynchronizationNeeded() bool
SynchronizationNeeded is true if module has at least one kubernetes hook with executeHookOnSynchronization. TODO: dont skip
func (*BasicModule) Validate ¶ added in v1.3.13
func (bm *BasicModule) Validate() error
func (*BasicModule) ValidateConfigValues ¶ added in v1.3.13
func (bm *BasicModule) ValidateConfigValues() error
func (*BasicModule) ValidateValues ¶ added in v1.3.13
func (bm *BasicModule) ValidateValues() error
func (*BasicModule) WithDependencies ¶
func (bm *BasicModule) WithDependencies(dep *hooks.HookExecutionDependencyContainer)
WithDependencies inject module dependencies
type EnabledPatchReport ¶
type EnabledPatchReport struct { Patch utils.ValuesPatch Done chan error }
type GlobalModule ¶
type GlobalModule struct {
// contains filtered or unexported fields
}
GlobalModule is an ephemeral container for global hooks
func NewGlobalModule ¶
func NewGlobalModule(hooksDir string, staticValues utils.Values, dc *hooks.HookExecutionDependencyContainer, configBytes, valuesBytes []byte, ) (*GlobalModule, error)
NewGlobalModule build ephemeral global container for global hooks and values
func (*GlobalModule) EnabledReportChannel ¶
func (gm *GlobalModule) EnabledReportChannel() chan *EnabledPatchReport
EnabledReportChannel returns channel with dynamic modules enabling by global hooks
func (*GlobalModule) GenerateNewConfigValues ¶
func (*GlobalModule) GetConfigValues ¶
func (gm *GlobalModule) GetConfigValues(withPrefix bool) utils.Values
func (*GlobalModule) GetHookByName ¶
func (gm *GlobalModule) GetHookByName(name string) *hooks.GlobalHook
GetHookByName ...
func (*GlobalModule) GetHooks ¶
func (gm *GlobalModule) GetHooks(bt ...sh_op_types.BindingType) []*hooks.GlobalHook
GetHooks returns module hooks, they could be filtered by BindingType optionally
func (*GlobalModule) GetSchemaStorage ¶ added in v1.3.13
func (gm *GlobalModule) GetSchemaStorage() *validation.SchemaStorage
func (*GlobalModule) GetValuesPatches ¶
func (gm *GlobalModule) GetValuesPatches() []utils.ValuesPatch
func (*GlobalModule) RegisterHooks ¶
func (gm *GlobalModule) RegisterHooks() ([]*hooks.GlobalHook, error)
RegisterHooks finds and registers global hooks
func (*GlobalModule) RunHookByName ¶
func (gm *GlobalModule) RunHookByName(hookName string, binding sh_op_types.BindingType, bindingContext []binding_context.BindingContext, logLabels map[string]string) (string, string, error)
RunHookByName runs some specified hook by its name
func (*GlobalModule) SaveConfigValues ¶
func (gm *GlobalModule) SaveConfigValues(configV utils.Values)
func (*GlobalModule) SetEnabledModules ¶ added in v1.3.5
func (gm *GlobalModule) SetEnabledModules(enabledModules []string)
SetEnabledModules inject enabledModules to the global values enabledModules are injected as a patch, to recalculate on every global values change
type HelmModule ¶
type HelmModule struct {
// contains filtered or unexported fields
}
HelmModule representation of the module, which has Helm Chart and could be installed with the helm lib
func NewHelmModule ¶
func NewHelmModule(bm *BasicModule, tmpDir string, deps *HelmModuleDependencies, validator HelmValuesValidator) (*HelmModule, error)
NewHelmModule build HelmModule from the Module templates and values + global values
func (*HelmModule) PrepareValuesYamlFile ¶
func (hm *HelmModule) PrepareValuesYamlFile() (string, error)
func (*HelmModule) Render ¶
func (hm *HelmModule) Render(namespace string, debug bool) (string, error)
func (*HelmModule) RunHelmInstall ¶
func (hm *HelmModule) RunHelmInstall(logLabels map[string]string) error
type HelmModuleDependencies ¶
type HelmModuleDependencies struct { HelmClientFactory *helm.ClientFactory HelmResourceManager HelmResourceManager MetricsStorage MetricsStorage HelmValuesValidator HelmValuesValidator }
type HelmResourceManager ¶
type HelmValuesValidator ¶
type HooksStorage ¶
type HooksStorage struct {
// contains filtered or unexported fields
}
HooksStorage keep module hooks in order
func (*HooksStorage) AddHook ¶
func (hs *HooksStorage) AddHook(hk *hooks.ModuleHook)
type MetricsStorage ¶
type ModuleRunPhase ¶
type ModuleRunPhase string
const ( // Startup - module is just enabled. Startup ModuleRunPhase = "Startup" // OnStartupDone - onStartup hooks are done. OnStartupDone ModuleRunPhase = "OnStartupDone" // QueueSynchronizationTasks - should queue Synchronization tasks. QueueSynchronizationTasks ModuleRunPhase = "QueueSynchronizationTasks" // WaitForSynchronization - some Synchronization tasks are in queues, should wait for them to finish. WaitForSynchronization ModuleRunPhase = "WaitForSynchronization" // EnableScheduleBindings - enable schedule binding after Synchronization. EnableScheduleBindings ModuleRunPhase = "EnableScheduleBindings" // CanRunHelm - module is ready to run its Helm chart. CanRunHelm ModuleRunPhase = "CanRunHelm" // HooksDisabled - module has its hooks disabled (before update or deletion). HooksDisabled ModuleRunPhase = "HooksDisabled" )
type SynchronizationState ¶
type SynchronizationState struct {
// contains filtered or unexported fields
}
SynchronizationState stores state to track synchronization tasks for kubernetes bindings either for all global hooks or for module's hooks.
func NewSynchronizationState ¶
func NewSynchronizationState() *SynchronizationState
func (*SynchronizationState) DebugDumpState ¶
func (s *SynchronizationState) DebugDumpState(logEntry *log.Entry)
func (*SynchronizationState) DoneForBinding ¶
func (s *SynchronizationState) DoneForBinding(id string)
func (*SynchronizationState) HasQueued ¶
func (s *SynchronizationState) HasQueued() bool
func (*SynchronizationState) IsComplete ¶
func (s *SynchronizationState) IsComplete() bool
IsComplete returns true if all states are in done status.
func (*SynchronizationState) QueuedForBinding ¶
func (s *SynchronizationState) QueuedForBinding(metadata task.HookMetadata)
type ValuesStorage ¶
type ValuesStorage struct {
// contains filtered or unexported fields
}
ValuesStorage keeps Module's values in order
func NewValuesStorage ¶
func NewValuesStorage(moduleName string, staticValues utils.Values, configBytes, valuesBytes []byte) (*ValuesStorage, error)
NewValuesStorage build a new storage for module values
staticValues - values from /modules/<module-name>/values.yaml, which couldn't be reloaded during the runtime
func (*ValuesStorage) CommitValues ¶
func (vs *ValuesStorage) CommitValues() error
CommitValues apply all patches and create up-to-date values for module
func (*ValuesStorage) GenerateNewConfigValues ¶
func (vs *ValuesStorage) GenerateNewConfigValues(configV utils.Values, validate bool) (utils.Values, error)
GenerateNewConfigValues generated new config values, based on static and config values. Additionally, if validate is true, it validates two versions of resulting values: original (without openapi defaults) and with openapi defaults for consistency. this method always makes a copy of the result values to prevent pointers shallow copying
func (*ValuesStorage) GetConfigValues ¶
func (vs *ValuesStorage) GetConfigValues(withPrefix bool) utils.Values
GetConfigValues returns only user defined values
func (*ValuesStorage) GetSchemaStorage ¶ added in v1.3.13
func (vs *ValuesStorage) GetSchemaStorage() *validation.SchemaStorage
func (*ValuesStorage) GetValues ¶
func (vs *ValuesStorage) GetValues(withPrefix bool) utils.Values
GetValues return current values with applied patches withPrefix means, that values will be returned with module name prefix example:
without prefix:
```yaml replicas: 1 foo: bar: hello-world ```
with prefix:
```yaml mySuperModule: replicas: 1 foo: bar: hello-world ```
func (*ValuesStorage) SaveConfigValues ¶
func (vs *ValuesStorage) SaveConfigValues(configV utils.Values)