Documentation
¶
Overview ¶
Package rule models the single enable/disable signal type the scheduler folds to decide whether a package may run. A Rule contributes one opinion over the Kind lattice; Resolve combines an ordered list of them. Both the old "gate" checks (version, dependency, bootstrap) and future intent signals (bundle, user config, enabled script) are expressed uniformly as Rules — the scheduler never branches on rule type, only on the resolved Kind.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Decision ¶
type Decision struct {
Kind Kind `json:"kind"`
Reason string `json:"reason,omitempty"`
Message string `json:"message,omitempty"`
}
Decision is a single rule's verdict: its opinion plus a reason and message suitable for surfacing as a Kubernetes status condition when the package ends up disabled.
func Resolve ¶
Resolve folds an ordered list of rules into a single decision:
- the first Forbid wins immediately — a hard veto cannot be overridden, so its position in the list does not affect the outcome;
- among soft votes (Enable/Disable) the last one wins, so later rules take precedence over earlier ones;
- Undefined rules are skipped; if every rule is Undefined the result is Undefined and the caller's floor decides the default.
type Kind ¶
type Kind string
Kind classifies a single rule's opinion about whether a package should run. The four values form a lattice with two soft states (overridable votes) and one hard state (a non-overridable veto); there is deliberately no hard "force-enable" — requirements must always retain the power to block.
const ( // Undefined means the rule has no opinion; resolution defers to other rules. Undefined Kind = "Undefined" // Enable is a soft vote to turn the package on; a later soft vote overrides it. Enable Kind = "Enable" // Disable is a soft vote to turn the package off; a later soft vote overrides it. Disable Kind = "Disable" // Forbid is a hard veto: the package is off and no other rule can re-enable it. Forbid Kind = "Forbid" )
type Rule ¶
type Rule interface {
// Decide evaluates the rule and returns its verdict.
Decide() Decision
}
Rule contributes one opinion about whether a package should run. Cross-module state (current versions, dependency presence, and the like) is captured by getters at construction time, so Decide takes no arguments.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package bundle provides a module floor rule: it enables a module when the cluster's active bundle is one that enables it in the active edition, and soft-disables it otherwise.
|
Package bundle provides a module floor rule: it enables a module when the cluster's active bundle is one that enables it in the active edition, and soft-disables it otherwise. |
|
Package dynamic provides the module enablement intent rule: the highest- precedence enablement signal a module carries, folding the external enable/disable signals (explicit ModuleConfig intent and the deprecated global-hook dynamic enable).
|
Package dynamic provides the module enablement intent rule: the highest- precedence enablement signal a module carries, folding the external enable/disable signals (explicit ModuleConfig intent and the deprecated global-hook dynamic enable). |
|
Package script models a module's enabled script as a scheduler rule.
|
Package script models a module's enabled script as a scheduler rule. |