global

package
v1.77.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2026 License: Apache-2.0 Imports: 34 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

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

func NewModuleByConfig(cfg *Config, logger *log.Logger) (*Module, error)

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

func (m *Module) GetHookSnapshotsDump(include ...string) []byte

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) GetInfo added in v1.77.0

func (m *Module) GetInfo() Info

func (*Module) GetName

func (m *Module) GetName() string

GetName returns the full module identifier.

func (*Module) GetPath

func (m *Module) GetPath() string

GetPath returns path to the package dir

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

func (m *Module) GetSettingsChecksum() string

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

func (m *Module) GetValuesChecksum() string

GetValuesChecksum returns a checksum of the current values. Used to detect if values changed after hook execution.

func (*Module) GetVersion

func (m *Module) GetVersion() *semver.Version

GetVersion return the package version

func (*Module) HooksInitialized added in v1.77.0

func (m *Module) HooksInitialized() bool

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

func (m *Module) IsEnabled(moduleName string) *bool

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

func (m *Module) RunHookByName(ctx context.Context, name string, bctx []bctx.BindingContext) error

RunHookByName runs some specified hook by its name

func (*Module) RunHooksByBinding

func (m *Module) RunHooksByBinding(ctx context.Context, binding shtypes.BindingType) error

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

func (m *Module) SetCapabilities(apiVersions []string)

SetCapabilities injects GVK values, discovered during executing ModuleEnsureCRDs tasks, into .global.discovery.apiVersions values

func (*Module) SetConfigEnabled added in v1.77.0

func (m *Module) SetConfigEnabled(moduleName string, enabled *bool) bool

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

func (m *Module) SetEnabledModules(enabledModules []string)

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

func (m *Module) UnlockKubernetesMonitors(hook string, monitors ...string)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL