gammaproject

package
v0.0.0-...-7c0b2e9 Latest Latest
Warning

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

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

Documentation

Overview

Package gammaproject projects Gateway API HTTPRoute/GRPCRoute rules attached to a Service into the data-plane GAMMA route model (proposal 018), as the registryv1.GammaRoute PROTO. It is the single source of truth shared by the agent's GAMMA reconciler (which converts the proto to its in-memory form) AND the registrar's cross-cluster export controller (proposal 026 EM1c, which writes the proto to the registry). Keeping one projector avoids drift between what a cluster routes locally and what it exports for peers to import. Pure: no agent/registrar internals.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BackendRefPorts

func BackendRefPorts(refs []gatewayv1.BackendObjectReference, routeNamespace, routeKind string, grants []gatewayv1beta1.ReferenceGrant) []uint32

BackendRefPorts returns the port of every backendRef that is projected, in the order the projected rule's backends carry them: element i belongs to the rule's backend i. 0 for a ref that names no port.

The projected GammaBackend proto does not carry the port (it gains the field with the cross-cluster projection, proposal 043 Phase 2). The node agent needs it now, for the routes of its own cluster: a backendRef names a port of the backend Service, and until it was read every backend was the service's default cluster (proposal 043, fact 1, row 11).

func DroppedBackendRefs

func DroppedBackendRefs(refs []gatewayv1.BackendRef, routeNamespace, routeKind string, grants []gatewayv1beta1.ReferenceGrant) (n int, weight uint32)

DroppedBackendRefs reports the backendRefs of a rule that are NOT projected (backendProjected): how many there are and the weight they hold together (a backendRef's weight defaults to 1). The agent answers their share of the rule 500, as the Gateway API specifies for an invalid backendRef.

func HTTPRouteTimeout

func HTTPRouteTimeout(timeouts *gatewayv1.HTTPRouteTimeouts) *durationpb.Duration

HTTPRouteTimeout parses an HTTPRoute rule's timeouts.request field into a protobuf Duration for the route action. Returns nil when no timeout is set or the duration is zero/unparseable (GEP-2257: a zero-value timeout means "no timeout", and an invalid string is treated as unset rather than an error). Shared by the mesh (GAMMA) projection and the edge gateway reconciler.

func ProjectGRPCRule

func ProjectGRPCRule(rule gatewayv1.GRPCRouteRule, routeNamespace, routeKind, meshDomain string, grants []gatewayv1beta1.ReferenceGrant, httpFilters map[string]*configprotov1.HTTPFilterSpec, serviceFilters []*registryv1.ExtensionFilter) *registryv1.GammaRoute

ProjectGRPCRule projects one GRPCRoute rule. gRPC rides HTTP/2 as POST /<service>/<method>, so a method match becomes a path match (svc+method = exact /svc/method; svc-only = prefix /svc/; regex for RegularExpression). No per-rule timeout.

func ProjectHTTPRule

func ProjectHTTPRule(rule gatewayv1.HTTPRouteRule, routeNamespace, routeKind, meshDomain string, grants []gatewayv1beta1.ReferenceGrant, httpFilters map[string]*configprotov1.HTTPFilterSpec, serviceFilters []*registryv1.ExtensionFilter) *registryv1.GammaRoute

ProjectHTTPRule projects one HTTPRoute rule into a GammaRoute proto. Backends are resolved to namespace-qualified "<ns>/<svc>" keys + data-plane cluster names (<svc>.<meshDomain>); ungranted cross-namespace backends are dropped. httpFilters resolves a route's ExtensionRef escape-hatch filters (proposal 025), keyed by "<ns>/<name>"; nil/empty when none. serviceFilters are policy-attached (M3 targetRef) filters that apply to every route of the target Service (see ServiceFilters); they are appended after any per-route ExtensionRef.

func ServiceChainFilter

func ServiceChainFilter(serviceKey string, httpFilters map[string]*configprotov1.HTTPFilterSpec) *registryv1.ExtensionFilter

ServiceChainFilter resolves the service-wide ALWAYS-ON extension filter for serviceKey ("<ns>/<svc>") — proposal 025 M4 CHAIN scope: an HTTPFilter with scope CHAIN and a same-namespace targetRef naming the Service. At most one per service (webhook-enforced); ties are broken deterministically by HTTPFilter key order as belt-and-braces. Returns nil when none. The filter is enabled at the service's capture vhost (vhost-level typed_per_filter_config), so it applies to ALL of the service's traffic; a per-route ExtensionRef overrides it (Envoy most-specific-wins).

func ServiceFilters

func ServiceFilters(serviceKey string, httpFilters map[string]*configprotov1.HTTPFilterSpec) []*registryv1.ExtensionFilter

ServiceFilters resolves the HTTPFilters (proposal 025 M3) that policy-attach to the Service identified by serviceKey ("<ns>/<svc>") via a targetRef, returning their allow-listed ExtensionFilters. Policy attachment is same-namespace: only HTTPFilters in the service's namespace whose target_refs name it (kind=Service, core group) apply. Sorted by HTTPFilter key for deterministic order (stable typed_per_filter_config across reconciles). These attach to EVERY route of the service, additive to per-route ExtensionRefs.

func ServiceInboundFilter

func ServiceInboundFilter(serviceKey string, httpFilters map[string]*configprotov1.HTTPFilterSpec) *registryv1.ExtensionFilter

ServiceInboundFilter resolves the destination-side (INBOUND scope, proposal 027 M3) filter for serviceKey: enabled on the service's own pods' inbound listeners. Same one-per-service + deterministic tie-break rules as ServiceChainFilter. NOT propagated cross-cluster (enforcement is co-located with the pods).

Types

type ServiceParent

type ServiceParent struct {
	Key  string
	Port uint32
}

ServiceParent is one Service a route attaches to (parentRef kind=Service): the route-target "<ns>/<svc>" key and the parentRef port (0 = unset).

func ServiceParents

func ServiceParents(refs []gatewayv1.ParentReference, routeNamespace string) []ServiceParent

ServiceParents returns the Service parentRefs a route attaches to (kind=Service, core group), as route-target keys + ports. Shared by the agent reconciler and the registrar export controller so both agree on what a route targets.

Jump to

Keyboard shortcuts

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