explore

package
v0.8.1 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: 21 Imported by: 0

Documentation

Overview

Package explore builds the per-install index of routes, Gateways and ListenerSets that the explorer serves (design §3.2, §3.5). An Index is built once per recompute and is immutable once published: handlers filter and page it, and never decode objects themselves.

Index

Constants

View Source
const (
	// MaxPaths is the number of complete paths a walk returns.
	MaxPaths = 5
	// MaxDepth is the most routes on one path.
	MaxDepth = 32
	// MaxNodes is the most route visits one walk makes.
	MaxNodes = 256
)

Up-chain bounds (design §5.3).

View Source
const (
	DefaultLimit = 50
	MaxLimit     = 200
)

Page limits (design §7.2).

View Source
const ListenerUnknown = "_unknown"

ListenerUnknown is the listener filter value that selects unknown refs. No listener name can contain "_", so it never shadows a listener.

Variables

View Source
var (
	ErrBadCursor = errors.New("bad cursor")
	ErrBadQuery  = errors.New("bad query")
)

Query errors; the handler answers both with 400 (design §7.2).

Functions

func DetailKinds

func DetailKinds(served []kinds.Served) []objects.GroupKind

DetailKinds returns the served group/kinds with a detail view: Gateway, every ListenerSet kind, HTTPRoute, GRPCRoute, TCPRoute and TLSRoute.

func InScope added in v0.8.0

func InScope(scope []string, namespace string) bool

InScope reports whether namespace is in scope; a nil scope holds every namespace.

func IsDetailRoute added in v0.7.0

func IsDetailRoute(group, kind string) bool

IsDetailRoute reports whether group/kind is a route kind with a detail view.

func RowState

func RowState(ref objects.Ref, rep health.Report) health.State

RowState is the state of ref's row from rep (design §6.3): any error finding on ref is error; else any required check not OK is unknown, for every row of the install; else any warning finding is warning; else healthy. Info findings never set a state.

func StatusTrueFor

func StatusTrueFor(res install.Resolved, o *install.Owned, dec objects.Decoder, gws map[objects.Ref]bool) map[objects.Ref][]objects.Ref

StatusTrueFor returns, per Gateway in gws, the owned objects whose current status is True for it (design §8.4), sorted. It is the set the gateway-rejecting flag marks.

Types

type Admission

type Admission struct {
	Owned  bool
	Reason CandidateReason
	// By is the first owned object that names a referenced candidate, or
	// the first owned parent route that selects a selected one; Referrers
	// are all of them, in row order, then ListenerSet order. Under a
	// restricting Authorizer the handler shows the first visible one. A
	// finding candidate keeps the owned objects that name it and the owned
	// parents that select it as Referrers, for a caller who is not shown its
	// findings, and no By.
	By        *objects.Ref
	Referrers []objects.Ref
	// NoParent marks a no-parent row; alone it admits the YAML view only.
	NoParent bool
	// Consumed marks an owned Backend: a member through the owned routes in
	// Referrers, which are not install context (D-107).
	Consumed bool
	// Else is a finding candidate's reason without its findings, referenced
	// or selected, when it has Referrers; "" otherwise.
	Else CandidateReason
}

Admission is why an object may be shown for the install (design §7.1).

type AncestorPath

type AncestorPath struct {
	Steps []AncestorStep
	Cycle bool
}

AncestorPath runs from the root (a Gateway or ListenerSet) down to the route asked about. Cycle marks a path whose first step is a route that already appears later on it.

type AncestorStep

type AncestorStep struct {
	Ref        objects.Ref
	Restricted bool
	Hidden     bool
}

AncestorStep is one step of an up-chain. A Restricted step, a Gateway or ListenerSet the caller may not view, has a zero Ref. A Hidden step is an ancestor route the caller may not view: it keeps its Ref, which the API sends with link none (design §7.4 rule 3, D-024).

type Attachment

type Attachment string

Attachment is how a route relates to one parent, from status only.

