kb

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 11, 2026 License: Apache-2.0 Imports: 5 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 kb loads and indexes the three upgrade-readiness datasets: generated API lifecycle data, the add-on EOL registry, and the hardcoded Kubernetes version-skew policy.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APILifecycleEntry

type APILifecycleEntry struct {
	Group       string             `json:"group"` // "" for core
	Version     string             `json:"version"`
	Kind        string             `json:"kind"`
	Introduced  inventory.Version  `json:"introduced"`
	Deprecated  *inventory.Version `json:"deprecated,omitempty"`
	Removed     *inventory.Version `json:"removed,omitempty"`
	Replacement *GVK               `json:"replacement,omitempty"`
}

APILifecycleEntry describes one versioned API kind's lifecycle, as extracted from k8s.io/api generated APILifecycle* methods by tools/gen-kb.

type GVK

type GVK struct {
	Group   string `json:"group"`
	Version string `json:"version"`
	Kind    string `json:"kind"`
}

type Index

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

Index is an O(1) lookup over lifecycle entries by group/version/kind.

func NewIndex

func NewIndex(entries []APILifecycleEntry) Index

func (Index) Lookup

func (i Index) Lookup(group, version, kind string) (APILifecycleEntry, bool)

Lookup returns the entry for group/version/kind. Group is "" for core.

type KB

type KB struct {
	Version      string // dataset version, e.g. "k8s-1.36+registry-2026-06-10"
	APILifecycle []APILifecycleEntry
	AddOns       []registry.AddOn
	Skew         SkewPolicy
	MaxKnownK8s  inventory.Version // newest minor the lifecycle data covers
}

func Load

func Load() (KB, error)

Load builds the KB from the embedded API lifecycle dataset, the embedded add-on registry, and the default skew policy. It fails loudly on a corrupt or empty dataset — a silent empty KB would mean silent green scans.

type SkewPolicy

type SkewPolicy struct {
	KubeletMaxBehind   int // kubelet ≤ apiserver and ≥ apiserver−3
	KubectlMaxSkew     int // kubectl within ±1 of apiserver
	APIServerHASpread  int // HA apiservers within 1 minor of each other
	KubeProxyMaxBehind int // kube-proxy ≤ apiserver and ≥ apiserver−3
	CtrlMgrMaxBehind   int // controller-manager/scheduler ≤ apiserver, ≥ apiserver−1
}

SkewPolicy encodes the upstream Kubernetes version-skew policy (https://kubernetes.io/releases/version-skew-policy/). All values are minor-version distances relative to kube-apiserver.

Extends the shared type contract with KubeProxyMaxBehind and CtrlMgrMaxBehind — both are upstream policy rules the engine evaluates.

func DefaultSkewPolicy

func DefaultSkewPolicy() SkewPolicy

DefaultSkewPolicy returns the upstream policy as of Kubernetes 1.28+ (when kubelet skew widened from n−2 to n−3).

Jump to

Keyboard shortcuts

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