Documentation
¶
Overview ¶
Package scale builds deterministic worlds of the scale tiers of design §9.6 for benchmarks and scale tests. World returns unstructured objects only; typed Namespaces and Deployments come from package testutil. The Scale* functions return the typed Phase 3 shapes.
Index ¶
Constants ¶
const ( IssueEvery = 20 StaleEvery = 40 ReplacedEvery = 100 ConflictEvery = 10 ConflictAt = 4 PolicyEvery = 5 // MissingBackend is the Backend a 013 route names; GonePolicy the policy in each // PolicyEvery-th namespace, whose only target is Gateway GoneGateway. MissingBackend = "be-missing" GonePolicy = "tp-gone" GoneGateway = "gw-gone" )
The worst case's analyzer findings (sub-phase 3.3). Top-level leaf HTTPRoutes are counted in generation order: the 0th of every IssueEvery names a missing Backend (013), the 10th one in another namespace without a grant (014), the 5th of every StaleEvery has stale status (003, which feeds 018) and the 15th of every ReplacedEvery a dropped rule naming a policy (015). Gateway ConflictAt of every ConflictEvery has a conflicted listener (017), and every PolicyEvery-th namespace a TrafficPolicy whose target is missing (016).
const Class = "kgateway"
Class is the GatewayClass of every scale Gateway.
const ExtensionEvery = 10
ExtensionEvery puts a GatewayExtension in every tenth namespace.
const FailedEvery = 20
FailedEvery makes every FailedEvery-th parentRef, in generation order, one the listeners reject (Accepted=False/NotAllowedByListeners): 5 %. An HTTPRoute or GRPCRoute names a ListenerSet in another namespace; a TCPRoute or TLSRoute a Gateway without a listener for its kind.
const MaxRouteParentStatuses = 32
MaxRouteParentStatuses is the Gateway API MaxItems of a route's status.parents.
const MixedEvery = 10
MixedEvery makes every MixedEvery-th Gateway carry a TCP and a TLS listener, the parents of TCPRoutes and TLSRoutes.
const SelectorListener = "web"
SelectorListener is the listener of each Gateway that admits only namespaces labelled testutil.ScaleTeamLabel.
Variables ¶
var ( Typical = Tier{Name: "typical", Gateways: 30, ListenersPerGateway: 3, HTTPRoutes: 500, ParentRefsMean: 1.2, ListenerSets: 10, DelegatedPct: 10, MaxDepth: 2, MaxFanOut: 10, ParentMatches: 1, Namespaces: 20, Backends: 50, Services: 600, ReferencedServices: 300, EndpointSlices: 700, ProxyPodsPerGateway: 2, WarningEvents: 50, GatewayAPICRDs: 10} Large = Tier{Name: "large", Gateways: 100, ListenersPerGateway: 4, HTTPRoutes: 2000, ParentRefsMean: 1.3, ListenerSets: 200, DelegatedPct: 10, MaxDepth: 3, MaxFanOut: 50, ParentMatches: 2, Namespaces: 100, Backends: 200, Services: 5000, ReferencedServices: 2000, EndpointSlices: 6000, ProxyPodsPerGateway: 2, WarningEvents: 1000, GatewayAPICRDs: 10} Extreme = Tier{Name: "extreme", Gateways: 500, ListenersPerGateway: 4, HTTPRoutes: 5000, ParentRefsMean: 1.5, ListenerSets: 2000, DelegatedPct: 10, MaxDepth: 4, MaxFanOut: 100, ParentMatches: 4, Namespaces: 500, Backends: 1000, LatticeDepth: 8, Services: 25000, ReferencedServices: 10000, EndpointSlices: 30000, ProxyPodsPerGateway: 3, WarningEvents: 10000, GatewayAPICRDs: 10} )
The tiers of design §9.6, at their benchmark sizes.
var ( DenseNamespace = testutil.ScaleNamespace(1) DenseParents = testutil.ScaleNamespace(0) )
DenseNamespace holds DenseSelection's selected routes; DenseParents its parents and Gateway.
var Tiers = []Tier{Typical, Large, Extreme}
Tiers lists Typical, Large and Extreme.
Functions ¶
func DenseSelection ¶
func DenseSelection(parents, routes int) []*unstructured.Unstructured
DenseSelection is the dense-selection shape of design §9.6: parents HTTPRoutes on one Gateway, each with one wildcard ref to DenseNamespace, whose routes HTTPRoutes have no parentRefs and match under every parent's /dense, each to one Backend. So every parent selects, permits and attaches every route. Status is what the controller writes: each parent Accepted on the Gateway, each route Accepted under the first MaxRouteParentStatuses parents, as the API server admits no more. Namespaces come from testutil.ScaleNamespaces(2).
func ListOnlyObjects ¶
func ListOnlyObjects(tier Tier) []*unstructured.Unstructured
ListOnlyObjects are tier's list-only kinds (#17): a ReferenceGrant and a DirectResponse per namespace and a GatewayExtension every ExtensionEvery. No check reads them.
func Snapshot ¶
Snapshot is a synced snapshot of tier t's world with every kind readable, one kgateway v2.4.7 controller in namespace kgw with a ready Pod, and a ready proxy per Gateway.
func World ¶
func World(t Tier, seed int64) []*unstructured.Unstructured
World returns tier t's GatewayClass, Gateways, ListenerSets, Backends and routes, identical for equal seeds. Every route parentRef has a status entry, Accepted=True except every FailedEvery-th one, as view A computes them (inverted under Contradict). Delegated children fit every incoming match and have an entry under the parent route's ref for every delegating parent, as view B computes them (PF2); leaves reference Backends. Namespaces come from testutil.ScaleNamespaces.
Types ¶
type LiveWorld ¶
type LiveWorld struct {
Cache *cache.Cache
Signal *trigger.Signal
// Routes are the seeded HTTPRoutes; RouteGVR is their resource.
Routes []*unstructured.Unstructured
RouteGVR schema.GroupVersionResource
// Update writes u to the fake dynamic client; GetRoute reads a copy of an HTTPRoute from it.
Update func(ctx context.Context, u *unstructured.Unstructured) error
GetRoute func(ctx context.Context, namespace, name string) (*unstructured.Unstructured, error)
// CRDs and Metrics are the tier's Gateway API CRD metadata and controller
// metrics capture; LivePhase3 sets them.
CRDs []*metav1.PartialObjectMetadata
Metrics []byte
// Kube is the fake typed client; Stop stops the cache before tb ends.
Kube *testutil.FakeKube
Stop func()
// Slices are the seeded EndpointSlices; LivePhase3 sets them.
Slices []types.NamespacedName
}
LiveWorld is a settled cache over a tier's world on fake clients, its change signal drained.
func Live ¶
Live seeds fake clients with tier's world, one kgateway controller and a proxy per Gateway (as Snapshot), starts a cache stamped by now until tb ends and waits until it has settled.
func LivePhase3 ¶
LivePhase3 is Live with the tier's proxy Deployments, proxy Pods, Warning Events, Services and EndpointSlices seeded on the fake typed client, its CRDs on a fake metadata client, the routes' Service backendRefs, ListOnlyObjects and its Metrics set. The proxy Pod, Event, CRD, Service and EndpointSlice watches run.
type Tier ¶
type Tier struct {
Name string
Gateways, ListenersPerGateway int
HTTPRoutes int
// ParentRefsMean is the mean parentRef count of non-delegated routes.
ParentRefsMean float64
ListenerSets int
// DelegatedPct is the percentage of HTTPRoutes that are delegated children.
DelegatedPct float64
// MaxDepth and MaxFanOut bound the delegation trees; the lattice is exempt.
MaxDepth, MaxFanOut int
// ParentMatches is the number of path matches of a top-level delegating
// rule; a child has one per incoming match of each delegator.
ParentMatches int
Namespaces, Backends int
// LatticeDepth is the number of layers of the repeated diamond; 0 means none.
LatticeDepth int
// Contradict inverts every route's Accepted status and adds one to every
// attachedRoutes, so every view A check contradicts. It also drops every
// child entry and makes delegating parents ResolvedRefs=False, so view B's
// checks contradict too (PF2).
Contradict bool
// Phase 3 shapes. World ignores them; the Scale* functions use them.
// Services is the total and ReferencedServices those LivePhase3's routes name
// in backendRefs; every Service has at least one EndpointSlice.
Services, ReferencedServices, EndpointSlices int
// ProxyPodsPerGateway is the proxy Pod count of each Gateway.
ProxyPodsPerGateway int
// WarningEvents is the number of Warning Events on proxy Pods.
WarningEvents int
// GatewayAPICRDs is the number of Gateway API CRDs with metadata.
GatewayAPICRDs int
// IsWorst adds long-named Gateways, makes every Gateway reject, 5 % of
// referenced Services lack a ready endpoint and every proxy Pod restart.
// World adds the analyzer's codes 013–018 (see IssueEvery).
IsWorst bool
// MultiRulePct is the percentage of leaf routes with three rules, and
// MultiRefPct that of rules with three weighted backendRefs (0 in every tier;
// see Paths). One in ten multi-ref rules carries a weight-0 ref and one in
// twenty delegating rules also names an ordinary Backend.
MultiRulePct, MultiRefPct int
}
Tier is the shape of one scale tier (design §9.6).
func (Tier) Contradicting ¶
Contradicting is t with every view A check contradicting its status.
func (Tier) Paths ¶ added in v0.7.0
Paths is t with multi-rule, multi-ref and mixed delegation routes, which multiply the path model's rows (rules × refs). The rest of the world is unchanged.
func (Tier) Shape ¶
func (t Tier) Shape() testutil.ScaleShape
Shape is the part of t the typed Phase 3 generators in package testutil need.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package measure builds the measurement world of the 3.2 and 3.3 budgets (design §16.3): scale.LivePhase3 with its optional watches, controller metrics with rejects per Gateway, observed probe failures, a stub proxy stats source and the controller log reader over a stub stream at LogRate, both published through the real collector store.
|
Package measure builds the measurement world of the 3.2 and 3.3 budgets (design §16.3): scale.LivePhase3 with its optional watches, controller metrics with rejects per Gateway, observed probe failures, a stub proxy stats source and the controller log reader over a stub stream at LogRate, both published through the real collector store. |