const (
	AttachmentAccepted    Attachment = "accepted"
	AttachmentNotAccepted Attachment = "not-accepted"
	AttachmentPending     Attachment = "pending"
	AttachmentUnwatched   Attachment = "unwatched"
	AttachmentDeclared    Attachment = "declared"
)

Attachments (design §7.3 ParentSummary).

type BackendUse

type BackendUse struct {
	Row    RowID
	Mirror bool
}

BackendUse is one row naming a backend. Mirror is set when the row names it only through RequestMirror filters.

type CandidateReason

type CandidateReason string

CandidateReason is why an object the install does not own is admitted.

const (
	ReasonFinding    CandidateReason = "finding"
	ReasonReferenced CandidateReason = "referenced"
	// ReasonSelected: a view B row of an owned parent selects the route (2.4).
	ReasonSelected CandidateReason = "selected"
)

Candidate reasons (design §7.1).

type DelegRow

type DelegRow struct {
	computed.Row
	Deps        DepSet
	ContextDeps []DepSet
	Check       *computed.CheckResult
}

DelegRow is one view B row (rules §5.5) with its dependencies interned. Deps and ContextDeps, index-aligned with Contexts, leave out the routes on each context's path, which never restrict (design §7.4 rule 4b, D-024). Check is the row's child-entry check, joined by (child, parent, ChildKey); nil when none.

type DelegationQuery

type DelegationQuery struct {
	Rule, Ref *int
	Outcomes  []computed.RowOutcome
	// Limit is 1–MaxLimit; 0 means DefaultLimit.
	Limit  int
	Cursor string
}

DelegationQuery is one delegation page request after parsing (design §7.2). Zero fields do not filter; Outcomes are OR-ed. The order is fixed.

type DepSet

type DepSet []int32

DepSet is a computed result's dependencies, as indexes into Index.Refs.

type EffectiveEntry

type EffectiveEntry struct {
	computed.ChildEffective
	EdgeDeps    []DepSet
	ContextDeps [][]DepSet
}

EffectiveEntry is view C of one child (rules §6). EdgeDeps are index-aligned with Edges and ContextDeps with each edge's Contexts; both leave out the routes on the paths, as DelegRow's do.

type Flag

type Flag uint16

Flag is a set of route row condition states (design §6.1).

const (
	FlagAccepted Flag = 1 << iota
	FlagNotAccepted
	FlagRefsUnresolved
	FlagNotProgrammed
	FlagPending
	FlagDeclared
	FlagNoParent
	// FlagDisagrees: the row's object has KGWUI-012.
	FlagDisagrees
	// FlagListenerUnknown: a status-accepted parentRef whose outcome is unknown or has no listener.
	FlagListenerUnknown
	// FlagDropped: a view B row of an owned parent selects the route and is
	// dropped, forbidden or rejected-hostnames (2.4).
	FlagDropped
	// FlagGatewayRejecting: the row's current status is True for a Gateway
	// with an active KGWUI-001 (design §8.4).
	FlagGatewayRejecting
	// FlagBackendProblem: a rule backendRef of the row names a backend with an
	// error or warning finding (D-082).
	FlagBackendProblem
)

Flags owned by sub-phase 2.2.

func ParseFlag

func ParseFlag(s string) (Flag, bool)

ParseFlag returns the flag with wire name s.

func (Flag) Names

func (f Flag) Names() []string

Names returns the wire names of the flags in f, in bit order.

type GatewayRow

type GatewayRow struct {
	Ref   objects.Ref
	Obj   *unstructured.Unstructured
	View  *objects.GatewayView
	State health.State
	// AttachedRoutes is the sum of status.listeners[].attachedRoutes as written.
	AttachedRoutes int32
	// Routes and NotAccepted index Index.Routes; they include routes
	// through the Gateway's ListenerSets.
	Routes, NotAccepted []RowID
	// ListenerSets index Index.ListenerSets.
	ListenerSets []RowID
	// Members are the distinct member routes of the Gateway's own listeners whose count is known.
	Members []RowID
	// Disagreements counts the checks in state disagrees on the Gateway.
	Disagreements int
}

GatewayRow is one Gateway of the install.

type Index

