gammaproject

package
v0.0.0-...-c46dd35 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 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 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