scopeverify

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package scopeverify checks that the UI's view of an install's scope matches what the controller itself reports (D-009 §3).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Input

type Input struct {
	Install  install.Resolved
	Snapshot *cache.Snapshot
	Served   []kinds.Served
	// Collected are the collector values this computation read; a verifier
	// reads its controller's data from them, such as ctrlmetrics.Key.
	Collected collect.Snapshot
	Now       time.Time
	// Views decodes routes to count their parentRefs; nil decodes directly.
	Views objects.Decoder
}

Input is what a Verifier needs for one install.

type ManagedCountVerifier

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

ManagedCountVerifier compares per-(namespace, resource) counts with kgateway_resources_managed, weighting objects exactly as the gauge does.

func NewManagedCountVerifier

func NewManagedCountVerifier(persist time.Duration) *ManagedCountVerifier

NewManagedCountVerifier reports mismatches that have lasted longer than persist; callers pass 2 × the metrics interval (design §4.4).

func (*ManagedCountVerifier) Name

func (*ManagedCountVerifier) Name() string

Name implements Verifier.

func (*ManagedCountVerifier) Persist

func (v *ManagedCountVerifier) Persist() time.Duration

Persist returns how long a mismatch must last before it is reported.

func (*ManagedCountVerifier) Verify

func (v *ManagedCountVerifier) Verify(in Input) Result

Verify implements Verifier. Persistence needs continuous observation, so any unavailable result restarts it for the install.

type Mismatch

type Mismatch struct {
	Namespace  string    `json:"namespace"`
	Resource   string    `json:"resource"`
	UI         float64   `json:"ui"`
	Controller float64   `json:"controller"`
	Since      time.Time `json:"since"`
}

Mismatch is a (namespace, resource) whose counts have disagreed since Since.

type Result

type Result struct {
	Available  bool
	Reason     string
	Mismatches []Mismatch
	// Matures, if set, is the earliest instant after which a pending mismatch
	// will be reported (a strict "after" deadline). The engine recomputes then (D-019).
	Matures time.Time
}

Result is a verification outcome. Available=false means the verifier could not run; it never decides health on its own (design §4.4).

type Verifier

type Verifier interface {
	Name() string
	Verify(in Input) Result
}

Verifier compares the UI's scope with the controller's. Downstreams may register their own.

Jump to

Keyboard shortcuts

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