type Index struct {
	// Routes are sorted by (namespace, name, group, kind); a RowID into it is
	// stable within one Index only.
	Routes       []RouteRow
	Gateways     []GatewayRow
	ListenerSets []ListenerSetRow
	// ByParent keys Gateways and ListenerSets; a Gateway key also covers
	// routes through its ListenerSets. It also keys the target of an
	// unwatched row of any kind, an HTTPRoute included.
	ByParent map[objects.Ref][]RowID
	// ByParentRoute keys an HTTPRoute and lists the rows with a reported edge to it.
	ByParentRoute map[objects.Ref][]RowID
	// Declared keys an HTTPRoute and lists the rows that declare it with no reported edge.
	Declared map[objects.Ref][]RowID
	// ByBackend keys backend identity after defaults, Services and Backends
	// alike, from rule backendRefs and RequestMirror filters. Delegation refs
	// are never indexed.
	ByBackend   map[objects.Ref][]BackendUse
	ByNamespace map[string][]RowID
	// ParentRoutes maps a route to the HTTPRoutes of its reported edges.
	ParentRoutes map[objects.Ref][]objects.Ref
	NoParent     []RowID
	// Findings holds the worst error and warning finding and the finding count per object.
	Findings map[objects.Ref]Worst
	// Refs is the install's dependency table; a DepSet indexes it (design §7.4 rule 10).
	// Refs[i] for i < len(Routes) is route row i's ref.
	Refs []objects.Ref
	// ByListener lists view A's members per listener whose count is known, by row and parentRef.
	ByListener map[ListenerKey][]Member
	// Listeners holds every computed listener count.
	Listeners map[ListenerKey]ListenerFacts

	// RuleSet, RuleLabel and RuleNote are view A's rule set, its display name and its selection label.
	RuleSet, RuleLabel, RuleNote string
	// DelegRows are view B's rows, sorted by (parent, rule, ref, child), each
	// ref by (namespace, name, group, kind).
	DelegRows []DelegRow
	// Delegation maps a parent route to its rows, as DelegRows indexes in order.
	Delegation map[objects.Ref][]int
	// RefRows maps one delegation ref of a parent to its rows, as Delegation does.
	RefRows map[RefKey][]int
	// Effective is view C per child route.
	Effective map[objects.Ref]EffectiveEntry
	// RefScope is, per delegation ref, the routes its selection reads; a
	// caller who cannot view them all sees the ref as selection-restricted.
	RefScope map[RefKey]DepSet
	// TooLarge holds the refs a compute cap (edges, contexts or matchers) cut;
	// one with no rows reads too large to compute (rules §5.7, D-025).
	TooLarge map[RefKey]bool
	// Unreached maps a child route to its rows that no context reached and
	// whose Deps, its parent's root eligibility, are not empty, as
	// DelegRows indexes in order. Such a row has no effective edge.
	Unreached map[objects.Ref][]int
	// DelegationCap names the first compute cap views B and C hit, or "".
	DelegationCap string
	// contains filtered or unexported fields
}

Index is the explorer's view of one install. It is immutable.

func Build

func Build(in Input) *Index

Build builds the index of one install. It is pure: the same input gives the same rows in the same order, whatever the snapshot's order.

func (*Index) Admission

func (ix *Index) Admission(ref objects.Ref) (Admission, bool)

Admission returns why ref is admitted, or false when it is not. Admitted does not mean the object exists: a referenced ref may name an absent one. The handler still looks the object up and applies the Authorizer.

func (*Index) Ancestors

func (ix *Index) Ancestors(route objects.Ref, visible func(objects.Ref) bool) (paths []AncestorPath, truncated bool)

Ancestors walks up from route over reported edges, depth-first with parents sorted by (namespace, name). It stops after MaxPaths paths, at MaxDepth routes per path, or after MaxNodes route visits, whichever comes first, and then reports truncated; it never counts what remains.

A path ends at a Gateway or ListenerSet whose status reported the route as accepted or not accepted. A route with no such root yields no path.

