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: 22 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

Overview

Package global runs Global: the global hooks, the global settings and the global run, which ensures the CRDs and conversion webhooks of the enabled modules and publishes the enabled set into the global values. Start reading with next.go (next and supersedes: every rule of Global), then loop.go.

Global is not a package Reconciler: it is never installed, updated or removed, its object is the global module the deckhouse image ships, and its hooks start once. It shares the convergence protocol with Current (facts for the node schedule.GlobalNode) and is the barrier: no other node's gate opens while Global is not converged, so a failing global run holds every new run. Packages hash Global's Output, not its Applied, so a failed or cancelled run cancels no run in flight. Global exists only with EnableModuleV2.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Node

func Node(version *semver.Version, revision string) schedule.Node

Node returns the global node: always enabled, order 0, no subscriptions, whatever the global module declares. revision is the version Global publishes its facts with. The barrier the other nodes wait behind is enforced by the scheduler by name, not by the order.

Types

type Config

type Config struct {
	// Module is the global module; Engine.Boot has added its node already.
	Module Module
	// Version is the identity Global publishes its facts with; the global node has the same.
	Version string
	// Settings is the checkpoint; nil makes Global wait for the first Apply.
	Settings *model.Settings
	// Notify is called after Global's Report changed; must not block. Nil disables it.
	Notify func()
}

Config is what Engine passes to New.

type Deps

type Deps struct {
	Scheduler publisher
	Hooks     hookLanes
	CRDs      crdService
	Webhooks  webhookService
	Clock     retry.Clock // Clock nil means the wall clock.
	Logger    *log.Logger // Logger nil means a no-op logger.
}

Deps are the effects of Global.

type Global

type Global struct {
	// contains filtered or unexported fields
}

Global is the global component; Engine creates, starts and stops it. The loop goroutine owns all state and decides with next. One operation at a time runs in a worker goroutine that only the loop starts and cancels: first the sync (next, rule 2), then the global runs. Why a worker: new settings and Stop must be able to cancel a run in flight.

func New

func New(cfg Config, deps Deps) *Global

New returns a Global that is not running yet.

func (*Global) Apply

func (g *Global) Apply(settings model.Settings)

Apply records the latest global settings. Non-blocking.

func (*Global) HandleScheduleEvent

func (g *Global) HandleScheduleEvent(ev schedule.Event)

HandleScheduleEvent records the latest event of the global node. Non-blocking.

func (*Global) Report

func (g *Global) Report() model.Report

Report returns a snapshot of Global's Report (only its Current section is written). Safe from any goroutine.

func (*Global) Start

func (g *Global) Start(parent context.Context)

Start reports its version, pushes the checkpoint settings, when there are any, and starts the loop, whose first operation is the sync. parent is the engine's context, not Boot's. Non-blocking.

func (*Global) Stop

func (g *Global) Stop()

Stop cancels the operation in progress, stops the global hook lanes and waits for every Global goroutine to exit, so a stopped Global never writes again. Nil-safe; returns at once if Start never ran.

func (*Global) Synced

func (g *Global) Synced() <-chan struct{}

Synced is closed once the global hooks are started and synchronized: the boot gate.

type Module

type Module interface {
	hooklane.Object

	GetVersion() *semver.Version
	ValidateSettings(ctx context.Context, settingsVersion int, settings addonutils.Values) (settingscheck.Result, error)
	ApplySettings(settingsVersion int, settings addonutils.Values) error
	// LatestSettingsVersion is the latest settings-schema version, the one a restored checkpoint
	// is applied at (the core sets it at Boot); 0 without versioned settings.
	LatestSettingsVersion() int
	GetSettings() addonutils.Values
	RunHooksByBinding(ctx context.Context, binding shtypes.BindingType) error
	// SetEnabledModules and SetCapabilities publish into the global values.
	SetEnabledModules(modules []string)
	SetCapabilities(apiVersions []string)
	// SetModulesImagesDigests publishes the enabled modules' image digests, by module name, beside
	// the values: renders see them, the values checksum (Output) does not.
	SetModulesImagesDigests(digests map[string]map[string]string)
}

Module is the global module as Global uses it (modules/global.Module).

Jump to

Keyboard shortcuts

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