global

package
v1.78.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: Apache-2.0 Imports: 36 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
	// Version is the deckhouse image's version, the one the global Module's spec names; "v0.0.0" when
	// it does not parse.
	Version string

	ConfigSchema []byte // OpenAPI config schema (YAML)
	ValuesSchema []byte // OpenAPI values schema (YAML)

	Hooks []hooks.GlobalHook // Discovered hooks

	Conversions *conversion.Converter // Schema version converter

	MetricStorage metricsstorage.Storage

	Patcher           *objectpatch.ObjectPatcher
	ScheduleManager   schedulemanager.ScheduleManager
	KubeEventsManager kubeeventsmanager.KubeEventsManager

	// OnDynamicChange is called after a global hook changed a module's signal (set, flipped or
	// removed; see filterEnabledFromValuesPatch), from the goroutine that ran the hook, with no lock
	// of the module held. Why: the signal is stripped from the values patch, so the values checksum
	// does not change and nothing else tells the scheduler to read IsEnabled again; the package
	// engine wires it to its recompute. Must not block for long. Nil: nobody listens.
	OnDynamicChange func()
}

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"`
	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) DisableHooks added in v1.78.0

func (m *Module) DisableHooks()

DisableHooks stops the hook bindings and drops the controllers, so the next InitializeHooks starts fresh. Called by the lanes' stop (hooklane): after a synchronization that failed midway and when Global exits.

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() map[string]any

GetHookSnapshotsDump returns the snapshots of the hooks' unlocked monitors (hooks.SnapshotsDump).

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 hook lanes drive global like any package.

func (*Module) GetHooksQueues added in v1.78.0

func (m *Module) GetHooksQueues() []string

GetHooksQueues returns the queues of the global hooks' schedule and Kubernetes bindings, sorted and without duplicates.

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) GetValue added in v1.78.0

func (m *Module) GetValue(key string) (any, bool)

GetValue is the global value at key, without the copies GetValues makes for rendering: the scheduler's getters read one key on every computation. The value is shared and must not be changed; the digests GetValues merges in are not part of it.

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.

The enabled modules' image digests are merged into modulesImages.digests here, over the ones the global hook read from the image, and not kept in the values: GetValuesChecksum, Global's Output, does not hash them, so a module update reruns only that module's subscribers.

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 returns the deckhouse image's version (Config.Version).

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 is the global hooks' signal of a module (kebab-case name) for the scheduler: the value a hook set last, or nil when none is set. Safe for concurrent use.

func (*Module) LatestSettingsVersion added in v1.78.0

func (m *Module) LatestSettingsVersion() int

LatestSettingsVersion returns the latest settings-schema version, the one effective settings are in; 0 without a converter.

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 the GVKs Global's ensureCRDs step installed into the .capabilities global value, exposed to charts as .Platform.capabilities

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) SetModulesImagesDigests added in v1.78.0

func (m *Module) SetModulesImagesDigests(digests map[string]map[string]string)

SetModulesImagesDigests replaces the image digests of the enabled modules, by module name (kebab-case): charts on the legacy helm_lib read another module's images from modulesImages.digests by its camelCase name.

func (*Module) UnlockKubernetesMonitors

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

UnlockKubernetesMonitors is called after a binding's synchronization ran, so its events flow.

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), then validates against OpenAPI schema.

Jump to

Keyboard shortcuts

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