A Gateway or ListenerSet that visible rejects becomes a Restricted step with no identity; paths identical after that redaction are returned once. An ancestor route that visible rejects becomes a Hidden step that keeps its name (D-024). The walk does not continue past either, so a hidden route's own parents, read from its status, are never named (design §7.4 rule 3).

func (*Index) Disagreements added in v0.8.0

func (ix *Index) Disagreements(ref objects.Ref, n int, vw Viewer) int

Disagreements is n, a row's count of disagreeing checks, when vw shows a KGWUI-012 on ref; else 0, as the count comes from a derived check.

func (*Index) DupFacts

func (ix *Index) DupFacts(id RowID, l ParentLink, k int) *RefFacts

DupFacts returns view A's facts for l's spec index l.Dups[k], or nil.

func (*Index) Facts

func (ix *Index) Facts(id RowID, l ParentLink) *RefFacts

Facts returns view A's facts for parent link l of row id, or nil.

func (*Index) FindGateway

func (ix *Index) FindGateway(ref objects.Ref) (RowID, bool)

FindGateway returns the row of Gateway ref.

func (*Index) FindListenerSet

func (ix *Index) FindListenerSet(ref objects.Ref) (RowID, bool)

FindListenerSet returns the row of ListenerSet ref.

func (*Index) FindingShown added in v0.8.0

func (ix *Index) FindingShown(ref objects.Ref, shown func(*health.Finding) bool) bool

FindingShown reports whether shown admits any finding on ref.

func (*Index) GatewayMemberCount

func (ix *Index) GatewayMemberCount(id RowID) (n int, ok bool)

GatewayMemberCount is the routes column of Gateway row id and its sort value: its distinct member routes, hidden ones too, as a listener's count (design §7.4 rule 5). ok is false when a listener's count is unknown.

func (*Index) GatewayMemberCountAs added in v0.8.0

func (ix *Index) GatewayMemberCountAs(id RowID, visible func(objects.Ref) bool) (int, bool)

GatewayMemberCountAs is GatewayMemberCount over the members visible admits: a visible route with visible dependencies; nil counts them all. With visible set, a listener's unknown count does not make it unknown: only routes the caller cannot read can do that, and they are not counted.

func (*Index) GatewayMemberCountIn added in v0.8.0

func (ix *Index) GatewayMemberCountIn(id RowID, visible func(objects.Ref) bool, scope []string) (int, bool)

GatewayMemberCountIn is GatewayMemberCountAs over the member routes in scope only (D-100 item 8): a member outside it is skipped before any check.

func (*Index) ListenerCountAs added in v0.8.0

func (ix *Index) ListenerCountAs(k ListenerKey, visible func(objects.Ref) bool) int

ListenerCountAs is listener k's count over the members visible admits, whether or not its whole count is known; nil gives the computed count.

func (*Index) ListenerSetMemberCount

func (ix *Index) ListenerSetMemberCount(id RowID) (n int, ok bool)

ListenerSetMemberCount is GatewayMemberCount for ListenerSet row id.

func (*Index) ListenerSetMemberCountAs added in v0.8.0

func (ix *Index) ListenerSetMemberCountAs(id RowID, visible func(objects.Ref) bool) (int, bool)

ListenerSetMemberCountAs is GatewayMemberCountAs for ListenerSet row id.

func (*Index) ListenerSetMemberCountIn added in v0.8.0

func (ix *Index) ListenerSetMemberCountIn(id RowID, visible func(objects.Ref) bool, scope []string) (int, bool)

ListenerSetMemberCountIn is GatewayMemberCountIn for ListenerSet row id.

func (*Index) ListenerSetStateOf added in v0.8.0

func (ix *Index) ListenerSetStateOf(id RowID, vw Viewer) health.State

ListenerSetStateOf is ListenerSet row id's state for vw: StateOf, lifted when the row is programmed and its parent has a shown KGWUI-001.

func (*Index) ObjectSignals added in v0.8.0

func (ix *Index) ObjectSignals(u *unstructured.Unstructured, vw Viewer) (config, path Signal)

ObjectSignals are RouteSignals for route u without a row, which has no path rows: only incompleteness and the install-wide unknown move its path.

