Documentation
¶
Index ¶
- type Config
- type Definition
- type DisableMessages
- type DisableOptions
- type GlobalValuesGetter
- type Info
- type Module
- func (m *Module) ApplySettings(settingsVersion int, settings addonutils.Values) error
- func (m *Module) DisableHooks()
- func (m *Module) GetConstraints() schedule.Constraints
- func (m *Module) GetDigests() map[string]string
- func (m *Module) GetEnabledScriptDescriptor() *script.Descriptor
- func (m *Module) GetExclusiveGroup() string
- func (m *Module) GetHookSnapshotsDump() map[string]any
- func (m *Module) GetHooks() []hooks.Hook
- func (m *Module) GetHooksByBinding(binding shtypes.BindingType) []hooks.ControllableHook
- func (m *Module) GetHooksQueues() []string
- func (m *Module) GetInfo() Info
- func (m *Module) GetMaintenance() nelm.MaintenanceState
- func (m *Module) GetName() string
- func (m *Module) GetPath() string
- func (m *Module) GetRuntimeValues() string
- func (m *Module) GetSettings() addonutils.Values
- func (m *Module) GetValues() addonutils.Values
- func (m *Module) GetValuesChecksum() string
- func (m *Module) GetVersion() *semver.Version
- func (m *Module) InitializeHooks()
- func (m *Module) LatestSettingsVersion() int
- func (m *Module) RunHookByName(ctx context.Context, name string, bctx []bctx.BindingContext) error
- func (m *Module) RunHooksByBinding(ctx context.Context, binding shtypes.BindingType) error
- func (m *Module) SetMaintenance(state nelm.MaintenanceState)
- func (m *Module) UnlockKubernetesMonitors(hook string, monitors ...string)
- func (m *Module) ValidateSettings(ctx context.Context, settingsVersion int, settings addonutils.Values) (settingscheck.Result, error)
- type ModuleGroup
- type ModulesRequirements
- type Requirements
- type RuntimeValues
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Path string // Path to package dir
StaticValues addonutils.Values // Static values from values.yaml files
Definition Definition // Module definition
Digests map[string]string // Package images digests(images_digests.json)
Repository registry.Remote // Package repository options
Embedded bool // Package ships inside the Deckhouse image
ConfigSchema []byte // OpenAPI config schema (YAML)
ValuesSchema []byte // OpenAPI values schema (YAML)
Hooks []hooks.Hook // Discovered hooks
SettingsCheck *kind.SettingsCheck
Conversions *conversion.Converter // Schema version converter
Patcher *objectpatch.ObjectPatcher
ScheduleManager schedulemanager.ScheduleManager
KubeEventsManager kubeeventsmanager.KubeEventsManager
MetricStorage metricsstorage.Storage
GlobalValuesGetter GlobalValuesGetter
}
Config holds configuration for creating a new Module instance.
type Definition ¶
type Definition struct {
Name string `json:"name" yaml:"name"`
Version string `json:"version" yaml:"version"`
Stage string `json:"stage" yaml:"stage"`
Critical bool `json:"critical,omitempty" yaml:"critical,omitempty"`
Weight uint32 `json:"weight,omitempty" yaml:"weight,omitempty"`
ExclusiveGroup string `yaml:"exclusiveGroup,omitempty" json:"exclusiveGroup,omitempty"`
Requirements Requirements `json:"requirements" yaml:"requirements"`
Licensing edition.Licensing `json:"licensing" yaml:"licensing"`
DisableOptions DisableOptions `json:"disableOptions" yaml:"disableOptions"`
}
Definition represents module metadata.
func (Definition) Constraints ¶ added in v1.76.0
func (d Definition) Constraints() schedule.Constraints
Constraints projects the module definition onto the scheduler input shape, flattening mandatory and conditional module requirements into a single dependency map and projecting AnyOf groups onto schedule.AnyOfGroup. Mandatory entries win over conditional entries when both reference the same module.
type DisableMessages ¶ added in v1.77.0
type DisableMessages struct {
Ru string `json:"ru,omitempty" yaml:"ru,omitempty"`
En string `json:"en,omitempty" yaml:"en,omitempty"`
}
DisableMessages holds localized disable confirmation messages for the module.
type DisableOptions ¶
type DisableOptions struct {
Confirmation bool `json:"confirmation" yaml:"confirmation"`
Messages DisableMessages `json:"messages" yaml:"messages"`
}
DisableOptions configures module disablement behavior.
type GlobalValuesGetter ¶
type GlobalValuesGetter func() addonutils.Values
type Info ¶
type Info struct {
Name string `json:"name" yaml:"name"`
Running bool `json:"running" yaml:"running"`
Embedded bool `json:"embedded" yaml:"embedded"`
Path string `json:"path" yaml:"path"`
Definition Definition `json:"definition" yaml:"definition"`
Repository registry.Remote `json:"repository" yaml:"repository"`
Digests map[string]string `json:"digests" yaml:"digests"`
Values addonutils.Values `json:"values,omitempty" yaml:"values,omitempty"`
Hooks []string `json:"hooks,omitempty" yaml:"hooks,omitempty"`
}
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
Module represents a running instance of a package. It contains hooks, values storage, and configuration for execution.
Thread Safety: The Module itself is not thread-safe, but its hooks and values storage components use internal synchronization.
func NewModuleByConfig ¶
NewModuleByConfig creates a new Module instance with the specified configuration. It initializes hook storage, adds all discovered hooks, and creates values storage.
Returns error if hook initialization or values storage creation fails.
func (*Module) ApplySettings ¶
func (m *Module) ApplySettings(settingsVersion int, settings addonutils.Values) error
ApplySettings converts settings to the latest schema version (if a converter is available), then applies them to the values storage.
func (*Module) DisableHooks ¶ added in v1.76.0
func (m *Module) DisableHooks()
DisableHooks tears down all active hook bindings and clears the hook registry. Called by the hook lanes' stop once every lane exited.
Cleanup order: schedule bindings are disabled first (stops cron triggers), then Kubernetes monitors are stopped (stops informer watches), and finally the hook registry is cleared so a subsequent InitializeHooks starts fresh.
func (*Module) GetConstraints ¶ added in v1.76.0
func (m *Module) GetConstraints() schedule.Constraints
GetConstraints returns scheduler checks, their determine if an module should be enabled/disabled
func (*Module) GetDigests ¶ added in v1.78.0
GetDigests returns the image digests of the package (images_digests.json); Global publishes them into the global values for every render.
func (*Module) GetEnabledScriptDescriptor ¶ added in v1.77.0
func (m *Module) GetEnabledScriptDescriptor() *script.Descriptor
GetEnabledScriptDescriptor returns the enabled script descriptor for the package
func (*Module) GetExclusiveGroup ¶ added in v1.78.0
GetExclusiveGroup returns the module's exclusive group, if any.
func (*Module) GetHookSnapshotsDump ¶ added in v1.76.0
GetHookSnapshotsDump returns the snapshots of the hooks' unlocked monitors (hooks.SnapshotsDump).
func (*Module) GetHooksByBinding ¶
func (m *Module) GetHooksByBinding(binding shtypes.BindingType) []hooks.ControllableHook
GetHooksByBinding returns all hooks for the specified binding type, sorted by order.
func (*Module) GetHooksQueues ¶ added in v1.76.0
GetHooksQueues returns package queues from all hooks
func (*Module) GetMaintenance ¶ added in v1.77.0
func (m *Module) GetMaintenance() nelm.MaintenanceState
GetMaintenance returns the module maintenance mode. Empty (Managed) means the module reconciles normally.
func (*Module) GetRuntimeValues ¶
GetRuntimeValues returns runtime values in string format
func (*Module) GetSettings ¶ added in v1.76.0
func (m *Module) GetSettings() addonutils.Values
GetSettings returns the effective settings: user config merged with config-schema defaults. Same payload exposed to templates as .Module.Settings.
func (*Module) GetValues ¶
func (m *Module) GetValues() addonutils.Values
GetValues returns values with hooks patches.
Module values are exposed both flat (.Values.replicas) and under the module's camelCase key (.Values.<moduleName>.replicas) so templates written for the old addon-operator layout keep working.
func (*Module) GetValuesChecksum ¶
GetValuesChecksum returns a checksum of the current values. Used to detect if values changed after hook execution.
func (*Module) GetVersion ¶
GetVersion return the package version
func (*Module) InitializeHooks ¶
func (m *Module) InitializeHooks()
InitializeHooks initializes hook controllers and bind them to Kubernetes events and schedules
func (*Module) LatestSettingsVersion ¶ added in v1.78.0
LatestSettingsVersion returns the latest settings-schema version, the one effective settings are in; 0 without a converter.
func (*Module) RunHookByName ¶
RunHookByName executes a specific hook by name with the provided binding context. Returns nil if hook is not found (silent no-op).
func (*Module) RunHooksByBinding ¶
RunHooksByBinding executes all hooks for a specific binding type in order. It creates a binding context with snapshots for BeforeHelm/AfterHelm/BeforeDeleteHelm/AfterDeleteHelm hooks.
func (*Module) SetMaintenance ¶ added in v1.77.0
func (m *Module) SetMaintenance(state nelm.MaintenanceState)
SetMaintenance records the module maintenance mode from Module.spec.maintenance.
func (*Module) UnlockKubernetesMonitors ¶
UnlockKubernetesMonitors is called after a binding's synchronization ran, so its events flow.
func (*Module) ValidateSettings ¶
func (m *Module) ValidateSettings(ctx context.Context, settingsVersion int, settings addonutils.Values) (settingscheck.Result, error)
ValidateSettings converts settings to the latest schema version (if a converter is available), then validates against OpenAPI schema and calls the settings check hook if defined.
type ModuleGroup ¶ added in v1.76.1
type ModuleGroup struct {
Name string `json:"name" yaml:"name"`
Members map[string]*semver.Constraints `json:"members" yaml:"members"`
}
ModuleGroup is a named group of module dependencies shared by the AnyOf and NoneOf buckets; the containing field decides whether members are alternatives (at least one must be installed) or forbidden (none may be installed). Members maps each member's module name to its semver constraint (nil meaning "any version"). Name is the stable identifier used by the scheduler in diagnostics.
type ModulesRequirements ¶ added in v1.76.1
type ModulesRequirements struct {
// Mandatory lists modules that MUST be present (and satisfy constraint, if any)
// for the module to start. The map value is nil when no version constraint applies.
Mandatory map[string]*semver.Constraints `json:"mandatory" yaml:"mandatory"`
// Conditional lists modules that are not required to be present, but if installed
// must satisfy the version constraint. The map value is nil when no version constraint applies.
Conditional map[string]*semver.Constraints `json:"conditional" yaml:"conditional"`
// AnyOf lists groups of alternative dependencies; at least one member of each
// group must be present (and satisfy its constraint, if any) for the module to
// start. AnyOf groups are checker-only — they add no edges to the dependency
// graph, so fallback chains across packages do not produce cycles.
AnyOf []ModuleGroup `json:"anyOf,omitempty" yaml:"anyOf,omitempty"`
// NoneOf lists groups of forbidden dependencies; no member of any group may be
// present for the module to start. A nil constraint on a member forbids any
// installed version; a non-nil constraint narrows the forbidden range so
// versions outside it remain acceptable. Checker-only — adds no graph edges.
NoneOf []ModuleGroup `json:"noneOf,omitempty" yaml:"noneOf,omitempty"`
}
ModulesRequirements groups module dependencies by how they affect module startup.
type Requirements ¶
type Requirements struct {
Kubernetes *semver.Constraints `json:"kubernetes" yaml:"kubernetes"`
Deckhouse *semver.Constraints `json:"deckhouse" yaml:"deckhouse"`
Modules ModulesRequirements `json:"modules" yaml:"modules"`
}
Requirements specifies dependencies required by the module.
type RuntimeValues ¶
type RuntimeValues struct {
Package addonutils.Values `json:"Package"`
}
RuntimeValues holds runtime values that are not part of schema. These values are passed to helm templates under .Runtime prefix.