Documentation
¶
Index ¶
- type Config
- type Info
- type Module
- func (m *Module) ApplySettings(settingsVersion int, settings addonutils.Values) error
- func (m *Module) GetConstraints() schedule.Constraints
- func (m *Module) GetHookSnapshotsDump(include ...string) []byte
- func (m *Module) GetHooksByBinding(binding shtypes.BindingType) []hooks.ControllableHook
- func (m *Module) GetInfo() Info
- func (m *Module) GetName() string
- func (m *Module) GetPath() string
- func (m *Module) GetSettings() addonutils.Values
- func (m *Module) GetSettingsChecksum() string
- func (m *Module) GetValues() addonutils.Values
- func (m *Module) GetValuesChecksum() string
- func (m *Module) GetVersion() *semver.Version
- func (m *Module) HooksInitialized() bool
- func (m *Module) InitializeHooks()
- func (m *Module) IsEnabled(moduleName string) *bool
- 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) SetCapabilities(apiVersions []string)
- func (m *Module) SetConfigEnabled(moduleName string, enabled *bool) bool
- func (m *Module) SetEnabledModules(enabledModules []string)
- func (m *Module) SetMaintenance(_ nelm.MaintenanceState)
- func (m *Module) UnlockKubernetesMonitors(hook string, monitors ...string)
- func (m *Module) ValidateSettings(_ context.Context, settingsVersion int, settings addonutils.Values) (settingscheck.Result, error)
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
ConfigSchema []byte // OpenAPI config schema (YAML)
ValuesSchema []byte // OpenAPI values schema (YAML)
Hooks []hooks.GlobalHook // Discovered hooks
Conversions *conversion.Converter // Schema version converter
Patcher *objectpatch.ObjectPatcher
ScheduleManager schedulemanager.ScheduleManager
KubeEventsManager kubeeventsmanager.KubeEventsManager
}
Config holds configuration for creating a new Module instance.
type Info ¶ added in v1.77.0
type Info struct {
Name string `json:"name" yaml:"name"`
Running bool `json:"running" yaml:"running"`
Path string `json:"path" yaml:"path"`
Values addonutils.Values `json:"values,omitempty" yaml:"values,omitempty"`
Hooks []string `json:"hooks,omitempty" yaml:"hooks,omitempty"`
Dynamic map[string]bool `json:"dynamic,omitempty" yaml:"dynamic,omitempty"`
}
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
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) GetConstraints ¶ added in v1.77.0
func (m *Module) GetConstraints() schedule.Constraints
GetConstraints returns the scheduler constraints for the global module: it sits at order 0 (the barrier ahead of every other package) and is always enabled. Not registered with the scheduler yet — see the global-node wiring in runtime.
func (*Module) GetHookSnapshotsDump ¶ added in v1.77.0
GetHookSnapshotsDump returns a YAML snapshot of hook controller snapshots. If include is provided, only hooks matching those names are included.
func (*Module) GetHooksByBinding ¶ added in v1.77.0
func (m *Module) GetHooksByBinding(binding shtypes.BindingType) []hooks.ControllableHook
GetHooksByBinding returns the global hooks for the binding as the ControllableHook view, so the shared Enable task can drive global like any package.
func (*Module) GetSettings ¶ added in v1.77.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) GetSettingsChecksum ¶
GetSettingsChecksum returns a checksum of the current config values. Used to detect if settings changed.
func (*Module) GetValues ¶
func (m *Module) GetValues() addonutils.Values
GetValues returns values for rendering.
Global values are exposed both flat (.Values.replicas) and under the "global" key (.Values.global.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) HooksInitialized ¶ added in v1.77.0
HooksInitialized reports whether InitializeHooks has built the hook controllers.
func (*Module) InitializeHooks ¶
func (m *Module) InitializeHooks()
InitializeHooks initializes hook controllers and bind them to Kubernetes events and schedules
func (*Module) IsEnabled ¶ added in v1.77.0
IsEnabled answers a module's resolved enablement intent for the scheduler as a tri-state, folding the two external signals global tracks:
- non-nil true/false - an explicit ModuleConfig opinion; it is authoritative and can both enable and disable;
- non-nil true - absent a ModuleConfig opinion, a global hook dynamically enabled the module (hooks are enable-only);
- nil - neither signal has an opinion; resolution defers to the bundle floor.
moduleName is the kebab-case module name. Safe for concurrent use: the scheduler reads this while global hooks and the config controller write.
func (*Module) RunHookByName ¶
RunHookByName runs some specified hook by its name
func (*Module) RunHooksByBinding ¶
RunHooksByBinding executes all hooks for a specific binding type in order. It creates a binding context with snapshots for BeforeAll hooks.
func (*Module) SetCapabilities ¶ added in v1.77.0
SetCapabilities injects GVK values, discovered during executing ModuleEnsureCRDs tasks, into .global.discovery.apiVersions values
func (*Module) SetConfigEnabled ¶ added in v1.77.0
SetConfigEnabled records the explicit ModuleConfig enabled intent for a module: a non-nil value sets the tri-state, nil clears any prior opinion. It reports whether the stored state changed, so the caller can decide whether to trigger a reschedule. It is the config-side counterpart to the dynamic enabled state set by global hooks; both feed IsEnabled.
func (*Module) SetEnabledModules ¶ added in v1.77.0
SetEnabledModules inject enabledModules to the global values enabledModules are injected as a patch, to recalculate on every global values change
func (*Module) SetMaintenance ¶ added in v1.77.0
func (m *Module) SetMaintenance(_ nelm.MaintenanceState)
SetMaintenance is a no-op: the synthetic global package is always managed and has no maintenance mode. It exists only to satisfy the Configure task's interface.
func (*Module) UnlockKubernetesMonitors ¶
UnlockKubernetesMonitors called after sync task is completed to unlock getting events
func (*Module) ValidateSettings ¶
func (m *Module) ValidateSettings(_ context.Context, settingsVersion int, settings addonutils.Values) (settingscheck.Result, error)
ValidateSettings converts settings to the latest schema version (if a converter is available and settingsVersion > 0), then validates against OpenAPI schema.