Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Getter ¶
Getter retrieves the current version from the system. Examples:
- Kubernetes version from API server
- Deckhouse version from deployment
- Module version from registry
type Rule ¶
type Rule struct {
// contains filtered or unexported fields
}
Rule validates version constraints using semantic versioning. It is a pure gate: it either has no opinion (Undefined) or hard-vetoes (Forbid) — it never turns a package on, so a satisfied version check cannot override an intent rule.
func NewRule ¶
func NewRule(getter Getter, constraints *semver.Constraints, subject, reason string) *Rule
NewRule creates a new version rule with the given getter and constraints.
Example constraints:
- ">=1.21" - Minimum version 1.21
- ">=1.21, <2.0" - Range from 1.21 to 2.0
- "~1.21" - Patch releases of 1.21
- "^1.21" - Minor releases of 1.x
subject names what the version belongs to ("Kubernetes", "Deckhouse"). It carries the same information as reason, but in a form fit for a message shown to the user: the reason is a Kubernetes condition reason and is dropped on the admission path, where the message is all the user gets.