func (*Index) PathIncomplete added in v0.8.0

func (ix *Index) PathIncomplete(id RowID, p Permissions) bool

PathIncomplete reports whether the viewer's permissions leave route id's traffic path unassessable (design §8.1). It reads only the route objects the viewer can get and their refs, never an object a ref names or the reported edges, which hidden objects decide.

func (*Index) ProblemBackend added in v0.8.0

func (ix *Index) ProblemBackend(id RowID, vw Viewer) *objects.Ref

ProblemBackend is the backend that sets route row id's FlagBackendProblem for vw: the first non-mirror one with a shown error or warning (D-082).

func (*Index) QueryDelegation

func (ix *Index) QueryDelegation(parent objects.Ref, q DelegationQuery, visible func(objects.Ref) bool) (Page, error)

QueryDelegation pages parent's delegation rows that match q; Page.IDs index DelegRows, and a negative ID -1-i is the restricted row of a selection-restricted ref, the ref of DelegRows[i]: it replaces the ref's zero-child rows and matches no outcome (our call, 2.4). A row whose child visible rejects is left out; a row with no child never is (design §7.4 rule 3). The outcome filter matches a row only when visible admits every ref of its Deps, which leave out the routes on its paths (rules 4a, 4b). Both apply before Total and paging; nil admits every row.

func (*Index) QueryDelegationVisible added in v0.8.0

func (ix *Index) QueryDelegationVisible(parent objects.Ref, q DelegationQuery, visible func(objects.Ref) bool) (Page, error)

QueryDelegationVisible is QueryDelegation without the restricted rows: no selection-restricted row (negative ID), and no row whose Deps visible rejects; both are left out before Total and paging.

func (*Index) QueryGateways

func (ix *Index) QueryGateways(in Query, visible func(objects.Ref) bool) (Page, error)

QueryGateways pages the Gateway rows, as QueryRoutes does. The routes sort uses GatewayMemberCount, as the list row's routes column does.

func (*Index) QueryGatewaysAs added in v0.8.0

func (ix *Index) QueryGatewaysAs(in Query, vw Viewer) (Page, error)

QueryGatewaysAs is QueryGateways for vw: the health filter and sort use StateOf, and with Shown set the routes sort uses GatewayMemberCountAs.

func (*Index) QueryListenerSets

func (ix *Index) QueryListenerSets(in Query, visible func(objects.Ref) bool) (Page, error)

QueryListenerSets pages the ListenerSet rows, as QueryRoutes does. Parent, when set, is a Gateway.

func (*Index) QueryListenerSetsAs added in v0.8.0

func (ix *Index) QueryListenerSetsAs(in Query, vw Viewer) (Page, error)

QueryListenerSetsAs is QueryListenerSets for vw: the health filter and sort use ListenerSetStateOf.

func (*Index) QueryRoutes

func (ix *Index) QueryRoutes(q Query, visible func(objects.Ref) bool) (Page, error)

QueryRoutes pages the route rows that match q and that visible admits. visible runs before Total, paging and cursors (design §7.4 rule 1); nil admits every row. The Backends filter reads the visible routes' specs through ByBackend and never looks up a backend (rule 2a).

func (*Index) QueryRoutesAs added in v0.8.0

func (ix *Index) QueryRoutesAs(q Query, vw Viewer) (Page, error)

QueryRoutesAs is QueryRoutes for vw: the health and state filters and the health sort use vw's states and flags (RouteStateOf).

func (*Index) Ref

func (ix *Index) Ref(i int32) objects.Ref

Ref returns the ref at index i of the dependency table.

func (*Index) RouteReason added in v0.7.1

func (ix *Index) RouteReason(id RowID) *health.RowReason

RouteReason is route row id's reason: Worst.Reason, except that a warning no own finding decides is a rejecting Gateway's first, else a backend's (D-082).

func (*Index) RouteSignals added in v0.8.0

func (ix *Index) RouteSignals(id RowID, vw Viewer) (config, path Signal, backend *objects.Ref)

