engine

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: Apache-2.0 Imports: 14 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

Index

Constants

View Source
const GapKBCoverage inventory.Capability = "kb-coverage"

GapKBCoverage is the CapabilityGap capability recorded when the target is beyond the knowledge base horizon. It is not a collector capability.

View Source
const GapTarget inventory.Capability = "target"

GapTarget is the CapabilityGap capability recorded when the target is not an upgrade of the cluster. It is not a collector capability.

View Source
const MaxFindingNamespaces = 100

MaxFindingNamespaces caps the namespaces a finding lists, in Namespaces (NamespacesOmitted counts the rest) and in an API usage finding's evidence sentence, as inventory.MaxObjectRefs caps its objects: a finding's size does not grow with how many namespaces it affects. Its Teams still come from every affected namespace.

View Source
const ReportSchemaVersion = 1

ReportSchemaVersion versions the JSON shape of a report: `scan --output json` (and --write-baseline) and the server's report-shaped /api/v1 responses. Within one schemaVersion fields are only ever added, never renamed, removed, retyped or given a new meaning, so consumers must ignore fields they do not know; any breaking change bumps it (see docs/compatibility-policy.md and api/report.schema.json).

View Source
const UnattributedTeam = "(unattributed)"

UnattributedTeam is the name the presentation layers (CLI table and JSON, server API, dashboard) give the bucket of findings no team owns, which TeamScores keys by "". It carries parentheses, which a Kubernetes label value cannot, so no real team can be named it: a team called "unattributed" is a different row (#243).

Variables

View Source
var ErrReportTooLarge = errors.New("the report would be over its size limit")

ErrReportTooLarge is EvaluateWithin's error for an inventory whose report would be over its size limit.

Functions

func BaseOfUnservedKey added in v0.2.0

func BaseOfUnservedKey(key string) (string, bool)

BaseOfUnservedKey is the key of the removal of the API an unserved finding's key names, and whether key is an unserved key at all.

A Helm release's key is removed-api/helm-release/<namespace>/<name>, so a release named "unserved" is not one: only an API key (group, version and kind after the category) is.

func FoldsInto added in v0.2.0

func FoldsInto(call, usage string) bool

FoldsInto reports whether call, the key of a deprecated-api-in-use finding, names the API of usage, the key of an API usage finding (removed-api, deprecated-api, unknown-api): the match foldDeprecatedCalls folds a caller row by. A report with both findings has usage's key alone, so call's is a finding of its own in a report whose api-usage did not see that API, without anything having changed.

func HiddenBy added in v0.2.0

func HiddenBy(gaps []CapabilityGap, c Category, key string) []inventory.Capability

HiddenBy lists the capabilities of gaps, a report's NotAssessed, that leave the finding of category c and key unassessed, in gaps' order: a report with any could not have produced the finding. A gap hides it when its capability is one of the finding's Sources and is unavailable, or partial with Skipped naming what the finding is about. A partial capability's Skipped is what it did not read, so:

  • api-usage and deprecated-calls leave unassessed the APIs they name ("group/version Kind", "group/version resource");
  • helm leaves unassessed the releases it names ("namespace/name"), and every release when it names anything without a slash: a storage driver, or a GitOps tool ("argocd", "flux"). A GitOps tool is broader than it need be: its gap concerns the charts it deploys, not the releases read fine from Secrets, which it hides findings of too, since a release's key does not say which tool deployed it. It also leaves unassessed every add-on when it names anything, since an add-on's key does not say which release, if any, it was found through;
  • any other capability that names something leaves all of its findings unassessed;
  • a partial capability that names nothing read everything that could have produced a finding.

Every gap hides a finding of a category this binary does not know.

func HopTargets added in v0.2.0

func HopTargets(k kb.KB, from, to inventory.Version) []inventory.Version

HopTargets is the minor the control plane reaches at each hop from from to to: from each version, the farthest k.UpgradeSteps step that does not pass to, else the next minor. Empty when to is not newer than from (or on another major, which Kubernetes has never released).

func PlanFrom added in v0.2.0

func PlanFrom(inv inventory.Inventory) (inventory.Version, bool)

PlanFrom is the minor a live cluster's plan starts from: its oldest kube-apiserver, the version Evaluate judges an upgrade from. ok is false in files mode or without a parseable version.

func RemovalOfCall added in v0.2.0

func RemovalOfCall(k kb.KB, key string) (inventory.Version, bool)

RemovalOfCall is the release in which k removes the API a deprecated-calls finding key names ("deprecated-api-in-use/group/ version/resource[/subresource]", the group "core" for the core one): the removal of the lifecycle entry for that group and version whose kind has that REST resource. It reports false for any other key and for an API the knowledge base does not know, or knows without a removal; the metric's own removedRelease is not in the key.

func Score

func Score(findings []Finding) (score int, ready bool)

Score implements the spec §6 formula:

score = 100 − min(75, 25·#blockers) − min(20, 5·#warnings)
ready = #blockers == 0

The caps bound the deductions, so the score never drops below 5. Info findings are listed but never scored. This ready is findings-only (per-team scores use it); a Report's readiness is its Verdict, which is also unknown when a required capability was not assessed.

func SortFindings added in v0.2.0

func SortFindings(fs []Finding)

SortFindings orders findings as a report holds them (sortFindings).

func Sources added in v0.2.0

func Sources(c Category, key string) []inventory.Capability

Sources lists the inventory capabilities a finding of category c and key is built from; nil for a category this binary does not know.

func SupportKey added in v0.2.0

func SupportKey(provider, minor string, phase SupportPhase) string

SupportKey is the Finding.Key of a support-lifecycle finding: support-lifecycle/<provider>/<minor>/<phase>, the phase being ending, extended or ended (SupportPhase; no finding is made in phase standard).

func TeamScores

func TeamScores(r Report) map[string]TeamScore

TeamScores groups a report's findings by team and scores each subset with Score. A finding attributed to N teams counts for each of them; a finding with no teams is attributed to the empty-string team "" (callers render it as UnattributedTeam). Pure: no I/O, no clock — same contract as Evaluate. The result is deliberately NOT part of engine.Report; servers and CLIs compute it at presentation time.

A team's verdict follows the report's rules (verdictFor) over what can concern it (#196): it is blocked by a blocker of its own, or by an unattributed one, which cannot be ruled out as the team's and blocks the cluster's upgrade either way; otherwise unknown on any required gap, which may have hidden a blocker of any team; otherwise ready. Score, Blockers and Warnings stay the team's own. Another team's blocker leaves it ready.

func UnservedKey added in v0.2.0

func UnservedKey(removalKey string) string

UnservedKey is the Finding.Key of a removed-api finding for an API the target does not serve yet, from the key the removal of that API has, removed-api/<group>/<version>/<kind>: the phase is part of the key (removed-api/<group>/<version>/<kind>/unserved), as a support-lifecycle key's is (SupportKey), so a rule or a baseline for one phase never accepts the other (#300). The removal blocker and the next-minor removal warning share the bare key: an ignore rule accepts a key whatever the severity.

Types

type BaselineState added in v0.2.0

type BaselineState string

BaselineState mirrors SARIF's result.baselineState values.

const (
	BaselineNew       BaselineState = "new"
	BaselineUnchanged BaselineState = "unchanged"
)

type Caller added in v0.2.0

type Caller struct {
	Group       string   `json:"group,omitempty"` // "" for core
	Version     string   `json:"version"`
	Resource    string   `json:"resource"`
	Subresource string   `json:"subresource,omitempty"`
	Key         string   `json:"key"`
	Severity    Severity `json:"severity"`
	Title       string   `json:"title"`
	Detail      string   `json:"detail"`
}

Caller is one apiserver_requested_deprecated_apis row folded into an API usage finding: the API it requested and the deprecated-api-in-use finding it is on its own (Finding).

func (Caller) Finding added in v0.2.0

func (c Caller) Finding() Finding

Finding is c as the standalone deprecated-api-in-use finding evalDeprecatedCalls built for its row.

type CapabilityGap

type CapabilityGap struct {
	Capability inventory.Capability `json:"capability"`
	Reason     string               `json:"reason"`
	// Partial: the capability ran but did not read everything; Skipped is
	// what it named as unread (see inventory.CapabilityStatus).
	Partial  bool     `json:"partial,omitempty"`
	Skipped  []string `json:"skipped,omitempty"`
	Required bool     `json:"required,omitempty"`
}

CapabilityGap is one thing the evaluation could not assess. Capability is usually a collector capability whose sub-collector failed (Reason is its error). The engine also adds gaps of its own:

  • capability "versions", when the inventory's versions capability is available but the server version is missing or unparseable — the kubelet and control-plane skew rules then had no reference version;
  • capability "kb-coverage" (GapKBCoverage), when the target is newer than the knowledge base's MaxKnownK8s — removals in releases the KB does not know about cannot be found;
  • capability "target" (GapTarget), when a cluster inventory's oldest kube-apiserver already runs the target minor or a newer one — the target is not an upgrade, and every check judges a newer minor.

A capability that is available but Partial (it could not read all it covers) is a gap too, with Partial set and the capability's Skipped.

Required marks gaps that make the verdict unknown, because a blocker may be behind them:

  • api-usage, kb-coverage and target, always;
  • versions, for cluster inventories;
  • addons, for cluster inventories while the KB's add-on registry is not empty: the EOL add-on check is a headline check, and files mode has no running add-ons to detect;
  • a partial addons, for cluster inventories, when Skipped names the pods (inventory.SkippedPods): only Helm releases and IngressClasses were read, and an add-on installed any other way goes undetected;
  • a partial api-usage, when Skipped names an API the KB removes at or before the target (an unchecked object of it would be a blocker), or names inventory.SkippedNewerKB: the agent collected with another knowledge base than the server judges with, so any API the server flags may have gone unlisted;
  • a partial addons, likewise, when Skipped names inventory.SkippedNewerKB (add-ons the server's registry knows were never matched);
  • a partial versions, for cluster inventories, when Skipped names a component whose version upstream would have told but was not read (it may be the one past the skew policy), or "nodes", when no Node was listed (a kubelet past the policy would be a blocker; a forbidden Node list makes versions unavailable, required too).

Other gaps only narrow what the report covers: a partial api-usage that skipped only APIs removed later or never (their findings are warnings or info) or none the KB flags, a partial versions naming no component (a vendor kube-proxy image, OKE's), deprecated-calls (managed control planes commonly deny /metrics), helm (Secrets are commonly denied; live objects are still checked by api-usage, and add-ons by their images).

func (CapabilityGap) Label added in v0.2.0

func (g CapabilityGap) Label() string

Label names the gap as every output renders it: the capability, with "partial" and "required" in parentheses when they apply, e.g. "api-usage (partial, required)".

type Category

type Category string
const (
	CatRemovedAPI         Category = "removed-api"
	CatDeprecatedAPI      Category = "deprecated-api"
	CatDeprecatedAPIInUse Category = "deprecated-api-in-use"
	CatEOLAddon           Category = "eol-addon"
	CatEOLApproaching     Category = "eol-approaching"
	CatVersionSkew        Category = "version-skew"
	CatChartIncompat      Category = "chart-incompat"
	CatKBStale            Category = "kb-stale"
	// CatAddOnNoData (info): a detected add-on whose version has no
	// lifecycle data, so its EOL and compatibility were not assessed.
	CatAddOnNoData Category = "addon-no-data"
	// CatUnknownAPI (info): objects of a built-in API group (core, or any
	// group k8s.io/api registers: KB.BuiltinGroups and the groups of its
	// entries) at a version/kind the KB does not know, so whether the
	// target serves it was not assessed. CRD and aggregated groups
	// produce nothing.
	CatUnknownAPI Category = "unknown-api"
	// CatCRDVersion: a CustomResourceDefinition version problem that
	// breaks an add-on upgrade, whatever the Kubernetes target: custom
	// resources at a version the CRD does not serve (blocker) or
	// deprecates (warning; info when none is in use), or a
	// status.storedVersions entry it no longer serves (warning).
	CatCRDVersion Category = "crd-version"
	// CatSupportLifecycle: the cluster's Kubernetes minor is about to
	// leave (warning), or has left (blocker), its managed provider's
	// standard support (EKS, GKE, AKS), dated and, where the provider's
	// price is cited, with what extended support adds per year.
	CatSupportLifecycle Category = "support-lifecycle"
)
const CatVolumePlugin Category = "volume-plugin"

CatVolumePlugin: an in-tree volume plugin that pods, pod templates or PersistentVolumes name (#351), or StorageClasses name the in-tree provisioner of (#362), judged by the knowledge base's kb.VolumePlugins: removed with no migration path (blocker at or after the removal, warning the minor before it, info earlier), served only through a named CSI driver (warning at or after the minor the in-tree code went, info earlier; never a blocker, since a cluster with the driver is fine), or deprecated only (info).

type Envelope added in v0.2.0

type Envelope struct {
	SchemaVersion int    `json:"schemaVersion"`
	ToolVersion   string `json:"toolVersion"`
}

Envelope leads every report-shaped JSON document: embedded first in the presentation struct, its fields come before the report's. ToolVersion is informational (the build that wrote the document) and carries no compatibility meaning.

func NewEnvelope added in v0.2.0

func NewEnvelope(toolVersion string) Envelope

NewEnvelope is the envelope of a report written by toolVersion.

type Finding

type Finding struct {
	Category Category `json:"category"`
	Severity Severity `json:"severity"`
	// Key is the finding's stable, count-free identity: it never embeds
	// object counts, node counts, or other volatile numbers, so the same
	// underlying problem keeps the same Key across snapshots even as Title
	// fluctuates ("3 objects" → "2 objects"). Notification delta diffing
	// keys on it. Convention: category + "/" + stable discriminator
	// (e.g. "removed-api/extensions/v1beta1/Ingress", "eol-addon/ingress-nginx").
	Key    string   `json:"key,omitempty"`
	Title  string   `json:"title"`           // one line, deterministic
	Detail string   `json:"detail"`          // evidence sentence(s), deterministic
	Teams  []string `json:"teams,omitempty"` // sorted, deduped; of every affected namespace, listed or not
	// Namespaces are the affected namespaces, sorted, at most
	// MaxFindingNamespaces; NamespacesOmitted counts the ones not listed.
	Namespaces        []string `json:"namespaces,omitempty"`
	NamespacesOmitted int      `json:"namespacesOmitted,omitempty"`
	// Unnamespaced marks an add-on finding that also covers an install in
	// no named namespace: a manifest object without metadata.namespace
	// (helm template output usually has none, and the install can land in
	// any namespace), or a cluster-scoped IngressClass. Namespaces does not
	// list it, so a namespace-scoped ignore rule cannot be shown to match
	// it and leaves the finding (suppress.Apply).
	Unnamespaced bool     `json:"unnamespaced,omitempty"`
	Remediation  string   `json:"remediation,omitempty"`
	Citations    []string `json:"citations,omitempty"`
	// Objects identifies the affected objects for API-usage findings
	// (copied from inventory.APIUsage, so at most inventory.MaxObjectRefs;
	// inside the server's /gate, where the PR's refs are added to the
	// cluster's, up to twice that, until capObjects cuts the listing back
	// to MaxObjectRefs), sorted by file, line, namespace, name;
	// ObjectsOmitted counts the affected objects not listed. Empty when the collector could not
	// identify objects.
	Objects        []inventory.ObjectRef `json:"objects,omitempty"`
	ObjectsOmitted int                   `json:"objectsOmitted,omitempty"`
	// BaselineState is set only when the report was compared with a
	// baseline (scan --baseline): BaselineUnchanged when the baseline
	// already had this Key and every object listed here, else BaselineNew.
	// The CLI gate fails only on new findings; score and verdict count both.
	BaselineState BaselineState `json:"baselineState,omitempty"`
	// Callers are the apiserver_requested_deprecated_apis rows folded into
	// this API usage finding (foldDeprecatedCalls), in row order: each is
	// what its deprecated-api-in-use finding would have been on its own.
	// They are evidence about clients, not about the listed objects, so
	// suppressing every object of the finding does not suppress them
	// (suppress.Apply re-emits them as findings of their own).
	Callers []Caller `json:"callers,omitempty"`
}

type FindingRef added in v0.2.0

type FindingRef struct {
	Key      string   `json:"key"`
	Severity Severity `json:"severity"`
	// Was is the severity at the last earlier hop that had the finding;
	// set only in Hop.Changed.
	Was   Severity `json:"was,omitempty"`
	Title string   `json:"title"`
	// Since is the To of the hop that lists the finding in full.
	Since inventory.Version `json:"since"`
}

FindingRef refers to a finding listed in full at an earlier hop, with its severity and title at this one.

type Hop added in v0.2.0

type Hop struct {
	From  inventory.Version `json:"from"`
	To    inventory.Version `json:"to"`
	Score int               `json:"score"` // Evaluate's at To
	// Verdict is Evaluate's at To: blocked when any finding of this hop,
	// new or referenced, is a blocker.
	Verdict  Verdict      `json:"verdict"`
	Findings []Finding    `json:"findings"` // first seen at this hop; Evaluate's order
	Changed  []FindingRef `json:"changed,omitempty"`
	Carried  []FindingRef `json:"carried,omitempty"`
	// NotAssessed is Evaluate's at To, every gap (not only new ones).
	NotAssessed []CapabilityGap `json:"notAssessed,omitempty"`
}

Hop is one control-plane upgrade of an upgrade plan (see Plan): the cluster as it is, judged at To. Findings lists only what this hop adds; a finding listed at an earlier hop is referenced instead, in Changed when its severity differs from the hop before, else in Carried. So each finding is listed in full once, at its first hop, and Findings, Changed and Carried together are everything the cluster has to fix before the control plane reaches To.

func Plan added in v0.2.0

func Plan(inv inventory.Inventory, k kb.KB, from, to inventory.Version, now time.Time) []Hop

Plan judges the cluster at each hop from from to to (HopTargets) and returns the hops in order, each finding listed at its first hop only (see Hop). It is empty when to is not an upgrade of from. Like Evaluate it is pure: the final hop's blockers, score and verdict are Evaluate's at to.

func PlanReports added in v0.2.0

func PlanReports(from inventory.Version, reports []Report) []Hop

PlanReports builds the hops of a plan from from out of the reports judged at each hop's target, in order (Plan evaluates them; the scan command passes them through its ignore rules first). A finding is identified by its Key.

func (Hop) Count added in v0.2.0

func (h Hop) Count(sev Severity) int

Count is the number of this hop's findings, new or referenced, at sev.

type Report

type Report struct {
	ClusterID string            `json:"clusterId"`
	Target    inventory.Version `json:"target"`
	// ServerVersion is the inventory's raw kube-apiserver GitVersion, the
	// version the target was judged against; empty in files mode.
	ServerVersion string `json:"serverVersion,omitempty"`
	// KubeContext and APIServer say which cluster a live scan read: the
	// kubeconfig context and the API server URL (scheme, host and port;
	// no credentials, path or query). Evaluate never sets them; the scan
	// command does. Empty in files mode.
	KubeContext string `json:"kubeContext,omitempty"`
	APIServer   string `json:"apiServer,omitempty"`
	KBVersion   string `json:"kbVersion"`
	Score       int    `json:"score"` // from findings only; see Score
	// Ready is Verdict == VerdictReady, kept for v0.1 consumers.
	Ready       bool            `json:"ready"`
	Verdict     Verdict         `json:"verdict"`
	Findings    []Finding       `json:"findings"`              // sorted: severity desc, category, title
	NotAssessed []CapabilityGap `json:"notAssessed,omitempty"` // sorted by capability
	// Support places the cluster's Kubernetes minor in its managed
	// provider's support calendar (see SupportStatus); nil when the
	// provider is not EKS, GKE or AKS or its dates for the minor are not
	// known. It is the same for every target.
	Support *SupportStatus `json:"support,omitempty"`
	// Suppressed lists what ignore rules took out of Findings (see
	// internal/suppress); Evaluate never sets it.
	Suppressed []SuppressedFinding `json:"suppressed,omitempty"`
	// UnrecognizedImages are the image repositories no registry image
	// matcher claims (inventory.UnrecognizedImages), so an add-on
	// detection gap is visible; never findings, so they change neither
	// score nor verdict. Sorted, deduplicated, at most
	// inventory.MaxUnrecognizedImages; UnrecognizedImagesOmitted counts
	// the ones the cap dropped.
	UnrecognizedImages        []string `json:"unrecognizedImages,omitempty"`
	UnrecognizedImagesOmitted int      `json:"unrecognizedImagesOmitted,omitempty"`
	// AddOnEvidenceAgeSeconds is how old the pod evidence the add-ons were
	// detected from was, in seconds, when the agent reused the last full
	// pod pass instead of listing every pod again (inventory
	// AddOnEvidenceAgeSeconds, #228): an add-on installed or upgraded since
	// is reported as it was then. Absent when every pod was read for this
	// report, and in reports of collectors that predate it. The verdict does
	// not depend on it.
	AddOnEvidenceAgeSeconds int64 `json:"addOnEvidenceAgeSeconds,omitempty"`
	// Hops is the upgrade plan up to Target (see Plan), set by scan
	// --plan; Evaluate never sets it. The rest of the report is the
	// final target's.
	Hops []Hop `json:"hops,omitempty"`
}

func Evaluate

func Evaluate(inv inventory.Inventory, k kb.KB, target inventory.Version, now time.Time) Report

Evaluate is the pure evaluation entrypoint: no I/O, no clock reads — now is injected for EOL-window math. Output is fully deterministic for a given (inventory, kb, target, now), whatever the order of the inventory's slices: that includes a CRD's spec.versions (the versions a detail names are listed sorted) and a capability's Skipped list (reported sorted). The inventory itself is never reordered (#165, #367). EvaluateWithin bounds its size.

func EvaluateWithin added in v0.2.0

func EvaluateWithin(inv inventory.Inventory, k kb.KB, target inventory.Version, now time.Time, maxBytes int) (Report, error)

EvaluateWithin is Evaluate for a report of at most maxBytes: it charges each finding it builds, and what the report adds besides, at about the bytes its strings take (findingSize), and stops with ErrReportTooLarge as soon as the charge passes maxBytes. Its findings are built one input element at a time, so an evaluation that stops holds at most maxBytes of report and the findings of one element. Within the limit the report is Evaluate's.

A server evaluates inventories anyone with a push token sends: the engine repeats what an inventory names (a team in every finding of its namespaces, a release in the text of each of its findings), so a few megabytes of a push could build a report many times its size.

func (*Report) Rescore added in v0.2.0

func (r *Report) Rescore()

Rescore recomputes Score, Verdict and Ready from Findings and NotAssessed, for callers that remove findings after Evaluate.

type Severity

type Severity string
const (
	SevBlocker Severity = "blocker"
	SevWarning Severity = "warning"
	SevInfo    Severity = "info"
)

type SupportPhase added in v0.2.0

type SupportPhase string

SupportPhase is where a managed cluster's Kubernetes minor stands in its provider's support calendar.

const (
	// SupportStandard: standard support, and it does not end within
	// supportWarnDays.
	SupportStandard SupportPhase = "standard"
	// SupportEnding: standard support ends within supportWarnDays; the
	// finding is a warning.
	SupportEnding SupportPhase = "ending"
	// SupportExtended: past standard support, before the provider's
	// extended window for the minor ends (EKS and GKE bill it; on AKS it
	// is the end of Long Term Support, which the collector cannot see is
	// enabled; AKS's platform support is not this window and is only for
	// the one minor behind community support); the finding is a blocker.
	SupportExtended SupportPhase = "extended"
	// SupportEnded: past the end of extended support, or past standard
	// support for a minor the provider offered no extended support for;
	// the finding is a blocker.
	SupportEnded SupportPhase = "ended"
)

type SupportStatus added in v0.2.0

type SupportStatus struct {
	Provider string       `json:"provider"` // eks | gke | aks
	Minor    string       `json:"minor"`    // the control plane's, "1.34"
	Phase    SupportPhase `json:"phase"`
	// ExtendedSupportFrom is the day standard support ends and extended
	// support begins (UTC; EKS bills from the start of that day).
	ExtendedSupportFrom string `json:"extendedSupportFrom"`
	// ExtendedSupportEnds is the day extended support ends; empty when the
	// provider offered none for the minor.
	ExtendedSupportEnds string `json:"extendedSupportEnds,omitempty"`
	// AnnualCostDelta is what extended support adds per cluster per year
	// at the provider's list price, (extended - standard) x 8760 in
	// Currency, as a decimal string ("4380.00"). Set only when the provider
	// publishes a price the dataset cites and the minor can still be in
	// extended support; PriceAsOf is the day the price was read. It is a
	// list price, not a bill.
	AnnualCostDelta string `json:"annualCostDelta,omitempty"`
	Currency        string `json:"currency,omitempty"`
	PriceAsOf       string `json:"priceAsOf,omitempty"`
	// AnnualCostNote is the provider's caveat on whom the price applies to
	// ("charged only for clusters on the Extended release channel"); it
	// travels with AnnualCostDelta wherever that is shown.
	AnnualCostNote string `json:"annualCostNote,omitempty"`
	// ExtendedSupportCondition is set where the provider's extended window
	// is not automatic (GKE, AKS): the configuration under which it
	// applies, as a clause completing "only if ...". The collector cannot
	// see it, so phases ending and extended mean the provider's window, not
	// that this cluster is enrolled in it.
	ExtendedSupportCondition string `json:"extendedSupportCondition,omitempty"`
}

SupportStatus is a managed cluster's place in its provider's support calendar, set whenever the provider and the minor are known, whether or not it is a finding. Evaluate leaves Report.Support nil for a cluster whose provider is unknown, other, or has no dates for its minor.

func (SupportStatus) Summary added in v0.2.0

func (s SupportStatus) Summary() string

Summary is the status in one line for the scan table: the dates, and the annual extended-support cost labelled as a list price with its as-of day where the provider's price is cited.

type SuppressedFinding added in v0.2.0

type SuppressedFinding struct {
	Finding
	Reason string `json:"reason"`
	// Source names what suppressed it: the config file, "annotation", or
	// "spec.ignore" (the agent).
	Source  string `json:"source"`
	Expires string `json:"expires,omitempty"` // YYYY-MM-DD, as the rule gave it
}

SuppressedFinding is a finding, or some of its objects (Objects then lists only those), that an ignore rule or object annotation accepted. It is excluded from score and verdict but still reported, with why.

type TeamScore

type TeamScore struct {
	Score int `json:"score"`
	// Ready is Verdict == VerdictReady.
	Ready bool `json:"ready"`
	// Verdict is the team's readiness (see TeamScores): blocked by a
	// blocker of its own or one no team is attributed, otherwise unknown
	// when the report has a required gap, otherwise ready.
	Verdict  Verdict `json:"verdict"`
	Blockers int     `json:"blockers"`
	Warnings int     `json:"warnings"`
}

TeamScore is one team's slice of a report, scored with the same spec §6 formula as the cluster score, over only that team's findings.

type Verdict added in v0.2.0

type Verdict string

Verdict is the report's readiness answer.

const (
	// VerdictReady: no blockers, and everything required was assessed.
	VerdictReady Verdict = "ready"
	// VerdictBlocked: at least one blocker finding.
	VerdictBlocked Verdict = "blocked"
	// VerdictUnknown: no blockers found, but a required gap (see
	// CapabilityGap.Required) means blockers may have been missed.
	VerdictUnknown Verdict = "unknown"
)

func StoredVerdict added in v0.2.0

func StoredVerdict(ready bool, blockers int) Verdict

StoredVerdict reads a report's verdict back from the two facts a stored evaluation keeps beside the report: its ready flag (Verdict == VerdictReady) and its blocker count. Ready is ready; otherwise any blocker is blocked; otherwise a required gap hid the answer, so unknown. It is the one place that derives a verdict from a row, shared by the server and both stores, so the verdict a list, a history point and a summary show cannot drift apart.

Jump to

Keyboard shortcuts

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