Documentation
¶
Index ¶
- Constants
- Variables
- func ExtServerPolicyStatusAsPolicyStatus(policy *unstructured.Unstructured) gwapiv1.PolicyStatus
- func FromNamespacesPtr(fromNamespaces gwapiv1.FromNamespaces) *gwapiv1.FromNamespaces
- func GatewayClassOwnerLabel(name string) map[string]string
- func GatewayOwnerLabels(namespace, name string) map[string]string
- func GetHostnames(route RouteContext) []string
- func GetManagedParentReferences(route RouteContext) []gwapiv1.ParentReference
- func GetParentReferences(route RouteContext) []gwapiv1.ParentReference
- func GetRouteStatus(route RouteContext) *gwapiv1.RouteStatus
- func GroupDerefOr(group *gwapiv1.Group, defaultGroup string) string
- func GroupPtr(name string) *gwapiv1.Group
- func IsMergeGatewaysEnabled(resources *resource.Resources) bool
- func IsParentRefEqual(ref1, ref2 gwapiv1.ParentReference, routeNS string) bool
- func IsRefToGateway(routeNamespace gwapiv1.Namespace, parentRef gwapiv1.ParentReference, ...) bool
- func KindDerefOr(kind *gwapiv1.Kind, defaultKind string) string
- func KindPtr(name string) *gwapiv1.Kind
- func MergeEnvoyProxyConfigs(defaultSpec *egv1a1.EnvoyProxySpec, gatewayClassProxy *egv1a1.EnvoyProxy, ...) (*egv1a1.EnvoyProxy, error)
- func NamespaceDerefOr(namespace *gwapiv1.Namespace, defaultNamespace string) string
- func NamespacePtr(name string) *gwapiv1.Namespace
- func ObjectNamePtr(val string) *gwapiv1.ObjectName
- func OwnerLabels(gateway *gwapiv1.Gateway, mergeGateways bool) map[string]string
- func PolicyStatusToUnstructured(policyStatus gwapiv1.PolicyStatus) map[string]any
- func PortNumPtr(val int32) *gwapiv1.PortNumber
- func SectionNamePtr(name string) *gwapiv1.SectionName
- func ValidateGRPCRouteFilter(filter *gwapiv1.GRPCRouteFilter, extGKs ...schema.GroupKind) error
- func ValidateHTTPRouteFilter(filter *gwapiv1.HTTPRouteFilter, extGKs ...schema.GroupKind) error
- type AddressesTranslator
- type BTPClusterSettingsIndex
- func (idx *BTPClusterSettingsIndex) HasClusterSettingsBelowGateway(routeKind gwapiv1.Kind, routeNN types.NamespacedName, ...) bool
- func (idx BTPClusterSettingsIndex) Lookup(routeKind gwapiv1.Kind, routeNN types.NamespacedName, ...) (value T, replacesParent bool)
- func (idx BTPClusterSettingsIndex) LookupExact(scope policyScope) (T, bool)
- type BTPIndexes
- type BTPLoadBalancerIndex
- type BTPRoutingTypeIndex
- func (idx BTPRoutingTypeIndex) Lookup(routeKind gwapiv1.Kind, routeNN types.NamespacedName, ...) (value T, replacesParent bool)
- func (idx *BTPRoutingTypeIndex) LookupBTPRoutingType(routeKind gwapiv1.Kind, routeNN types.NamespacedName, ...) *egv1a1.RoutingType
- func (idx BTPRoutingTypeIndex) LookupExact(scope policyScope) (T, bool)
- func (idx *BTPRoutingTypeIndex) LookupGatewayBTRoutingType(gatewayNN types.NamespacedName) *egv1a1.RoutingType
- type BackendClusterKey
- type BackendRefContext
- type BackendRefWithFilters
- type CTPClusterSettingsIndex
- func (idx *CTPClusterSettingsIndex) HasClusterSettingsBelowGateway(gatewayNN types.NamespacedName, listener *ListenerContext) bool
- func (idx CTPClusterSettingsIndex) Lookup(routeKind gwapiv1.Kind, routeNN types.NamespacedName, ...) (value T, replacesParent bool)
- func (idx CTPClusterSettingsIndex) LookupExact(scope policyScope) (T, bool)
- type DirectBackendRef
- type FiltersTranslator
- type GRPCRouteContext
- func (r *GRPCRouteContext) GetHostnames() []string
- func (r *GRPCRouteContext) GetParentReferences() []gwapiv1.ParentReference
- func (r *GRPCRouteContext) GetRouteParentContext(forParentRef gwapiv1.ParentReference) *RouteParentContext
- func (r *GRPCRouteContext) GetRouteStatus() *gwapiv1.RouteStatus
- func (r *GRPCRouteContext) GetRouteType() gwapiv1.Kind
- func (r *GRPCRouteContext) HasRuleNames(sectionName gwapiv1.SectionName) bool
- func (r *GRPCRouteContext) SetRouteParentContext(forParentRef gwapiv1.ParentReference, ctx *RouteParentContext)
- type GatewayContext
- type HTTPFilterIR
- type HTTPFiltersContext
- type HTTPFiltersTranslator
- type HTTPRouteContext
- func (r *HTTPRouteContext) GetHostnames() []string
- func (r *HTTPRouteContext) GetParentReferences() []gwapiv1.ParentReference
- func (r *HTTPRouteContext) GetRouteParentContext(forParentRef gwapiv1.ParentReference) *RouteParentContext
- func (r *HTTPRouteContext) GetRouteStatus() *gwapiv1.RouteStatus
- func (r *HTTPRouteContext) GetRouteType() gwapiv1.Kind
- func (r *HTTPRouteContext) HasRuleNames(sectionName gwapiv1.SectionName) bool
- func (r *HTTPRouteContext) SetRouteParentContext(forParentRef gwapiv1.ParentReference, ctx *RouteParentContext)
- type ListenerContext
- func (l *ListenerContext) AllowsKind(kind gwapiv1.RouteGroupKind) bool
- func (l *ListenerContext) AllowsNamespace(namespace *corev1.Namespace) bool
- func (l *ListenerContext) AttachedRoutes() int32
- func (l *ListenerContext) GetConditions() []metav1.Condition
- func (l *ListenerContext) GetNamespace() string
- func (l *ListenerContext) IncrementAttachedRoutes()
- func (l *ListenerContext) IsReady() bool
- func (l *ListenerContext) SetCondition(conditionType gwapiv1.ListenerConditionType, ...)
- func (l *ListenerContext) SetSupportedKinds(kinds ...gwapiv1.RouteGroupKind)
- func (l *ListenerContext) SetTLSSecrets(tlsSecrets []*corev1.Secret)
- type ListenerFrontendTLSValidation
- type ListenerTLSConfig
- type ListenersTranslator
- type MergeBackendsConfig
- type NamespacedNameWithSection
- type OpenIDConfig
- type ResourceMetadata
- type RouteContext
- type RouteParentContext
- func (r *RouteParentContext) GetGateway() *GatewayContext
- func (r *RouteParentContext) HasCondition(route RouteContext, condType gwapiv1.RouteConditionType, ...) bool
- func (r *RouteParentContext) ResetConditions(route RouteContext)
- func (r *RouteParentContext) SetListeners(listeners ...*ListenerContext)
- type RoutesTranslator
- type TCPRouteContext
- func (r *TCPRouteContext) GetHostnames() []string
- func (r *TCPRouteContext) GetParentReferences() []gwapiv1.ParentReference
- func (r *TCPRouteContext) GetRouteParentContext(forParentRef gwapiv1.ParentReference) *RouteParentContext
- func (r *TCPRouteContext) GetRouteStatus() *gwapiv1.RouteStatus
- func (r *TCPRouteContext) GetRouteType() gwapiv1.Kind
- func (r *TCPRouteContext) HasRuleNames(sectionName gwapiv1.SectionName) bool
- func (r *TCPRouteContext) SetRouteParentContext(forParentRef gwapiv1.ParentReference, ctx *RouteParentContext)
- type TLSRouteContext
- func (r *TLSRouteContext) GetHostnames() []string
- func (r *TLSRouteContext) GetParentReferences() []gwapiv1.ParentReference
- func (r *TLSRouteContext) GetRouteParentContext(forParentRef gwapiv1.ParentReference) *RouteParentContext
- func (r *TLSRouteContext) GetRouteStatus() *gwapiv1.RouteStatus
- func (r *TLSRouteContext) GetRouteType() gwapiv1.Kind
- func (r *TLSRouteContext) HasRuleNames(sectionName gwapiv1.SectionName) bool
- func (r *TLSRouteContext) SetRouteParentContext(forParentRef gwapiv1.ParentReference, ctx *RouteParentContext)
- type TranslateResult
- type Translator
- func (t *Translator) GetRelevantGateways(resources *resource.Resources) (acceptedGateways, failedGateways []*GatewayContext)
- func (t *Translator) IRKey(gatewayNN types.NamespacedName) string
- func (t *Translator) InitIRs(acceptedGateways, failedGateways []*GatewayContext) (map[string]*ir.Xds, map[string]*ir.Infra)
- func (t *Translator) IsServiceRouting(envoyProxy *egv1a1.EnvoyProxy, btpRoutingType *egv1a1.RoutingType) bool
- func (t *Translator) ProcessAddresses(gateways []*GatewayContext, _ resource.XdsIRMap, infraIR resource.InfraIRMap)
- func (t *Translator) ProcessBackendTLSPolicyStatus(btlsp []*gwapiv1.BackendTLSPolicy)
- func (t *Translator) ProcessBackendTrafficPolicies(resources *resource.Resources, gateways []*GatewayContext, ...) []*egv1a1.BackendTrafficPolicy
- func (t *Translator) ProcessBackends(backends []*egv1a1.Backend, backendTLSPolicies []*gwapiv1.BackendTLSPolicy) []*egv1a1.Backend
- func (t *Translator) ProcessClientTrafficPolicies(resources *resource.Resources, gateways []*GatewayContext, ...) []*egv1a1.ClientTrafficPolicy
- func (t *Translator) ProcessEnvoyExtensionPolicies(envoyExtensionPolicies []*egv1a1.EnvoyExtensionPolicy, ...) []*egv1a1.EnvoyExtensionPolicy
- func (t *Translator) ProcessEnvoyPatchPolicies(envoyPatchPolicies []*egv1a1.EnvoyPatchPolicy, xdsIR resource.XdsIRMap) []*egv1a1.EnvoyPatchPolicy
- func (t *Translator) ProcessExtensionServerPolicies(policies []unstructured.Unstructured, gateways []*GatewayContext, ...) ([]unstructured.Unstructured, error)
- func (t *Translator) ProcessGRPCFilters(parentRef *RouteParentContext, route RouteContext, ...) (*HTTPFiltersContext, []status.Error)
- func (t *Translator) ProcessGRPCRoutes(grpcRoutes []*gwapiv1.GRPCRoute, gateways []*GatewayContext, ...) []*GRPCRouteContext
- func (t *Translator) ProcessGatewayTLS(gateways []*GatewayContext, resources *resource.Resources)
- func (t *Translator) ProcessGlobalResources(resources *resource.Resources, xdsIRs resource.XdsIRMap, ...) error
- func (t *Translator) ProcessHTTPFilters(parentRef *RouteParentContext, route RouteContext, ...) (*HTTPFiltersContext, []status.Error)
- func (t *Translator) ProcessHTTPRoutes(httpRoutes []*gwapiv1.HTTPRoute, gateways []*GatewayContext, ...) []*HTTPRouteContext
- func (t *Translator) ProcessListenerSetStatus(listenerSets []*gwapiv1.ListenerSet, gateways []*GatewayContext)
- func (t *Translator) ProcessListenerSets(listenerSets []*gwapiv1.ListenerSet, gateways []*GatewayContext)
- func (t *Translator) ProcessListeners(gateways []*GatewayContext, xdsIR resource.XdsIRMap, ...)
- func (t *Translator) ProcessSecurityPolicies(securityPolicies []*egv1a1.SecurityPolicy, gateways []*GatewayContext, ...) []*egv1a1.SecurityPolicy
- func (t *Translator) ProcessTCPRoutes(tcpRoutes []*gwapiv1.TCPRoute, gateways []*GatewayContext, ...) []*TCPRouteContext
- func (t *Translator) ProcessTLSRoutes(tlsRoutes []*gwapiv1.TLSRoute, gateways []*GatewayContext, ...) []*TLSRouteContext
- func (t *Translator) ProcessUDPRoutes(udpRoutes []*gwapiv1.UDPRoute, gateways []*GatewayContext, ...) []*UDPRouteContext
- func (t *Translator) Translate(resources *resource.Resources) (*TranslateResult, error)
- type TranslatorContext
- func (t *TranslatorContext) GetBackend(namespace, name string) *egv1a1.Backend
- func (t *TranslatorContext) GetClusterTrustBundle(name string) *certificatesv1b1.ClusterTrustBundle
- func (t *TranslatorContext) GetConfigMap(namespace, name string) *corev1.ConfigMap
- func (t *TranslatorContext) GetEndpointSlicesForBackend(svcNamespace, svcName, backendKind string) []*discoveryv1.EndpointSlice
- func (t *TranslatorContext) GetNamespace(name string) *corev1.Namespace
- func (t *TranslatorContext) GetSecret(namespace, name string) *corev1.Secret
- func (t *TranslatorContext) GetService(namespace, name string) *corev1.Service
- func (t *TranslatorContext) GetServiceImport(namespace, name string) *mcsapiv1a1.ServiceImport
- func (t *TranslatorContext) SetBackends(backends []*egv1a1.Backend)
- func (t *TranslatorContext) SetClusterTrustBundles(ctbs []*certificatesv1b1.ClusterTrustBundle)
- func (t *TranslatorContext) SetConfigMaps(configMaps []*corev1.ConfigMap)
- func (t *TranslatorContext) SetEndpointSlicesForBackend(slices []*discoveryv1.EndpointSlice)
- func (t *TranslatorContext) SetNamespaces(namespaces []*corev1.Namespace)
- func (t *TranslatorContext) SetSecrets(secrets []*corev1.Secret)
- func (t *TranslatorContext) SetServiceImports(svcImps []*mcsapiv1a1.ServiceImport)
- func (t *TranslatorContext) SetServices(svcs []*corev1.Service)
- type TranslatorManager
- type UDPRouteContext
- func (r *UDPRouteContext) GetHostnames() []string
- func (r *UDPRouteContext) GetParentReferences() []gwapiv1.ParentReference
- func (r *UDPRouteContext) GetParentRefs() map[gwapiv1.ParentReference]*RouteParentContext
- func (r *UDPRouteContext) GetRouteParentContext(forParentRef gwapiv1.ParentReference) *RouteParentContext
- func (r *UDPRouteContext) GetRouteStatus() *gwapiv1.RouteStatus
- func (r *UDPRouteContext) GetRouteType() gwapiv1.Kind
- func (r *UDPRouteContext) HasRuleNames(sectionName gwapiv1.SectionName) bool
- func (r *UDPRouteContext) SetRouteParentContext(forParentRef gwapiv1.ParentReference, ctx *RouteParentContext)
- type XdsIRRoutes
Constants ¶
const ( MaxConsistentHashTableSize = 5000011 // https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/cluster/v3/cluster.proto#config-cluster-v3-cluster-maglevlbconfig // ResponseBodyConfigMapKey is the key used in ConfigMaps to store custom response body data ResponseBodyConfigMapKey = "response.body" )
const ( TCPProtocol = "TCP" UDPProtocol = "UDP" L4Protocol = "L4" L7Protocol = "L7" // CACertKey is the key used in ConfigMaps and Secrets to store CA certificate data CACertKey = "ca.crt" TLSCertKey = "tls.crt" // CRLKey is the key used in ConfigMaps and Secrets to store certificate revocation list data CRLKey = "ca.crl" )
const ( MinHTTP2InitialStreamWindowSize = 65535 // https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/core/v3/protocol.proto#envoy-v3-api-field-config-core-v3-http2protocoloptions-initial-stream-window-size MaxHTTP2InitialStreamWindowSize = 2147483647 // https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/core/v3/protocol.proto#envoy-v3-api-field-config-core-v3-http2protocoloptions-initial-stream-window-size MinHTTP2InitialConnectionWindowSize = MinHTTP2InitialStreamWindowSize MaxHTTP2InitialConnectionWindowSize = MaxHTTP2InitialStreamWindowSize )
const ( GroupMultiClusterService = "multicluster.x-k8s.io" // OwningGatewayNamespaceLabel is the owner reference label used for managed infra. // The value should be the namespace of the accepted Envoy Gateway. OwningGatewayNamespaceLabel = "gateway.envoyproxy.io/owning-gateway-namespace" OwningGatewayClassLabel = "gateway.envoyproxy.io/owning-gatewayclass" // OwningGatewayNameLabel is the owner reference label used for managed infra. // The value should be the name of the accepted Envoy Gateway. OwningGatewayNameLabel = "gateway.envoyproxy.io/owning-gateway-name" GatewayNameLabel = "gateway.networking.k8s.io/gateway-name" )
const ( // Following the description in `timeout` section of https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/route/v3/route_components.proto // Request timeout, which is defined as Duration, specifies the upstream timeout for the route // If not specified, the default is 15s HTTPRequestTimeout = "15s" )
const (
// JWKSConfigMapKey is the key used in ConfigMaps to store JWKS data
JWKSConfigMapKey = "jwks"
)
const (
// LuaConfigMapKey is the key used in ConfigMaps to store Lua scripts
LuaConfigMapKey = "lua"
)
oci URL prefix
Variables ¶
var ( ErrRefNotPermitted = fmt.Errorf("cross-namespace reference is not permitted by any ReferenceGrant") ErrInvalidCACertificateKind = fmt.Errorf("Unsupported reference kind, supported kinds are ConfigMap, Secret, and ClusterTrustBundle") ErrNoValidCACertificate = fmt.Errorf( "no valid CA certificate found in referenced resources", ) )
var ( PathMatchTypeDerefOr = ptr.Deref[gwapiv1.PathMatchType] GRPCMethodMatchTypeDerefOr = ptr.Deref[gwapiv1.GRPCMethodMatchType] HeaderMatchTypeDerefOr = ptr.Deref[gwapiv1.HeaderMatchType] GRPCHeaderMatchTypeDerefOr = ptr.Deref[gwapiv1.GRPCHeaderMatchType] QueryParamMatchTypeDerefOr = ptr.Deref[gwapiv1.QueryParamMatchType] )
var HeaderValueRegexp = regexp.MustCompile(`^[!-~]+([\t ]?[!-~]+)*$`)
Header value pattern according to RFC 7230
Functions ¶
func ExtServerPolicyStatusAsPolicyStatus ¶ added in v1.6.5
func ExtServerPolicyStatusAsPolicyStatus(policy *unstructured.Unstructured) gwapiv1.PolicyStatus
func FromNamespacesPtr ¶
func FromNamespacesPtr(fromNamespaces gwapiv1.FromNamespaces) *gwapiv1.FromNamespaces
func GatewayClassOwnerLabel ¶ added in v0.6.0
GatewayClassOwnerLabel returns the GatewayCLass Owner label using the provided name as the value.
func GatewayOwnerLabels ¶
GatewayOwnerLabels returns the Gateway Owner labels using the provided namespace and name as the values.
func GetHostnames ¶ added in v0.5.0
func GetHostnames(route RouteContext) []string
GetHostnames returns the hosts targeted by the Route object.
func GetManagedParentReferences ¶ added in v1.6.5
func GetManagedParentReferences(route RouteContext) []gwapiv1.ParentReference
GetManagedParentReferences returns route parentRefs that are managed by this controller.
func GetParentReferences ¶ added in v0.5.0
func GetParentReferences(route RouteContext) []gwapiv1.ParentReference
GetParentReferences returns the ParentReference of the Route object.
func GetRouteStatus ¶ added in v0.5.0
func GetRouteStatus(route RouteContext) *gwapiv1.RouteStatus
GetRouteStatus returns the RouteStatus object associated with the Route.
func IsMergeGatewaysEnabled ¶ added in v1.1.0
func IsParentRefEqual ¶ added in v1.5.2
func IsParentRefEqual(ref1, ref2 gwapiv1.ParentReference, routeNS string) bool
IsParentRefEqual compares two ParentReference objects for equality without using reflection.
func IsRefToGateway ¶
func IsRefToGateway(routeNamespace gwapiv1.Namespace, parentRef gwapiv1.ParentReference, gateway types.NamespacedName) bool
IsRefToGateway returns whether the provided parent ref is a reference to a Gateway with the given namespace/name, irrespective of whether a section/listener name has been specified (i.e. a parent ref to a listener on the specified gateway will return "true").
func MergeEnvoyProxyConfigs ¶ added in v1.8.0
func MergeEnvoyProxyConfigs( defaultSpec *egv1a1.EnvoyProxySpec, gatewayClassProxy *egv1a1.EnvoyProxy, gatewayProxy *egv1a1.EnvoyProxy, ) (*egv1a1.EnvoyProxy, error)
MergeEnvoyProxyConfigs merges EnvoyProxy configurations using a 3-level hierarchy. The merge is performed in two steps, with the MergeType on the more specific (override) resource at each step exclusively controlling the merge strategy:
Step 1 - Gateway over GatewayClass:
- base: gatewayClassProxy
- override: gatewayProxy
- mergeType: gatewayProxy.Spec.MergeType (nil → Replace)
Step 2 - Step 1 result over EnvoyGateway defaults:
- base: defaultSpec
- override: Step 1 result
- mergeType: gatewayClassProxy.Spec.MergeType if set, else gatewayProxy.Spec.MergeType (nil → Replace)
The MergeType field in EnvoyGateway defaultSpec has no effect on merge behavior; it is treated as an ordinary data field.
Note: If the MergeGateways option is specified then gatewayProxy will be nil and will not affect the resulting configuration. Settings not supplied by the merged EnvoyProxy are applied later at infrastructure creation time via GetEnvoyProxyKubeProvider().
func NamespaceDerefOr ¶
NamespaceDerefOr returns the dereferenced value of the provided Namespace in string
func NamespacePtr ¶
func ObjectNamePtr ¶
func ObjectNamePtr(val string) *gwapiv1.ObjectName
func OwnerLabels ¶ added in v1.1.0
OwnerLabels returns the owner labels based on the mergeGateways setting
func PolicyStatusToUnstructured ¶ added in v1.6.5
func PolicyStatusToUnstructured(policyStatus gwapiv1.PolicyStatus) map[string]any
func PortNumPtr ¶
func PortNumPtr(val int32) *gwapiv1.PortNumber
func SectionNamePtr ¶
func SectionNamePtr(name string) *gwapiv1.SectionName
func ValidateGRPCRouteFilter ¶ added in v0.3.0
func ValidateGRPCRouteFilter(filter *gwapiv1.GRPCRouteFilter, extGKs ...schema.GroupKind) error
ValidateGRPCRouteFilter validates the provided filter within GRPCRoute.
func ValidateHTTPRouteFilter ¶ added in v0.3.0
func ValidateHTTPRouteFilter(filter *gwapiv1.HTTPRouteFilter, extGKs ...schema.GroupKind) error
ValidateHTTPRouteFilter validates the provided filter within HTTPRoute.
Types ¶
type AddressesTranslator ¶ added in v0.5.0
type AddressesTranslator interface {
ProcessAddresses(gateways []*GatewayContext, xdsIR resource.XdsIRMap, infraIR resource.InfraIRMap)
}
type BTPClusterSettingsIndex ¶ added in v1.9.0
type BTPClusterSettingsIndex struct {
// contains filtered or unexported fields
}
BTPClusterSettingsIndex holds, per route-rule/route/listener target, whether a BackendTrafficPolicy sets a cluster-scoped field, or has MergeType unset.
func (*BTPClusterSettingsIndex) HasClusterSettingsBelowGateway ¶ added in v1.9.0
func (idx *BTPClusterSettingsIndex) HasClusterSettingsBelowGateway( routeKind gwapiv1.Kind, routeNN types.NamespacedName, gatewayNN types.NamespacedName, listenerName *gwapiv1.SectionName, listenerSetNN *types.NamespacedName, routeRuleName *gwapiv1.SectionName, ) bool
HasClusterSettingsBelowGateway reports whether a route-rule, route, listener, or ListenerSet-level BackendTrafficPolicy contributes backend-cluster-scoped settings for the given target, or targets it with MergeType unset. A gateway-level setting is never the answer here: it applies uniformly to every route sharing a merged cluster, so it can't cause a divergence - BuildBTPIndexes never writes a gateway-scope entry into this index at all, so Lookup's walk to gatewayScope is a guaranteed miss, not just a value this method happens to ignore.
func (BTPClusterSettingsIndex) Lookup ¶ added in v1.9.0
func (idx BTPClusterSettingsIndex) Lookup( routeKind gwapiv1.Kind, routeNN types.NamespacedName, gatewayNN types.NamespacedName, listenerName *gwapiv1.SectionName, listenerSetNN *types.NamespacedName, routeRuleName *gwapiv1.SectionName, ) (value T, replacesParent bool)
Lookup resolves the effective value for a route-rule/route/listener/listenerSet/gateway target. value alone is always correct; replacesParent reports whether a route-rule/route entry supplied it directly, instead of falling through to a parent scope. listenerSetNN is nil unless the route attaches through a ListenerSet, in which case Gateway-listener scope is skipped (Gateway listeners and ListenerSet listeners are sibling scopes, not parent/child) but bare-Gateway scope is not: it sits above both listener kinds, so either can still fall through to it.
func (BTPClusterSettingsIndex) LookupExact ¶ added in v1.9.0
func (idx BTPClusterSettingsIndex) LookupExact(scope policyScope) (T, bool)
LookupExact resolves scope's own entry, whichever level it is, with no fallback to a broader parent scope. effective was already decided when the entry was written, so every scope kind resolves the same way here.
type BTPIndexes ¶ added in v1.9.0
type BTPIndexes struct {
RoutingType *BTPRoutingTypeIndex
ClusterSettings *BTPClusterSettingsIndex
LoadBalancer *BTPLoadBalancerIndex
}
BTPIndexes groups the three pre-computed BackendTrafficPolicy indexes BuildBTPIndexes builds together in one pass over btps.
func BuildBTPIndexes ¶ added in v1.9.0
func BuildBTPIndexes( btps []*egv1a1.BackendTrafficPolicy, routes []client.Object, gateways []*GatewayContext, listenerSets []*gwapiv1.ListenerSet, referenceGrants []*gwapiv1b1.ReferenceGrant, namespaceLookup func(string) *corev1.Namespace, mergeBackendsEnabled bool, ) *BTPIndexes
BuildBTPIndexes builds BTPIndexes, resolving each BackendTrafficPolicy's targets at most once.
type BTPLoadBalancerIndex ¶ added in v1.9.0
type BTPLoadBalancerIndex struct {
// contains filtered or unexported fields
}
BTPLoadBalancerIndex reports, per gateway, whether a BackendTrafficPolicy attached to it sets LoadBalancer to ConsistentHash.
func (*BTPLoadBalancerIndex) IsConsistentHash ¶ added in v1.9.0
func (idx *BTPLoadBalancerIndex) IsConsistentHash(gatewayNN types.NamespacedName) bool
IsConsistentHash reports whether gatewayNN has a BackendTrafficPolicy setting LoadBalancer to ConsistentHash.
func (BTPLoadBalancerIndex) Lookup ¶ added in v1.9.0
func (idx BTPLoadBalancerIndex) Lookup( routeKind gwapiv1.Kind, routeNN types.NamespacedName, gatewayNN types.NamespacedName, listenerName *gwapiv1.SectionName, listenerSetNN *types.NamespacedName, routeRuleName *gwapiv1.SectionName, ) (value T, replacesParent bool)
Lookup resolves the effective value for a route-rule/route/listener/listenerSet/gateway target. value alone is always correct; replacesParent reports whether a route-rule/route entry supplied it directly, instead of falling through to a parent scope. listenerSetNN is nil unless the route attaches through a ListenerSet, in which case Gateway-listener scope is skipped (Gateway listeners and ListenerSet listeners are sibling scopes, not parent/child) but bare-Gateway scope is not: it sits above both listener kinds, so either can still fall through to it.
func (BTPLoadBalancerIndex) LookupExact ¶ added in v1.9.0
func (idx BTPLoadBalancerIndex) LookupExact(scope policyScope) (T, bool)
LookupExact resolves scope's own entry, whichever level it is, with no fallback to a broader parent scope. effective was already decided when the entry was written, so every scope kind resolves the same way here.
type BTPRoutingTypeIndex ¶ added in v1.8.0
type BTPRoutingTypeIndex struct {
// contains filtered or unexported fields
}
BTPRoutingTypeIndex holds RoutingType values from BackendTrafficPolicies, keyed by attachment scope. This avoids an O(BTPs) lookup for every iteration of processDestination.
func (BTPRoutingTypeIndex) Lookup ¶ added in v1.9.0
func (idx BTPRoutingTypeIndex) Lookup( routeKind gwapiv1.Kind, routeNN types.NamespacedName, gatewayNN types.NamespacedName, listenerName *gwapiv1.SectionName, listenerSetNN *types.NamespacedName, routeRuleName *gwapiv1.SectionName, ) (value T, replacesParent bool)
Lookup resolves the effective value for a route-rule/route/listener/listenerSet/gateway target. value alone is always correct; replacesParent reports whether a route-rule/route entry supplied it directly, instead of falling through to a parent scope. listenerSetNN is nil unless the route attaches through a ListenerSet, in which case Gateway-listener scope is skipped (Gateway listeners and ListenerSet listeners are sibling scopes, not parent/child) but bare-Gateway scope is not: it sits above both listener kinds, so either can still fall through to it.
func (*BTPRoutingTypeIndex) LookupBTPRoutingType ¶ added in v1.8.0
func (idx *BTPRoutingTypeIndex) LookupBTPRoutingType( routeKind gwapiv1.Kind, routeNN types.NamespacedName, gatewayNN types.NamespacedName, listenerName *gwapiv1.SectionName, listenerSetNN *types.NamespacedName, routeRuleName *gwapiv1.SectionName, ) *egv1a1.RoutingType
LookupBTPRoutingType resolves the RoutingType for a specific route rule and gateway/listener/listenerSet combination by checking the index in priority order: routeRule > route > listener/listenerSet > gateway, honoring MergeType. Returns nil if no matching BTP RoutingType is found, or if the index is nil.
func (BTPRoutingTypeIndex) LookupExact ¶ added in v1.9.0
func (idx BTPRoutingTypeIndex) LookupExact(scope policyScope) (T, bool)
LookupExact resolves scope's own entry, whichever level it is, with no fallback to a broader parent scope. effective was already decided when the entry was written, so every scope kind resolves the same way here.
func (*BTPRoutingTypeIndex) LookupGatewayBTRoutingType ¶ added in v1.9.0
func (idx *BTPRoutingTypeIndex) LookupGatewayBTRoutingType(gatewayNN types.NamespacedName) *egv1a1.RoutingType
LookupGatewayBTRoutingType resolves the RoutingType pinned directly at gatewayNN, ignoring any listener/listenerSet/route/route-rule level override. Returns nil if no matching BTP RoutingType is found, or if the index is nil.
type BackendClusterKey ¶ added in v1.9.0
type BackendClusterKey struct {
GatewayIRKey string
Kind string
Namespace string
Name string
Port int32
Protocol ir.AppProtocol
}
BackendClusterKey identifies a unique backend per gateway for cluster deduplication.
type BackendRefContext ¶ added in v1.0.0
type BackendRefContext interface {
GetBackendRef() *gwapiv1.BackendRef
GetFilters() any
}
BackendRefContext represents a generic BackendRef object
type BackendRefWithFilters ¶ added in v1.5.2
type BackendRefWithFilters struct {
BackendRef *gwapiv1.BackendRef
Filters any // []gwapiv1.HTTPRouteFilter or []gwapiv1.GRPCRouteFilter
}
BackendRefWithFilters wraps backend refs that have filters (HTTPBackendRef, GRPCBackendRef)
func (BackendRefWithFilters) GetBackendRef ¶ added in v1.5.2
func (b BackendRefWithFilters) GetBackendRef() *gwapiv1.BackendRef
func (BackendRefWithFilters) GetFilters ¶ added in v1.5.2
func (b BackendRefWithFilters) GetFilters() any
type CTPClusterSettingsIndex ¶ added in v1.9.0
type CTPClusterSettingsIndex struct {
// contains filtered or unexported fields
}
CTPClusterSettingsIndex holds, per listenerSet/listener target, whether a ClientTrafficPolicy sets a cluster-affecting field. Gateway-wide settings (no SectionName) aren't tracked, since a merged cluster never spans gateways and so can never see them diverge.
func BuildCTPClusterSettingsIndex ¶ added in v1.9.0
func BuildCTPClusterSettingsIndex( ctps []*egv1a1.ClientTrafficPolicy, gateways []*GatewayContext, listenerSets []*gwapiv1.ListenerSet, referenceGrants []*gwapiv1b1.ReferenceGrant, namespaceLookup func(string) *corev1.Namespace, mergeBackendsEnabled bool, ) *CTPClusterSettingsIndex
BuildCTPClusterSettingsIndex builds a CTPClusterSettingsIndex.
func (*CTPClusterSettingsIndex) HasClusterSettingsBelowGateway ¶ added in v1.9.0
func (idx *CTPClusterSettingsIndex) HasClusterSettingsBelowGateway(gatewayNN types.NamespacedName, listener *ListenerContext) bool
HasClusterSettingsBelowGateway reports whether listener (which belongs to gatewayNN, either directly or via a ListenerSet) has a ClientTrafficPolicy-sourced cluster-scoped setting, checked against its own owner (the Gateway, or the ListenerSet it came from).
func (CTPClusterSettingsIndex) Lookup ¶ added in v1.9.0
func (idx CTPClusterSettingsIndex) Lookup( routeKind gwapiv1.Kind, routeNN types.NamespacedName, gatewayNN types.NamespacedName, listenerName *gwapiv1.SectionName, listenerSetNN *types.NamespacedName, routeRuleName *gwapiv1.SectionName, ) (value T, replacesParent bool)
Lookup resolves the effective value for a route-rule/route/listener/listenerSet/gateway target. value alone is always correct; replacesParent reports whether a route-rule/route entry supplied it directly, instead of falling through to a parent scope. listenerSetNN is nil unless the route attaches through a ListenerSet, in which case Gateway-listener scope is skipped (Gateway listeners and ListenerSet listeners are sibling scopes, not parent/child) but bare-Gateway scope is not: it sits above both listener kinds, so either can still fall through to it.
func (CTPClusterSettingsIndex) LookupExact ¶ added in v1.9.0
func (idx CTPClusterSettingsIndex) LookupExact(scope policyScope) (T, bool)
LookupExact resolves scope's own entry, whichever level it is, with no fallback to a broader parent scope. effective was already decided when the entry was written, so every scope kind resolves the same way here.
type DirectBackendRef ¶ added in v1.5.2
type DirectBackendRef struct {
BackendRef *gwapiv1.BackendRef
}
DirectBackendRef wraps a BackendRef directly (used by TLS/TCP/UDP routes)
func (DirectBackendRef) GetBackendRef ¶ added in v1.5.2
func (d DirectBackendRef) GetBackendRef() *gwapiv1.BackendRef
func (DirectBackendRef) GetFilters ¶ added in v1.5.2
func (d DirectBackendRef) GetFilters() any
type FiltersTranslator ¶ added in v0.3.0
type FiltersTranslator interface {
HTTPFiltersTranslator
}
type GRPCRouteContext ¶ added in v0.3.0
type GRPCRouteContext struct {
*gwapiv1.GRPCRoute
ParentRefs map[gwapiv1.ParentReference]*RouteParentContext
}
GRPCRouteContext wraps a GRPCRoute and provides helper methods for accessing the route's parents.
func (*GRPCRouteContext) GetHostnames ¶ added in v0.3.0
func (r *GRPCRouteContext) GetHostnames() []string
func (*GRPCRouteContext) GetParentReferences ¶ added in v0.3.0
func (r *GRPCRouteContext) GetParentReferences() []gwapiv1.ParentReference
func (*GRPCRouteContext) GetRouteParentContext ¶ added in v0.3.0
func (r *GRPCRouteContext) GetRouteParentContext(forParentRef gwapiv1.ParentReference) *RouteParentContext
func (*GRPCRouteContext) GetRouteStatus ¶ added in v0.3.0
func (r *GRPCRouteContext) GetRouteStatus() *gwapiv1.RouteStatus
func (*GRPCRouteContext) GetRouteType ¶ added in v0.3.0
func (r *GRPCRouteContext) GetRouteType() gwapiv1.Kind
func (*GRPCRouteContext) HasRuleNames ¶ added in v1.5.1
func (r *GRPCRouteContext) HasRuleNames(sectionName gwapiv1.SectionName) bool
func (*GRPCRouteContext) SetRouteParentContext ¶ added in v1.5.1
func (r *GRPCRouteContext) SetRouteParentContext(forParentRef gwapiv1.ParentReference, ctx *RouteParentContext)
type GatewayContext ¶
GatewayContext wraps a Gateway and provides helper methods for setting conditions, accessing Listeners, etc.
func (*GatewayContext) GetBackendTLSConfig ¶ added in v1.8.0
func (g *GatewayContext) GetBackendTLSConfig() (*egv1a1.BackendTLSConfig, *ResourceMetadata)
GetBackendTLSConfig returns the BackendTLSConfig for the Gateway. Precedence order (highest to lowest): 1. Gateway.spec.tls.backend configuration 2. EnvoyProxy.spec.backendTLS (attached to Gateway or GatewayClass)
TODO: Merging fields in EnvoyProxy and Gateway TLS configs should be considered.
func (*GatewayContext) IncreaseAttachedListenerSets ¶ added in v1.8.0
func (g *GatewayContext) IncreaseAttachedListenerSets()
func (*GatewayContext) ResetListeners ¶ added in v0.3.0
func (g *GatewayContext) ResetListeners()
ResetListeners resets the listener statuses and re-generates the GatewayContext ListenerContexts from the Gateway spec.
type HTTPFilterIR ¶ added in v0.3.0
type HTTPFilterIR struct {
DirectResponse *ir.CustomResponse
RedirectResponse *ir.Redirect
CredentialInjection *ir.CredentialInjection
URLRewrite *ir.URLRewrite
AddRequestHeaders []ir.AddHeader
RemoveRequestHeaders []string
AddResponseHeaders []ir.AddHeader
RemoveResponseHeaders []string
Mirrors []*ir.MirrorPolicy
CORS *ir.CORS
ExtensionRefs []*ir.UnstructuredRef
// Matches holds matchers defined on HTTPRouteFilters that must be ANDed with HTTPRouteRule.Matches.
Matches []egv1a1.HTTPRouteMatchFilter
}
HTTPFilterIR contains the ir processing results.
type HTTPFiltersContext ¶ added in v0.3.0
type HTTPFiltersContext struct {
*HTTPFilterIR
ParentRef *RouteParentContext
Route RouteContext
RuleIdx int
}
HTTPFiltersContext is the context of http filters processing.
type HTTPFiltersTranslator ¶ added in v0.3.0
type HTTPFiltersTranslator interface {
// contains filtered or unexported methods
}
type HTTPRouteContext ¶
type HTTPRouteContext struct {
*gwapiv1.HTTPRoute
ParentRefs map[gwapiv1.ParentReference]*RouteParentContext
}
HTTPRouteContext wraps an HTTPRoute and provides helper methods for accessing the route's parents.
func (*HTTPRouteContext) GetHostnames ¶
func (r *HTTPRouteContext) GetHostnames() []string
func (*HTTPRouteContext) GetParentReferences ¶
func (r *HTTPRouteContext) GetParentReferences() []gwapiv1.ParentReference
func (*HTTPRouteContext) GetRouteParentContext ¶
func (r *HTTPRouteContext) GetRouteParentContext(forParentRef gwapiv1.ParentReference) *RouteParentContext
func (*HTTPRouteContext) GetRouteStatus ¶ added in v0.3.0
func (r *HTTPRouteContext) GetRouteStatus() *gwapiv1.RouteStatus
func (*HTTPRouteContext) GetRouteType ¶
func (r *HTTPRouteContext) GetRouteType() gwapiv1.Kind
func (*HTTPRouteContext) HasRuleNames ¶ added in v1.5.1
func (r *HTTPRouteContext) HasRuleNames(sectionName gwapiv1.SectionName) bool
func (*HTTPRouteContext) SetRouteParentContext ¶ added in v1.5.1
func (r *HTTPRouteContext) SetRouteParentContext(forParentRef gwapiv1.ParentReference, ctx *RouteParentContext)
type ListenerContext ¶
ListenerContext wraps a Listener and provides helper methods for setting conditions and other status information on the associated Gateway, etc.
func GetReferencedListeners ¶
func GetReferencedListeners(routeNamespace gwapiv1.Namespace, parentRef gwapiv1.ParentReference, gateways []*GatewayContext) (bool, []*ListenerContext)
GetReferencedListeners returns whether a given parent ref references a Gateway or ListenerSet in the given list, and if so, a list of the Listeners within that Gateway or ListenerSet that are included by the parent ref (either one specific Listener, or all Listeners in the Gateway or ListenerSet, depending on whether section name is specified or not).
func (*ListenerContext) AllowsKind ¶
func (l *ListenerContext) AllowsKind(kind gwapiv1.RouteGroupKind) bool
func (*ListenerContext) AllowsNamespace ¶
func (l *ListenerContext) AllowsNamespace(namespace *corev1.Namespace) bool
func (*ListenerContext) AttachedRoutes ¶ added in v0.3.0
func (l *ListenerContext) AttachedRoutes() int32
func (*ListenerContext) GetConditions ¶
func (l *ListenerContext) GetConditions() []metav1.Condition
func (*ListenerContext) GetNamespace ¶ added in v1.7.0
func (l *ListenerContext) GetNamespace() string
func (*ListenerContext) IncrementAttachedRoutes ¶
func (l *ListenerContext) IncrementAttachedRoutes()
IncrementAttachedRoutes increments the number of attached routes for the listener in the status.
xref: https://github.com/kubernetes-sigs/gateway-api/issues/2402 Namely: - AttachedRoutes should be set on Listeners that are valid or invalid - The count of AttachedRoutes should include Routes that are valid or invalid
func (*ListenerContext) IsReady ¶
func (l *ListenerContext) IsReady() bool
func (*ListenerContext) SetCondition ¶
func (l *ListenerContext) SetCondition(conditionType gwapiv1.ListenerConditionType, conditionStatus metav1.ConditionStatus, reason gwapiv1.ListenerConditionReason, message string)
func (*ListenerContext) SetSupportedKinds ¶
func (l *ListenerContext) SetSupportedKinds(kinds ...gwapiv1.RouteGroupKind)
func (*ListenerContext) SetTLSSecrets ¶ added in v0.4.0
func (l *ListenerContext) SetTLSSecrets(tlsSecrets []*corev1.Secret)
type ListenerFrontendTLSValidation ¶ added in v1.8.0
type ListenerFrontendTLSValidation struct {
ValidateError error
*ir.TLSCACertificate
Mode egv1a1.ClientValidationModeType
}
type ListenerTLSConfig ¶ added in v1.8.0
type ListenerTLSConfig struct {
// contains filtered or unexported fields
}
type ListenersTranslator ¶ added in v0.3.0
type ListenersTranslator interface {
ProcessListeners(gateways []*GatewayContext, xdsIR resource.XdsIRMap, infraIR resource.InfraIRMap, resources *resource.Resources)
}
type MergeBackendsConfig ¶ added in v1.9.0
type MergeBackendsConfig struct {
Selector *metav1.LabelSelector
}
MergeBackendsConfig is the resolved MergeBackends config. A nil *MergeBackendsConfig means disabled; any non-nil value means enabled, mirroring egv1a1.MergeBackendsConfig's own mere-presence-enables convention.
func ResolveMergeBackendsConfig ¶ added in v1.9.0
func ResolveMergeBackendsConfig(resources *resource.Resources) *MergeBackendsConfig
ResolveMergeBackendsConfig resolves MergeBackends config, preferring the GatewayClass-level EnvoyProxy over the global default. Returns nil when MergeBackends is unset in both.
type NamespacedNameWithSection ¶ added in v1.6.0
type NamespacedNameWithSection struct {
types.NamespacedName
gwapiv1.SectionName
}
type OpenIDConfig ¶ added in v1.0.0
type ResourceMetadata ¶ added in v1.8.0
type RouteContext ¶
type RouteContext interface {
client.Object
GetRouteType() gwapiv1.Kind
HasRuleNames(sectionName gwapiv1.SectionName) bool
GetHostnames() []string
GetParentReferences() []gwapiv1.ParentReference
GetRouteStatus() *gwapiv1.RouteStatus
GetRouteParentContext(forParentRef gwapiv1.ParentReference) *RouteParentContext
SetRouteParentContext(forParentRef gwapiv1.ParentReference, ctx *RouteParentContext)
}
RouteContext represents a generic Route object (HTTPRoute, TLSRoute, etc.) that can reference Gateway objects.
type RouteParentContext ¶
type RouteParentContext struct {
*gwapiv1.ParentReference
// TODO: [v1alpha2-gwapiv1] This can probably be replaced with
// a single field pointing to *gwapiv1.RouteStatus.
HTTPRoute *gwapiv1.HTTPRoute
GRPCRoute *gwapiv1.GRPCRoute
TLSRoute *gwapiv1.TLSRoute
TCPRoute *gwapiv1.TCPRoute
UDPRoute *gwapiv1.UDPRoute
// contains filtered or unexported fields
}
RouteParentContext wraps a ParentReference and provides helper methods for setting conditions and other status information on the associated HTTPRoute, TLSRoute etc.
func GetRouteParentContext ¶ added in v0.5.0
func GetRouteParentContext(route RouteContext, forParentRef gwapiv1.ParentReference, controllerName string) *RouteParentContext
GetRouteParentContext returns RouteParentContext by using the Route objects' ParentReference. It creates a new RouteParentContext and add a new RouteParentStatus to the Route's Status if the ParentReference is not found.
func (*RouteParentContext) GetGateway ¶ added in v1.1.0
func (r *RouteParentContext) GetGateway() *GatewayContext
GetGateway returns the GatewayContext if parent resource is a gateway.
func (*RouteParentContext) HasCondition ¶ added in v0.4.0
func (r *RouteParentContext) HasCondition(route RouteContext, condType gwapiv1.RouteConditionType, status metav1.ConditionStatus) bool
func (*RouteParentContext) ResetConditions ¶
func (r *RouteParentContext) ResetConditions(route RouteContext)
func (*RouteParentContext) SetListeners ¶
func (r *RouteParentContext) SetListeners(listeners ...*ListenerContext)
type RoutesTranslator ¶ added in v0.3.0
type RoutesTranslator interface {
ProcessHTTPRoutes(httpRoutes []*gwapiv1.HTTPRoute, gateways []*GatewayContext, resources *resource.Resources, xdsIR resource.XdsIRMap) []*HTTPRouteContext
ProcessGRPCRoutes(grpcRoutes []*gwapiv1.GRPCRoute, gateways []*GatewayContext, resources *resource.Resources, xdsIR resource.XdsIRMap) []*GRPCRouteContext
ProcessTLSRoutes(tlsRoutes []*gwapiv1.TLSRoute, gateways []*GatewayContext, resources *resource.Resources, xdsIR resource.XdsIRMap) []*TLSRouteContext
ProcessTCPRoutes(tcpRoutes []*gwapiv1.TCPRoute, gateways []*GatewayContext, resources *resource.Resources, xdsIR resource.XdsIRMap) []*TCPRouteContext
ProcessUDPRoutes(udpRoutes []*gwapiv1.UDPRoute, gateways []*GatewayContext, resources *resource.Resources, xdsIR resource.XdsIRMap) []*UDPRouteContext
}
type TCPRouteContext ¶ added in v0.3.0
type TCPRouteContext struct {
*gwapiv1.TCPRoute
ParentRefs map[gwapiv1.ParentReference]*RouteParentContext
}
TCPRouteContext wraps a TCPRoute and provides helper methods for accessing the route's parents.
func (*TCPRouteContext) GetHostnames ¶ added in v0.3.0
func (r *TCPRouteContext) GetHostnames() []string
func (*TCPRouteContext) GetParentReferences ¶ added in v0.3.0
func (r *TCPRouteContext) GetParentReferences() []gwapiv1.ParentReference
func (*TCPRouteContext) GetRouteParentContext ¶ added in v0.3.0
func (r *TCPRouteContext) GetRouteParentContext(forParentRef gwapiv1.ParentReference) *RouteParentContext
func (*TCPRouteContext) GetRouteStatus ¶ added in v0.3.0
func (r *TCPRouteContext) GetRouteStatus() *gwapiv1.RouteStatus
func (*TCPRouteContext) GetRouteType ¶ added in v0.3.0
func (r *TCPRouteContext) GetRouteType() gwapiv1.Kind
func (*TCPRouteContext) HasRuleNames ¶ added in v1.5.1
func (r *TCPRouteContext) HasRuleNames(sectionName gwapiv1.SectionName) bool
func (*TCPRouteContext) SetRouteParentContext ¶ added in v1.5.1
func (r *TCPRouteContext) SetRouteParentContext(forParentRef gwapiv1.ParentReference, ctx *RouteParentContext)
type TLSRouteContext ¶
type TLSRouteContext struct {
*gwapiv1.TLSRoute
ParentRefs map[gwapiv1.ParentReference]*RouteParentContext
}
TLSRouteContext wraps a TLSRoute and provides helper methods for accessing the route's parents.
func (*TLSRouteContext) GetHostnames ¶
func (r *TLSRouteContext) GetHostnames() []string
func (*TLSRouteContext) GetParentReferences ¶
func (r *TLSRouteContext) GetParentReferences() []gwapiv1.ParentReference
func (*TLSRouteContext) GetRouteParentContext ¶
func (r *TLSRouteContext) GetRouteParentContext(forParentRef gwapiv1.ParentReference) *RouteParentContext
func (*TLSRouteContext) GetRouteStatus ¶ added in v0.3.0
func (r *TLSRouteContext) GetRouteStatus() *gwapiv1.RouteStatus
func (*TLSRouteContext) GetRouteType ¶
func (r *TLSRouteContext) GetRouteType() gwapiv1.Kind
func (*TLSRouteContext) HasRuleNames ¶ added in v1.5.1
func (r *TLSRouteContext) HasRuleNames(sectionName gwapiv1.SectionName) bool
func (*TLSRouteContext) SetRouteParentContext ¶ added in v1.5.1
func (r *TLSRouteContext) SetRouteParentContext(forParentRef gwapiv1.ParentReference, ctx *RouteParentContext)
type TranslateResult ¶
type Translator ¶
type Translator struct {
// TranslatorContext holds pre-indexed resource maps for efficient lookup resources
// during translation operations.
*TranslatorContext
// GatewayControllerName is the name of the Gateway API controller
GatewayControllerName string
// GatewayClassName is the name of the GatewayClass
// to process Gateways for.
GatewayClassName gwapiv1.ObjectName
// GlobalRateLimitEnabled is true when global
// ratelimiting has been configured by the admin.
GlobalRateLimitEnabled bool
// EndpointRoutingDisabled can be set to true to use
// the Service Cluster IP for routing to the backend
// instead.
EndpointRoutingDisabled bool
// MergeGateways is true when all Gateway Listeners
// should be merged under the parent GatewayClass.
MergeGateways bool
// MergeBackends is the resolved MergeBackends config, set via ResolveMergeBackendsConfig.
MergeBackends *MergeBackendsConfig
// PerResourceSystemCASecret restores the old behavior of emitting one SDS secret per
// BackendTLSPolicy or Backend resource using WellKnownCACertificates: System, instead of
// sharing a single system_ca_certificates secret. Disabled by default (shared secret used).
PerResourceSystemCASecret bool
// GatewayNamespaceMode is true if controller uses gateway namespace mode for infra deployments.
GatewayNamespaceMode bool
// EnvoyPatchPolicyEnabled when the EnvoyPatchPolicy
// feature is enabled.
EnvoyPatchPolicyEnabled bool
// LuaEnvoyExtensionPolicyDisabled when the Lua EnvoyExtensionPolicy feature is disabled.
LuaEnvoyExtensionPolicyDisabled bool
// BackendEnabled when the Backend feature is enabled.
BackendEnabled bool
// SDSSecretRefEnabled is true if EnvoyProxy can reference SDS secrets using the sds-ref type Secret.
// This could be enabled by Envoy Gateway configuration.
SDSSecretRefEnabled bool
// ExtensionGroupKinds stores the group/kind for all resources
// introduced by an Extension so that the translator can
// store referenced resources in the IR for later use.
ExtensionGroupKinds []schema.GroupKind
// ControllerNamespace is the namespace that Envoy Gateway controller runs in.
ControllerNamespace string
// WasmCache is the cache for Wasm modules.
WasmCache wasm.Cache
// RunningOnHost indicates whether Envoy Gateway is running locally on the host machine.
RunningOnHost bool
// InfraRemotelyManaged indicates whether the Envoy fleet is managed in the Remote infrastructure provider.
InfraRemotelyManaged bool
// Logger is the logger used by the translator.
Logger logging.Logger
// contains filtered or unexported fields
}
Translator translates Gateway API resources to IRs and computes status for Gateway API resources.
func (*Translator) GetRelevantGateways ¶
func (t *Translator) GetRelevantGateways(resources *resource.Resources) ( acceptedGateways, failedGateways []*GatewayContext, )
GetRelevantGateways returns GatewayContexts, containing a copy of the original Gateway with the Listener statuses reset.
func (*Translator) IRKey ¶ added in v1.4.0
func (t *Translator) IRKey(gatewayNN types.NamespacedName) string
func (*Translator) InitIRs ¶ added in v0.6.0
func (t *Translator) InitIRs(acceptedGateways, failedGateways []*GatewayContext) (map[string]*ir.Xds, map[string]*ir.Infra)
InitIRs checks if mergeGateways is enabled in EnvoyProxy config and initializes XdsIR and InfraIR maps with adequate keys.
func (*Translator) IsServiceRouting ¶ added in v1.8.0
func (t *Translator) IsServiceRouting(envoyProxy *egv1a1.EnvoyProxy, btpRoutingType *egv1a1.RoutingType) bool
IsServiceRouting determines if Service ClusterIP routing should be used. It follows the priority hierarchy:
- Translator.EndpointRoutingDisabled (for tests) - if true, always use Service routing
- BTP RoutingType - per-route/gateway override
- EnvoyProxy RoutingType - cluster-wide setting
- Default: Endpoint routing
func (*Translator) ProcessAddresses ¶ added in v0.5.0
func (t *Translator) ProcessAddresses(gateways []*GatewayContext, _ resource.XdsIRMap, infraIR resource.InfraIRMap)
func (*Translator) ProcessBackendTLSPolicyStatus ¶ added in v1.5.0
func (t *Translator) ProcessBackendTLSPolicyStatus(btlsp []*gwapiv1.BackendTLSPolicy)
ProcessBackendTLSPolicyStatus is called to post-process Backend TLS Policy status after they were applied in all relevant translations.
func (*Translator) ProcessBackendTrafficPolicies ¶ added in v0.6.0
func (t *Translator) ProcessBackendTrafficPolicies( resources *resource.Resources, gateways []*GatewayContext, routes []RouteContext, xdsIR resource.XdsIRMap, ) []*egv1a1.BackendTrafficPolicy
func (*Translator) ProcessBackends ¶ added in v1.1.0
func (t *Translator) ProcessBackends(backends []*egv1a1.Backend, backendTLSPolicies []*gwapiv1.BackendTLSPolicy) []*egv1a1.Backend
func (*Translator) ProcessClientTrafficPolicies ¶ added in v1.0.0
func (t *Translator) ProcessClientTrafficPolicies( resources *resource.Resources, gateways []*GatewayContext, xdsIR resource.XdsIRMap, infraIR resource.InfraIRMap, ) []*egv1a1.ClientTrafficPolicy
func (*Translator) ProcessEnvoyExtensionPolicies ¶ added in v1.1.0
func (t *Translator) ProcessEnvoyExtensionPolicies( envoyExtensionPolicies []*egv1a1.EnvoyExtensionPolicy, gateways []*GatewayContext, routes []RouteContext, resources *resource.Resources, xdsIR resource.XdsIRMap, ) []*egv1a1.EnvoyExtensionPolicy
func (*Translator) ProcessEnvoyPatchPolicies ¶ added in v0.5.0
func (t *Translator) ProcessEnvoyPatchPolicies(envoyPatchPolicies []*egv1a1.EnvoyPatchPolicy, xdsIR resource.XdsIRMap) []*egv1a1.EnvoyPatchPolicy
func (*Translator) ProcessExtensionServerPolicies ¶ added in v1.1.0
func (t *Translator) ProcessExtensionServerPolicies( policies []unstructured.Unstructured, gateways []*GatewayContext, routes []RouteContext, resources *resource.Resources, xdsIR resource.XdsIRMap, ) ([]unstructured.Unstructured, error)
func (*Translator) ProcessGRPCFilters ¶ added in v0.3.0
func (t *Translator) ProcessGRPCFilters( parentRef *RouteParentContext, route RouteContext, filters []gwapiv1.GRPCRouteFilter, resources *resource.Resources, xdsIR resource.XdsIRMap, ) (*HTTPFiltersContext, []status.Error)
ProcessGRPCFilters translates gateway api grpc filters to IRs.
func (*Translator) ProcessGRPCRoutes ¶ added in v0.3.0
func (t *Translator) ProcessGRPCRoutes(grpcRoutes []*gwapiv1.GRPCRoute, gateways []*GatewayContext, resources *resource.Resources, xdsIR resource.XdsIRMap) []*GRPCRouteContext
func (*Translator) ProcessGatewayTLS ¶ added in v1.8.0
func (t *Translator) ProcessGatewayTLS(gateways []*GatewayContext, resources *resource.Resources)
func (*Translator) ProcessGlobalResources ¶ added in v1.5.0
func (t *Translator) ProcessGlobalResources(resources *resource.Resources, xdsIRs resource.XdsIRMap, gateways []*GatewayContext) error
ProcessGlobalResources processes global resources that are not tied to a specific listener or route
func (*Translator) ProcessHTTPFilters ¶ added in v0.3.0
func (t *Translator) ProcessHTTPFilters( parentRef *RouteParentContext, route RouteContext, filters []gwapiv1.HTTPRouteFilter, ruleIdx int, resources *resource.Resources, xdsIR resource.XdsIRMap, ) (*HTTPFiltersContext, []status.Error)
ProcessHTTPFilters translates gateway api http filters to IRs.
func (*Translator) ProcessHTTPRoutes ¶
func (t *Translator) ProcessHTTPRoutes(httpRoutes []*gwapiv1.HTTPRoute, gateways []*GatewayContext, resources *resource.Resources, xdsIR resource.XdsIRMap) []*HTTPRouteContext
func (*Translator) ProcessListenerSetStatus ¶ added in v1.8.0
func (t *Translator) ProcessListenerSetStatus(listenerSets []*gwapiv1.ListenerSet, gateways []*GatewayContext)
ProcessListenerSetStatus computes the status of ListenerSets after their listeners have been processed.
func (*Translator) ProcessListenerSets ¶ added in v1.8.0
func (t *Translator) ProcessListenerSets(listenerSets []*gwapiv1.ListenerSet, gateways []*GatewayContext)
func (*Translator) ProcessListeners ¶
func (t *Translator) ProcessListeners(gateways []*GatewayContext, xdsIR resource.XdsIRMap, infraIR resource.InfraIRMap, resources *resource.Resources)
func (*Translator) ProcessSecurityPolicies ¶ added in v0.6.0
func (t *Translator) ProcessSecurityPolicies( securityPolicies []*egv1a1.SecurityPolicy, gateways []*GatewayContext, routes []RouteContext, resources *resource.Resources, xdsIR resource.XdsIRMap, ) []*egv1a1.SecurityPolicy
func (*Translator) ProcessTCPRoutes ¶ added in v0.3.0
func (t *Translator) ProcessTCPRoutes(tcpRoutes []*gwapiv1.TCPRoute, gateways []*GatewayContext, resources *resource.Resources, xdsIR resource.XdsIRMap, ) []*TCPRouteContext
func (*Translator) ProcessTLSRoutes ¶
func (t *Translator) ProcessTLSRoutes(tlsRoutes []*gwapiv1.TLSRoute, gateways []*GatewayContext, resources *resource.Resources, xdsIR resource.XdsIRMap) []*TLSRouteContext
func (*Translator) ProcessUDPRoutes ¶ added in v0.3.0
func (t *Translator) ProcessUDPRoutes(udpRoutes []*gwapiv1.UDPRoute, gateways []*GatewayContext, resources *resource.Resources, xdsIR resource.XdsIRMap, ) []*UDPRouteContext
func (*Translator) Translate ¶
func (t *Translator) Translate(resources *resource.Resources) (*TranslateResult, error)
type TranslatorContext ¶ added in v1.6.7
type TranslatorContext struct {
NamespaceMap map[types.NamespacedName]*corev1.Namespace
ServiceMap map[types.NamespacedName]*corev1.Service
ServiceImportMap map[types.NamespacedName]*mcsapiv1a1.ServiceImport
BackendMap map[types.NamespacedName]*egv1a1.Backend
SecretMap map[types.NamespacedName]*corev1.Secret
ConfigMapMap map[types.NamespacedName]*corev1.ConfigMap
ClusterTrustBundleMap map[types.NamespacedName]*certificatesv1b1.ClusterTrustBundle
EndpointSliceMap map[backendServiceKey][]*discoveryv1.EndpointSlice
BackendClusterMap map[BackendClusterKey]*ir.BackendCluster
BTPRoutingTypeIndex *BTPRoutingTypeIndex
BTPClusterSettingsIndex *BTPClusterSettingsIndex
BTPLoadBalancerIndex *BTPLoadBalancerIndex
CTPClusterSettingsIndex *CTPClusterSettingsIndex
}
func (*TranslatorContext) GetBackend ¶ added in v1.6.7
func (t *TranslatorContext) GetBackend(namespace, name string) *egv1a1.Backend
func (*TranslatorContext) GetClusterTrustBundle ¶ added in v1.6.7
func (t *TranslatorContext) GetClusterTrustBundle(name string) *certificatesv1b1.ClusterTrustBundle
func (*TranslatorContext) GetConfigMap ¶ added in v1.6.7
func (t *TranslatorContext) GetConfigMap(namespace, name string) *corev1.ConfigMap
func (*TranslatorContext) GetEndpointSlicesForBackend ¶ added in v1.6.7
func (t *TranslatorContext) GetEndpointSlicesForBackend(svcNamespace, svcName, backendKind string) []*discoveryv1.EndpointSlice
func (*TranslatorContext) GetNamespace ¶ added in v1.6.7
func (t *TranslatorContext) GetNamespace(name string) *corev1.Namespace
func (*TranslatorContext) GetSecret ¶ added in v1.6.7
func (t *TranslatorContext) GetSecret(namespace, name string) *corev1.Secret
func (*TranslatorContext) GetService ¶ added in v1.6.7
func (t *TranslatorContext) GetService(namespace, name string) *corev1.Service
func (*TranslatorContext) GetServiceImport ¶ added in v1.6.7
func (t *TranslatorContext) GetServiceImport(namespace, name string) *mcsapiv1a1.ServiceImport
func (*TranslatorContext) SetBackends ¶ added in v1.6.7
func (t *TranslatorContext) SetBackends(backends []*egv1a1.Backend)
func (*TranslatorContext) SetClusterTrustBundles ¶ added in v1.6.7
func (t *TranslatorContext) SetClusterTrustBundles(ctbs []*certificatesv1b1.ClusterTrustBundle)
func (*TranslatorContext) SetConfigMaps ¶ added in v1.6.7
func (t *TranslatorContext) SetConfigMaps(configMaps []*corev1.ConfigMap)
func (*TranslatorContext) SetEndpointSlicesForBackend ¶ added in v1.6.7
func (t *TranslatorContext) SetEndpointSlicesForBackend(slices []*discoveryv1.EndpointSlice)
func (*TranslatorContext) SetNamespaces ¶ added in v1.6.7
func (t *TranslatorContext) SetNamespaces(namespaces []*corev1.Namespace)
func (*TranslatorContext) SetSecrets ¶ added in v1.6.7
func (t *TranslatorContext) SetSecrets(secrets []*corev1.Secret)
func (*TranslatorContext) SetServiceImports ¶ added in v1.6.7
func (t *TranslatorContext) SetServiceImports(svcImps []*mcsapiv1a1.ServiceImport)
func (*TranslatorContext) SetServices ¶ added in v1.6.7
func (t *TranslatorContext) SetServices(svcs []*corev1.Service)
type TranslatorManager ¶ added in v0.3.0
type TranslatorManager interface {
Translate(resources *resource.Resources) (*TranslateResult, error)
GetRelevantGateways(resources *resource.Resources) (acceptedGateways, failedGateways []*GatewayContext)
RoutesTranslator
ListenersTranslator
AddressesTranslator
FiltersTranslator
}
type UDPRouteContext ¶ added in v0.3.0
type UDPRouteContext struct {
*gwapiv1.UDPRoute
ParentRefs map[gwapiv1.ParentReference]*RouteParentContext
}
UDPRouteContext wraps a UDPRoute and provides helper methods for accessing the route's parents.
func (*UDPRouteContext) GetHostnames ¶ added in v0.3.0
func (r *UDPRouteContext) GetHostnames() []string
func (*UDPRouteContext) GetParentReferences ¶ added in v0.3.0
func (r *UDPRouteContext) GetParentReferences() []gwapiv1.ParentReference
func (*UDPRouteContext) GetParentRefs ¶ added in v1.5.1
func (r *UDPRouteContext) GetParentRefs() map[gwapiv1.ParentReference]*RouteParentContext
func (*UDPRouteContext) GetRouteParentContext ¶ added in v0.3.0
func (r *UDPRouteContext) GetRouteParentContext(forParentRef gwapiv1.ParentReference) *RouteParentContext
func (*UDPRouteContext) GetRouteStatus ¶ added in v0.3.0
func (r *UDPRouteContext) GetRouteStatus() *gwapiv1.RouteStatus
func (*UDPRouteContext) GetRouteType ¶ added in v0.3.0
func (r *UDPRouteContext) GetRouteType() gwapiv1.Kind
func (*UDPRouteContext) HasRuleNames ¶ added in v1.5.1
func (r *UDPRouteContext) HasRuleNames(sectionName gwapiv1.SectionName) bool
func (*UDPRouteContext) SetRouteParentContext ¶ added in v1.5.1
func (r *UDPRouteContext) SetRouteParentContext(forParentRef gwapiv1.ParentReference, ctx *RouteParentContext)
type XdsIRRoutes ¶
func (XdsIRRoutes) Len ¶
func (x XdsIRRoutes) Len() int
func (XdsIRRoutes) Less ¶
func (x XdsIRRoutes) Less(i, j int) bool
func (XdsIRRoutes) Swap ¶
func (x XdsIRRoutes) Swap(i, j int)
Source Files
¶
- address.go
- backend.go
- backendtlspolicy.go
- backendtrafficpolicy.go
- clienttrafficpolicy.go
- clustersettings.go
- contexts.go
- envoyextensionpolicy.go
- envoypatchpolicy.go
- envoyproxy_merge.go
- ext_service.go
- extensionserverpolicy.go
- filters.go
- globalresources.go
- helpers.go
- http.go
- listener.go
- listenerset.go
- policyindex.go
- route.go
- securitypolicy.go
- sort.go
- tls.go
- translator.go
- validate.go