RouteSignals are route row id's configuration and traffic path for vw (design §8.1). Configuration is the worst shown finding on the route itself. The path is vw.Path's rows, or without it the index's rejecting Gateways and backend faults; see path for the order. backend is the backend a backend-problem path reason names, else nil.

func (*Index) RouteStateOf added in v0.8.0

func (ix *Index) RouteStateOf(id RowID, vw Viewer) (health.State, Flag, *health.RowReason)

RouteStateOf is route row id's state, flags and reason for vw: the worst shown finding on the row; gateway-rejecting only from a shown KGWUI-001 on a parent Gateway; backend-problem only from a shown finding on a non-mirror backend; disagrees only from a shown KGWUI-012; status flags only from links to parents vw.Visible admits. Flags pass RowFlags first. A healthy row whose path vw.Perms leave incomplete is unknown (design §8.3).

func (*Index) Row

func (ix *Index) Row(ref objects.Ref) (RowID, bool)

Row returns the row of route ref. It searches by index, as slices.BinarySearchFunc would copy a whole RouteRow per probe.

func (*Index) RowFlags

func (ix *Index) RowFlags(id RowID, visible func(objects.Ref) bool) Flag

RowFlags are row id's flags for a caller: listener-unknown needs the dependencies of any one unknown parent visible, and dropped those of any one flagging row (design §7.4 rule 6); disagrees is a finding (rule 9).

func (*Index) SelectionHidden

func (ix *Index) SelectionHidden(k RefKey, visible func(objects.Ref) bool) bool

SelectionHidden reports whether visible rejects a route that ref k's selection reads: the ref is then selection-restricted (our call, 2.4).

func (*Index) StateOf added in v0.8.0

func (ix *Index) StateOf(ref objects.Ref, vw Viewer) health.State

StateOf is the row state of ref from the findings vw shows (design §6.3). A ListenerSet row's lift by a rejecting parent is ListenerSetStateOf's.

func (*Index) Under

func (ix *Index) Under(id RowID, parent objects.Ref, a Attachment, visible func(objects.Ref) bool) bool

Under reports whether route row id is listed under parent with attachment a, or any attachment when a is "". A link through a ListenerSet counts only when visible admits the ListenerSet, whose spec names the Gateway (design §7.4 rule 3); nil admits every one.

func (*Index) Visible

func (ix *Index) Visible(d DepSet, visible func(objects.Ref) bool) bool

Visible reports whether visible admits every ref of d; nil admits all.

func (*Index) VisibleAncestors added in v0.8.0

func (ix *Index) VisibleAncestors(route objects.Ref, visible func(objects.Ref) bool) (paths []AncestorPath, truncated bool)

VisibleAncestors is Ancestors without the paths that have a Hidden or Restricted step: they neither count toward MaxPaths nor truncate the walk.

func (*Index) WorstOf added in v0.8.0

func (ix *Index) WorstOf(ref objects.Ref, vw Viewer) Worst

WorstOf is ref's Worst over the findings vw shows.

type Input

type Input struct {
	Install    install.Resolved
	Owned      *install.Owned
	Assignment install.Assignment
	Snapshot   *cache.Snapshot
	Served     []kinds.Served
	Health     health.Report
	// Views decodes typed views; nil decodes directly.
	Views objects.Decoder
	// Computed is the install's view A; nil computes no members or computed flags.
	Computed *computed.Views
	// Conditions are the install's route condition types beyond Gateway API's;
	// nil means health.KgatewayConditions, as for health.Input.
	Conditions *health.ConditionTypes
}

Input is everything Build reads for one install.

type ListenerFacts

type ListenerFacts struct {
	Count         int
	Known         bool
	Unknown       computed.UnknownReason
	Error         string
	IsolationNote bool
	// Check is the listener-count cross-check, shared with the views; nil when none.
	Check *computed.CheckResult
}

ListenerFacts is a listener's computed count and its cross-check.

type ListenerHit

type ListenerHit struct {
	Listener  string
	Hostnames []string
	Deps      DepSet
}

ListenerHit is one listener an accepted parentRef attaches to.

type ListenerKey

