Documentation
¶
Overview ¶
Package kinds describes the Kubernetes resource kinds the UI understands and resolves which of them the cluster actually serves.
A downstream ListenerSet kind registers with CategoryListenerSet and must have the upstream shape the explorer reads: spec.parentRef (the Gateway), spec.listeners[] and status.listeners[].
Index ¶
Constants ¶
const KgatewayGroup = kgwGroup
KgatewayGroup is the API group of kgateway's own CRDs.
Variables ¶
This section is empty.
Functions ¶
func ExperimentalOnly ¶
ExperimentalOnly reports whether a kgateway controller at version controller watches group/kind at version only with experimental Gateway API features on. An unknown or unparsable controller version counts a kind as experimental-only when any supported minor gates it (D-018 §3).
Types ¶
type Catalog ¶
type Catalog struct {
// contains filtered or unexported fields
}
Catalog is every (group, kind) the API server serves, from discovery. The zero Catalog knows no group: every served state is unknown.
func NewCatalog ¶
NewCatalog returns the Catalog of served kinds, where discovery failed for the unknown groups.
func (Catalog) Complete ¶
Complete reports whether discovery listed every group, so GroupsWithKind names every group that serves a kind.
func (Catalog) GroupsWithKind ¶
GroupsWithKind returns the groups that serve kind, sorted.
type Category ¶
type Category string
Category groups kinds by the role they play in the UI.
const ( CategoryGatewayClass Category = "gatewayclass" CategoryGateway Category = "gateway" CategoryListenerSet Category = "listenerset" CategoryRoute Category = "route" CategoryPolicy Category = "policy" // CategoryWorkload marks kinds read through typed informers (Deployments). // They are never watched dynamically or counted; findings link to them. CategoryWorkload Category = "workload" // CategoryParameters marks kinds read only to resolve other objects // (GatewayParameters). They are watched but never counted or attributed. CategoryParameters Category = "parameters" // CategoryBackend marks kgateway Backends: route targets the explorer // shows. They are neither attributed to Gateways nor counted by the // controller's managed-resource gauge. CategoryBackend Category = "backend" // CategoryReferenceGrant marks ReferenceGrants: listed and shown, never // evaluated to decide whether a reference resolves. CategoryReferenceGrant Category = "referencegrant" )
Categories understood by the UI.
type Change ¶
type Change struct {
Added []string `json:"added,omitempty"`
Removed []string `json:"removed,omitempty"`
ListOnlyAdded []string `json:"listOnlyAdded,omitempty"`
ListOnlyRemoved []string `json:"listOnlyRemoved,omitempty"`
}
Change is how the kinds the cluster serves now differ from the watched kinds. Entries are "resource.group/version" ("resource/version" for the core group), sorted. Added and Removed are judged kinds; list-only kinds (Descriptor.ListOnly) have their own fields.
func Diff ¶
Diff compares the served kinds now with the watched ones by group, version and resource.
func (Change) Judged ¶
Judged reports whether a judged kind changed; a list-only change alone is not one.
type Descriptor ¶
type Descriptor struct {
Group string `json:"group"`
Kind string `json:"kind"`
Resource string `json:"resource"`
Versions []string `json:"versions"`
Namespaced bool `json:"namespaced"`
Category Category `json:"category"`
DisplayName string `json:"displayName"`
// ListOnly kinds are listed and shown per install scope, never judged for
// status. Their access is optional for the cluster access check.
ListOnly bool `json:"-"`
}
Descriptor describes a kind the UI can watch. Versions are in preference order.
func Dedupe ¶
func Dedupe(descs []Descriptor) []Descriptor
Dedupe returns descs with one descriptor per group and kind: a later descriptor replaces an earlier one in the earlier one's position.
func GatewayAPI ¶ added in v0.6.0
func GatewayAPI() []Descriptor
GatewayAPI returns the Gateway API kinds of Upstream, in its order: the kinds the core registers without any pack.
func Upstream ¶
func Upstream() []Descriptor
Upstream returns the kinds of Gateway API and kgateway that the UI understands: GatewayAPI plus kgateway's own kinds, in the API v1 order. Secrets and ConfigMaps are deliberately absent (design §11).
type DiscoveryClient ¶
type DiscoveryClient interface {
ServerResourcesForGroupVersion(groupVersion string) (*metav1.APIResourceList, error)
}
DiscoveryClient is the subset of the discovery API that Resolve needs.
type Monitor ¶
type Monitor struct {
// OnChange, if set, is notified when a Refresh yields a Change or Catalog that
// differs from the previous one.
OnChange *trigger.Signal
// contains filtered or unexported fields
}
Monitor re-resolves the served kinds and keeps how they differ from the watched set. The UI does not re-watch: a change asks for a restart. It also publishes the Catalog of every served kind.
func NewMonitor ¶
func NewMonitor(dc DiscoveryClient, descs []Descriptor, watched []Served) *Monitor
NewMonitor returns a Monitor of descs against watched, the kinds the cache watches.
func (*Monitor) Catalog ¶
Catalog returns the latest Catalog; it is the zero Catalog until a Refresh lists one.
func (*Monitor) Change ¶
Change returns the latest difference; it is empty until a Refresh finds one.
type Served ¶
type Served struct {
Descriptor
Version string `json:"version"`
}
Served is a Descriptor resolved to the version the cluster serves.
func ByCategory ¶
ByCategory returns the served kinds in category c.
func Resolve ¶
func Resolve(dc DiscoveryClient, descs []Descriptor) ([]Served, error)
Resolve returns, in input order, the descriptors whose resource is served in one of their versions, resolved to the first such version. Kinds that are not served (CRD not installed, or removed in this kgateway version) are omitted. Duplicates are removed as by Dedupe.
func (Served) ExperimentalOnly ¶
ExperimentalOnly reports whether a kgateway controller at version controller watches s, at its served version, only with experimental Gateway API features on.
func (Served) GVR ¶
func (s Served) GVR() schema.GroupVersionResource
GVR returns the group/version/resource used to watch this kind.