Documentation
¶
Overview ¶
Package versions exposes kure's supported-version metadata as a stable Go API, so consumers do not have to parse versions.yaml key paths by hand.
The data in versions_gen.go is generated from versions.yaml by scripts/sync-versions.sh; `./scripts/sync-versions.sh check` (run in CI) fails if the generated file has drifted from versions.yaml.
Only machine-readable fields are exported. Reviewer prose (notes, related_packages), the release-pinning fields, and the go.mod build version are omitted: the build version moves on every dependency bump, and the others can change too (prose edits, a release-pinned dependency being re-pinned) even though not every routine bump touches them. Excluding all of them keeps this API's content stable rather than tied to prose or pin churn.
Index ¶
Examples ¶
Constants ¶
const GoVersion string = "1.27.3" // doc-gate:trivial
GoVersion is the go.current field of versions.yaml.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dependency ¶
type Dependency struct {
// Name is the versions.yaml key, e.g. "kubernetes".
Name string
// GoModule is the Go module path kure imports for this dependency.
GoModule string
// SupportedRange is the raw supported_range, e.g. "1.33 - 1.36" -- the
// range of deployed tool versions kure targets, not the build version.
SupportedRange string
// Min is the low bound of SupportedRange, major.minor.
Min string
// Max is the high bound of SupportedRange; equals Min for a
// single-value range such as "0.5".
Max string
// VersionBasis is "semver" (default) or "kubernetes" -- the latter for a
// module versioned v0.N.x whose range is expressed in cluster terms (1.N).
VersionBasis string
// FloorModule is set only for an MVS-floor dependency: one whose pin is
// not chosen directly but is the Go minimum-version-selection floor set
// by another module's own go.mod requirement. When non-empty,
// SupportedRange, Min and Max are empty -- there is no hand-maintained
// range to report, since kure never chose this version. Empty for every
// other entry.
FloorModule string
}
Dependency is one infrastructure entry's machine-readable metadata.
func All ¶
func All() []Dependency
All returns every infrastructure dependency, in versions.yaml document order. The returned slice is a copy; callers may modify it freely.
func Get ¶
func Get(name string) (Dependency, bool)
Get returns the dependency stored under the given versions.yaml key. ok is false when no such entry exists.
Example ¶
package main
import (
"fmt"
"github.com/go-kure/kure/pkg/versions"
)
func main() {
k8s, ok := versions.Get("kubernetes")
if !ok {
return // the key was renamed or removed
}
fmt.Println(k8s.SupportedRange, k8s.Min, k8s.Max)
for _, d := range versions.All() {
fmt.Printf("%s: %s (%s)\n", d.Name, d.SupportedRange, d.GoModule)
}
fmt.Println(versions.GoVersion) // versions.yaml's go.current
}
Output: