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 ¶
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 (*Global) HandleScheduleEvent ¶
HandleScheduleEvent records the latest event of the global node. Non-blocking.
func (*Global) Report ¶
Report returns a snapshot of Global's Report (only its Current section is written). Safe from any goroutine.
func (*Global) Start ¶
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.
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).