type ListenerKey struct {
	Resource objects.Ref
	Listener string
}

ListenerKey names one listener of a Gateway or ListenerSet.

type ListenerSetRow

type ListenerSetRow struct {
	Ref         objects.Ref
	Obj         *unstructured.Unstructured
	View        *objects.ListenerSetView
	Parent      objects.Ref
	ParentFound bool
	State       health.State
	// AcceptedReason is the reason of an Accepted condition that is not True.
	AcceptedReason string
	// Routes index Index.Routes.
	Routes []RowID
	// Members and Disagreements are as on GatewayRow.
	Members       []RowID
	Disagreements int
	// contains filtered or unexported fields
}

ListenerSetRow is one ListenerSet of the install.

type Member

type Member struct {
	Row       RowID
	ParentRef int
	Hostnames []string
	Deps      DepSet
}

Member is a route row on a listener through one parentRef (spec index).

type Page

type Page struct {
	IDs        []RowID
	Total      int
	Next, Prev string
}

Page is one page of a list. IDs index the list the query ran on. Total counts every visible row that matches, not only this page.

type ParentLink struct {
	// Target is the object the parentRef names; Ref is the parentRef after defaults.
	Target objects.Ref
	Ref    objects.ParentRef
	// Via is the Gateway of a ListenerSet target, when the install owns it.
	Via        *objects.Ref
	Attachment Attachment
	// Cond is the deciding condition: the first current False among
	// Accepted, ResolvedRefs and the install's optional route types (design §7.3).
	Cond *metav1.Condition
	// Programming is the first current False optional type when Cond is
	// Accepted or ResolvedRefs: a programming failure that Cond's order would hide.
	Programming *metav1.Condition
	// Pending is why the status entry is not current, for a pending link.
	Pending string
	// Spec is the index of Ref in the row's spec parentRefs, or -1.
	Spec int
	// Dups are the later spec indexes that resolve to Ref; one written
	// differently has its own report key and check (rules §8.2). Usually nil.
	Dups []int
	// contains filtered or unexported fields
}

ParentLink is one parent of a route row.

type PathRows added in v0.8.0

type PathRows struct {
	State   health.State
	Reason  *health.RowReason
	Backend *objects.Ref
	Rows    int
}

PathRows is a route's traffic path read from its path rows (design §8.1): the worst state over the rows the viewer may read, the reason that state gives and the backend the reason names. Rows counts those rows.

type Permissions added in v0.8.0

type Permissions interface {
	Get(objects.Ref) bool
	List(gk objects.GroupKind, namespace string) bool
}

Permissions is a viewer's authority over named objects and kinds (design §8.1). Get is a named get; List is a list of gk in namespace.

type Query

type Query struct {
	Namespaces []string
	// Scope limits rows to these namespaces before any viewer check (D-100
	// item 8); it intersects Namespaces. Nil is every namespace.
	Scope      []string
	Kinds      []objects.GroupKind
	Parent     *objects.Ref
	Attachment Attachment
	// Listener needs a Gateway or ListenerSet Parent: a listener name selects
	// its computed members; ListenerUnknown the rows whose ref to Parent is unknown.
	Listener string
	// Backends are OR-ed through ByBackend: specs only, never the backend object.
	Backends []objects.Ref
	States   Flag
	Health   []health.State
	// Config and Path match a route's two signals (design §8.2); each ORs its states, and they AND.
	Config, Path []health.State
	Q            string
	Sort         Sort
	// Limit is 1–MaxLimit; 0 means DefaultLimit.
	Limit  int
	Cursor string
}

Query is one list request after parsing (design §7.2). Zero fields do not filter. Kinds, Parent, Attachment, Listener, Backends, States, Config and Path apply to routes only; Parent on ListenerSets is a Gateway.

type RefFacts

type RefFacts struct {
	Out       *computed.RefOutcome
	Listeners []ListenerHit
	// Check is the route-accepted cross-check of the ref's report key, shared with the views; nil when none.
	Check *computed.CheckResult
	Deps  DepSet
}

RefFacts is view A's outcome of one parentRef of a route row. Out is the source outcome, shared with the views: its ParentRef is the spec index and its Resource the target. Listeners and Deps replace Out's.

type RefKey

type RefKey struct {
	Parent    objects.Ref
	Rule, Ref int
}

RefKey names one delegation ref of a parent route by rule and ref index.

type RouteRow

type RouteRow struct {
	Ref  objects.Ref
	Kind kinds.Served
	Obj  *unstructured.Unstructured
	// View is the decoded HTTPRoute; nil for other kinds.
	View      *objects.HTTPRouteView
	Hostnames []string
	Parents   []ParentLink
	// ParentRoutes are the HTTPRoutes of the row's reported edges.
	ParentRoutes []objects.Ref
	// Children counts the routes with a reported edge to this one.
	Children int
	Flags    Flag
	State    health.State
	// Backend is the first backend that sets FlagBackendProblem; nil without it.
	Backend *objects.Ref
	// Owned is true when the install owns the route.
	Owned bool
	// Computed is view A per parentRef to a Gateway or ListenerSet, in parentRef order.
	Computed []RefFacts
	// UnknownDeps are the distinct dependency sets of the parentRefs that set
	// FlagListenerUnknown, one per parent. The flag shows when any one of them
	// is visible (design §7.4 rule 6).
	UnknownDeps []DepSet
	// DroppedDeps are the distinct Deps of the rows that set FlagDropped,
	// which leave out the routes on their paths (D-024). The flag shows when
	// any one of them is visible.
	DroppedDeps []DepSet
	// contains filtered or unexported fields
}

RouteRow is one route the install lists (design §3.5): an owned route, attached or not; an in-scope route naming a missing parent; an unwatched route that targets the install; a declared candidate; or a no-parent row.

type RowID

type RowID int32

RowID indexes Index.Routes, Index.Gateways or Index.ListenerSets, as the field holding it says.

type Signal added in v0.8.0

type Signal struct {
	State      health.State
	Reason     *health.RowReason
	Incomplete bool
}

Signal is one of a route's two signals (design §8.1, D-087): its state and why it is not healthy. Incomplete is set on a path the viewer's permissions leave unassessable.

type Sort

type Sort struct {
	Key  string
	Desc bool
}

Sort is a list order. The empty key is name. Every order ends with the ascending (namespace, name, group, kind) tie-break; for name that tuple is the order itself, so name.desc reverses it.

type Viewer added in v0.8.0

type Viewer struct {
	Visible      func(objects.Ref) bool
	Shown        func(*health.Finding) bool
	Unknown      bool
	NoDelegation bool
	Perms        Permissions
	Path         func(RowID) PathRows
}

Viewer is one caller's view of an index (design §7.4, D-106). Visible admits population members; nil admits every one. Shown says which findings the caller sees; nil means the precomputed states, flags and reasons, and then Unknown is ignored. Unknown is the caller's install-wide unknown. NoDelegation withholds delegation analysis, the dropped flag included (D-114). Perms decides whether a route's traffic path is incomplete (design §8.1); nil leaves every path complete. Path reads a route row's path rows as the caller sees them; nil derives the path from the index alone.

type Worst

type Worst struct {
	Error, Warning *health.Finding
	N              int
}

Worst is the first error and the first warning finding on one object, and N counts all of its findings, info included.

func (Worst) Add

func (w Worst) Add(f *health.Finding) Worst

Add counts f and records it if it is the first error or warning.

func (Worst) Decider added in v0.7.1

func (w Worst) Decider(st health.State) *health.Finding

Decider is the finding that decides state st: the first error or warning at that severity, or nil.

func (Worst) Reason

func (w Worst) Reason(st health.State) *health.RowReason

Reason says why a row in state st with these findings is not healthy: its deciding finding, the install-wide unknown, or else a rejecting Gateway, the only other way to warning for a Gateway or ListenerSet (D-063). Route rows use Index.RouteReason. It is nil for a healthy row.

func (Worst) State

func (w Worst) State(unknown bool) health.State

State applies the row rule; unknown is set when a required check is not OK.

Jump to

Keyboard shortcuts

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