plugins

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: Apache-2.0 Imports: 65 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidTlsSecret = errors.New("invalid TLS secret")

	InvalidTlsSecretError = func(n, ns string, err error) error {
		return fmt.Errorf("%w %s/%s: %v", ErrInvalidTlsSecret, ns, n, err)
	}

	ErrMissingCACertKey = errors.New("ca.crt key missing")

	ErrInvalidCACertificate = func(n, ns string, err error) error {
		return fmt.Errorf("invalid ca.crt in ConfigMap %s/%s: %v", ns, n, err)
	}
)

Functions

func BackendReferencesFromBackendPolicy

func BackendReferencesFromBackendPolicy(s *agentgateway.BackendFull, app func(ref gwv1.BackendObjectReference))

func BuildBackendRef added in v1.3.0

func BuildBackendRef(ctx PolicyCtx, ref gwv1.BackendObjectReference, defaultNS string) (*api.BackendReference, error)

BuildBackendRef constructs an agentgateway backend reference from a Gateway API backendRef and enforces any configured cross-namespace ReferenceGrant requirements for the policy source in ctx.

func BuildCrossAppAccess added in v1.4.0

func BuildCrossAppAccess(ctx PolicyCtx, auth *agentgateway.CrossAppAccessAuth, namespace string) (*api.CrossAppAccessAuth, error)

func BuildOAuthTokenExchange added in v1.4.0

func BuildOAuthTokenExchange(ctx PolicyCtx, auth *agentgateway.OAuthTokenExchange, namespace string, tokenEndpoint *api.BackendReference) (*api.OAuthTokenExchange, error)

BuildOAuthTokenExchange lowers an OAuth token exchange policy into its xDS representation.

func ClonePoliciesForTarget added in v1.2.0

func ClonePoliciesForTarget(base []*api.Policy, policyTarget *api.PolicyTarget) []*api.Policy

func ConvertStatusCollection added in v1.1.0

func ConvertStatusCollection[T controllers.Object, S any](
	col krt.Collection[krt.ObjectWithStatus[T, S]],
	toOptions func(string) []krt.CollectionOption,
	originalName string,
) krt.StatusCollection[controllers.Object, any]

ConvertStatusCollection converts the specific TrafficPolicy status collection to the generic controllers.Object status collection expected by the interface

func DefaultCredentialResolverFactory added in v1.3.0

func DefaultCredentialResolverFactory(agw *AgwCollections) kubeutils.CredentialResolver

DefaultCredentialResolverFactory returns the default resolver chain.

func DefaultRouteBackend added in v1.1.0

func DefaultRouteBackend(krtctx krt.HandlerContext, agw *AgwCollections, defaultNamespace string, gk schema.GroupKind, name gwv1.ObjectName, namespace *gwv1.Namespace, port *gwv1.PortNumber) (*api.BackendReference, error)

func DefaultString

func DefaultString[T ~string](s *T, def string) string

func ExtractName added in v1.2.0

func GetCACertFromConfigMap added in v1.1.0

func GetCACertFromConfigMap(cm *corev1.ConfigMap) (string, error)

GetCACertFromConfigMap validates and extracts the ca.crt string from a ConfigMap

func IsBackendLikeTarget added in v1.2.0

func IsBackendLikeTarget(policyTarget *api.PolicyTarget) bool

func MergeAncestors added in v1.2.0

func MergeAncestors(controllerName string, existing []gwv1.PolicyAncestorStatus, incoming []gwv1.PolicyAncestorStatus) []gwv1.PolicyAncestorStatus

MergeAncestors merges an existing ancestor with in incoming one. We preserve order, prune stale references set by our controller, and add any new references from our controller.

func ParentRefEquals added in v1.2.0

func ParentRefEquals(a, b gwv1.ParentReference) bool

func PolicyConditionMap added in v1.2.0

func PolicyConditionMap(err error, hasTranslatedPolicies bool) map[string]*Condition

func PolicyOrConditionalSeq added in v1.2.0

func PolicyOrConditionalSeq[T any, P interface {
	agentgateway.ConditionalPolicy[T]
	comparable
}](p P) iter.Seq[T]

PolicyOrConditionalSeq iterates over all concrete policy objects whether conditional or explicit.

func ResourceExists added in v1.2.0

func ResourceExists[T controllers.ComparableObject](krtctx krt.HandlerContext, col krt.Collection[T], key string) bool

func ResourceName

func ResourceName[T config.Namer](o T) *api.ResourceName

func SetAncestorStatus added in v1.2.0

func SetAncestorStatus(
	pr gwv1.ParentReference,
	status *gwv1.PolicyStatus,
	generation int64,
	conds map[string]*Condition,
	controller gwv1.GatewayController,
) gwv1.PolicyAncestorStatus

func TranslateAuthorization added in v1.4.0

func TranslateAuthorization(auth *agentgateway.Authorization) (*api.TrafficPolicySpec_RBAC, error)

TranslateAuthorization converts an Agentgateway authorization policy into the data-plane RBAC representation.

func TranslateCustomProviderBackendRef added in v1.4.0

func TranslateCustomProviderBackendRef(
	krtctx krt.HandlerContext,
	routeBackend RouteBackendResolver,
	namespace string,
	ref agentgateway.LocalBackendObjectReference,
) (*api.BackendReference, error)

TranslateCustomProviderBackendRef validates and resolves a custom-provider backend reference.

func TranslateCustomProviderFormats added in v1.4.0

func TranslateCustomProviderFormats(formats []agentgateway.ProviderFormatConfig) ([]*api.AIBackend_ProviderFormatConfig, error)

TranslateCustomProviderFormats converts Kubernetes custom-provider formats to xDS formats.

func TranslateInlineBackendPolicy

func TranslateInlineBackendPolicy(
	ctx PolicyCtx,
	namespace string,
	policy *agentgateway.BackendFull,
) ([]*api.BackendPolicySpec, error)

func TranslatePolicyToAgw added in v1.2.0

func TranslatePolicyToAgw(
	ctx PolicyCtx,
	policy *agentgateway.AgentgatewayPolicy,
) ([]*api.Policy, error)

TranslatePolicyToAgw converts a TrafficPolicy to agentgateway Policy resources

func TypedResourceFromName

func TypedResourceFromName(typ string, o types.NamespacedName) *api.TypedResourceName

func TypedResourceName

func TypedResourceName[T config.Namer](typ string, o T) *api.TypedResourceName

func ValidateTlsSecretData added in v1.1.0

func ValidateTlsSecretData(n, ns string, sslSecretData map[string][]byte) (cleanedCertChain string, err error)

Types

type APIKeyEntry

type APIKeyEntry struct {
	Key      string          `json:"key"`
	KeyHash  string          `json:"keyHash"`
	Metadata json.RawMessage `json:"metadata"`
}

type AddResourcesPlugin

type AddResourcesPlugin struct {
	Binds            krt.Collection[ir.AgwResource]
	Listeners        krt.Collection[ir.AgwResource]
	Routes           krt.Collection[ir.AgwResource]
	AncestorBackends krt.Collection[*utils.AncestorBackend]
	GatewayStatuses  krt.StatusCollection[*gwv1.Gateway, gwv1.GatewayStatus]
	// ParentResolvers contribute additional parent resolution logic to the
	// main route pipeline.
	ParentResolvers []ParentResolver
}

type AgwCollections

type AgwCollections struct {
	OurClient kgwversioned.Interface
	Client    apiclient.Client
	KrtOpts   krtutil.KrtOptions
	Settings  apisettings.Settings

	GatewaysForDeployer krt.Collection[collections.GatewayForDeployer]

	// Core Kubernetes resources
	Namespaces            krt.Collection[*corev1.Namespace]
	Nodes                 krt.Collection[*corev1.Node]
	Pods                  krt.Collection[*corev1.Pod]
	Services              krt.Collection[*corev1.Service]
	ServicesByNamespace   krt.Index[string, *corev1.Service]
	Secrets               krt.Collection[*corev1.Secret]
	SecretsByNamespace    krt.Index[string, *corev1.Secret]
	ConfigMaps            krt.Collection[*corev1.ConfigMap]
	ConfigMapsByNamespace krt.Index[string, *corev1.ConfigMap]
	EndpointSlices        krt.Collection[*discovery.EndpointSlice]

	// Istio resources for ambient mesh
	WorkloadEntries krt.Collection[*networkingclient.WorkloadEntry]
	ServiceEntries  krt.Collection[*networkingclient.ServiceEntry]
	MeshConfig      krt.Singleton[ambient.MeshConfig]

	// Gateway API resources
	GatewayClasses          krt.Collection[*gwv1.GatewayClass]
	Gateways                krt.Collection[*gwv1.Gateway]
	GatewaysByNamespace     krt.Index[string, *gwv1.Gateway]
	HTTPRoutes              krt.Collection[*gwv1.HTTPRoute]
	HTTPRoutesByNamespace   krt.Index[string, *gwv1.HTTPRoute]
	GRPCRoutes              krt.Collection[*gwv1.GRPCRoute]
	GRPCRoutesByNamespace   krt.Index[string, *gwv1.GRPCRoute]
	TCPRoutes               krt.Collection[*gwv1.TCPRoute]
	TLSRoutes               krt.Collection[*gwv1.TLSRoute]
	ReferenceGrants         krt.Collection[*gwv1b1.ReferenceGrant]
	BackendTLSPolicies      krt.Collection[*gwv1.BackendTLSPolicy]
	ListenerSets            krt.Collection[*gwv1.ListenerSet]
	ListenerSetsByNamespace krt.Index[string, *gwv1.ListenerSet]

	// Extended resources
	InferencePools            krt.Collection[*inf.InferencePool]
	InferencePoolsByNamespace krt.Index[string, *inf.InferencePool]

	// agentgateway resources
	Backends             krt.Collection[*agentgateway.AgentgatewayBackend]
	BackendsByNamespace  krt.Index[string, *agentgateway.AgentgatewayBackend]
	Models               krt.Collection[*agentgateway.AgentgatewayModel]
	ModelsByNamespace    krt.Index[string, *agentgateway.AgentgatewayModel]
	AgentgatewayPolicies krt.Collection[*agentgateway.AgentgatewayPolicy]

	// ControllerName is the name of the Gateway controller.
	ControllerName string
	// SystemNamespace is control plane system namespace (default is agentgateway-system)
	SystemNamespace string
	// IstioNamespace is the Istio control plane namespace (default is istio-system)
	IstioNamespace string
	// IstioRevision is the Istio revision of the Istio control plane (default is "default").
	IstioRevision string
	// IstioAutoEnabled turns on Istio integration by default for built-in-class gateways
	IstioAutoEnabled bool
	// IstioClusterId / IstioNetwork / IstioCaAddress are control-plane-wide mesh values.
	// Gateway that have istio enabled will have them propagated on envs when deployed.
	IstioClusterId string
	IstioNetwork   string
	IstioCaAddress string
}

func NewAgwCollections

func NewAgwCollections(
	krtOptions krtutil.KrtOptions,
	client apiclient.Client,
	agwControllerName string,
	settings apisettings.Settings,
	systemNamespace string,
) (*AgwCollections, error)

NewAgwCollections initializes the core krt collections. Collections that rely on plugins aren't initialized here, and InitPlugins must be called.

func (*AgwCollections) HasSynced added in v1.1.0

func (c *AgwCollections) HasSynced() bool

func (*AgwCollections) SetupIndexes

func (c *AgwCollections) SetupIndexes()

type AgwPlugin

type AgwPlugin struct {
	AddResourceExtension *AddResourcesPlugin
	ContributesPolicies  map[schema.GroupKind]PolicyPlugin
	ContributesBackends  map[schema.GroupKind]BackendPlugin
}

func MergePlugins

func MergePlugins(plug ...AgwPlugin) AgwPlugin

func NewA2APlugin

func NewA2APlugin(agw *AgwCollections) AgwPlugin

NewA2APlugin creates a new A2A policy plugin

func NewAgentPlugin

func NewAgentPlugin(agw *AgwCollections, resolver remotehttp.Resolver, jwksLookup jwks.Lookup, credentialResolver kubeutils.CredentialResolver) AgwPlugin

NewAgentPlugin creates a new AgentgatewayPolicy plugin

func NewBackendTLSPlugin

func NewBackendTLSPlugin(agw *AgwCollections) AgwPlugin

NewBackendTLSPlugin creates a new BackendTLSPolicy plugin

func NewBackendTLSPluginWithTargetBuilders added in v1.3.0

func NewBackendTLSPluginWithTargetBuilders(agw *AgwCollections, targetBuilders map[schema.GroupKind]BackendTLSTargetBuilder) AgwPlugin

NewBackendTLSPluginWithTargetBuilders creates a BackendTLSPolicy plugin with additional supported target kinds.

func NewInferencePlugin

func NewInferencePlugin(agw *AgwCollections) AgwPlugin

NewInferencePlugin creates a new InferencePool policy plugin

type AgwPolicy

type AgwPolicy struct {
	Gateway *types.NamespacedName
	Policy  *api.Policy
}

AgwPolicy wraps an Agw policy for collection handling

func TranslateAgentgatewayPolicy

func TranslateAgentgatewayPolicy(
	ctx krt.HandlerContext,
	policy *agentgateway.AgentgatewayPolicy,
	agw *AgwCollections,
	references ReferenceIndex,
	grants ReferenceGrantChecker,
	resolver remotehttp.Resolver,
	jwksLookup jwks.Lookup,
	credentialResolver kubeutils.CredentialResolver,
) (*gwv1.PolicyStatus, []AgwPolicy)

TranslateAgentgatewayPolicy generates policies for a single traffic policy

func (AgwPolicy) Equals

func (p AgwPolicy) Equals(in AgwPolicy) bool

func (AgwPolicy) ResourceName

func (p AgwPolicy) ResourceName() string

type BackendPlugin added in v1.1.0

type BackendPlugin struct {
	Build           func(PolicyPluginInput) (krt.StatusCollection[controllers.Object, any], krt.Collection[ir.AgwResource])
	BuildReferences func() krt.Collection[*PolicyAttachment]
}

type BackendReferenceError added in v1.1.0

type BackendReferenceError struct {
	Reason  BackendReferenceErrorReason
	Message string
}

func (*BackendReferenceError) Error added in v1.1.0

func (e *BackendReferenceError) Error() string

type BackendReferenceErrorReason added in v1.1.0

type BackendReferenceErrorReason string
const (
	BackendReferenceErrorReasonBackendNotFound  BackendReferenceErrorReason = "BackendNotFound"
	BackendReferenceErrorReasonInvalidKind      BackendReferenceErrorReason = "InvalidKind"
	BackendReferenceErrorReasonUnsupportedValue BackendReferenceErrorReason = "UnsupportedValue"
)

type BackendTLSTargetBuilder added in v1.3.0

type BackendTLSTargetBuilder func(namespace string, target gwv1.LocalPolicyTargetReferenceWithSectionName) *api.PolicyTarget

BackendTLSTargetBuilder builds an agentgateway policy target for an extension kind supported by BackendTLSPolicy.

type Condition added in v1.2.0

type Condition struct {
	// Reason defines the Reason to report on success. Ignored if error is set
	Reason string
	// Message defines the Message to report on success. Ignored if error is set
	Message string
	// Status defines the Status to report on success. The inverse will be set if error is set
	// If not set, will default to StatusTrue
	Status metav1.ConditionStatus
	// Error defines an Error state; the Reason and Message will be replaced with that of the Error and
	// the Status inverted
	Error *ConfigError
	// SetOnce, if enabled, will only set the Condition if it is not yet present or set to this Reason
	SetOnce string
}

type ConfigError

type ConfigError struct {
	Reason  string
	Message string
}

ConfigError represents an invalid configuration that will be reported back to the user.

type CredentialResolverFactory added in v1.3.0

type CredentialResolverFactory func(*AgwCollections) kubeutils.CredentialResolver

CredentialResolverFactory builds the complete credential resolver chain for policy translation.

type ParentInfo added in v1.1.0

type ParentInfo struct {
	ParentGateway          types.NamespacedName
	ParentGatewayClassName string
	// ListenerKey is the internal key of the listener resource created for this parent.
	ListenerKey string
	// ServiceKey (optionally) links a parent reference to an individual Service.
	ServiceKey *types.NamespacedName
	// ServicePorts are the ports on the ServiceKey; a route referencing a port not
	// in this list is rejected. Distinct from Port, which is for single-port listeners.
	ServicePorts []gwv1.PortNumber
	// AllowedKinds indicates which kinds can be admitted by this Parent.
	AllowedKinds []gwv1.RouteGroupKind
	// Hostnames that must match to reference the Parent. Format is ns/hostname.
	Hostnames []string
	// OriginalHostname is the unprocessed form of Hostnames; how it appeared in users' config.
	OriginalHostname string
	// CreationTimestamp is used in determining listener precedence.
	CreationTimestamp metav1.Time

	SectionName    gwv1.SectionName
	Port           gwv1.PortNumber
	Protocol       gwv1.ProtocolType
	TLSPassthrough bool
	// Internal marks this listener's bind as internal (routing-only): no OS listener
	// socket, no Service port, no container port. Sourced from the agentgateway.dev/internal-ports
	// annotation on the listener's parent Gateway or ListenerSet.
	Internal bool
}

ParentInfo holds info about a "Parent" - something that can be referenced as a ParentRef in the API.

func (ParentInfo) Equals added in v1.1.0

func (g ParentInfo) Equals(other ParentInfo) bool

type ParentResolver added in v1.1.0

type ParentResolver interface {
	ParentsFor(ctx krt.HandlerContext, pk utils.TypedNamespacedName) []*ParentInfo
}

ParentResolver resolves parent references for routes.

type PolicyAttachment

type PolicyAttachment struct {
	Target  utils.TypedNamespacedName
	Backend utils.TypedNamespacedName
	Source  utils.TypedNamespacedName
}

func BackendReferencesFromPolicy

func BackendReferencesFromPolicy(
	ctx krt.HandlerContext,
	policy *agentgateway.AgentgatewayPolicy,
	references ReferenceIndex,
	agw *AgwCollections,
	grants ReferenceGrantChecker,
) []*PolicyAttachment

BackendReferencesFromPolicy only emits attachments for existing, unsectioned targets to prevent phantom chains and section-scoped over-attachment.

func BackendReferencesFromPolicyForSource added in v1.3.0

func BackendReferencesFromPolicyForSource(
	ctx krt.HandlerContext,
	policy *agentgateway.AgentgatewayPolicy,
	references ReferenceIndex,
	agw *AgwCollections,
	grants ReferenceGrantChecker,
	sourceGVK schema.GroupVersionKind,
) []*PolicyAttachment

BackendReferencesFromPolicyForSource emits policy backend attachments using sourceGVK as the policy kind for ReferenceGrant checks and attachment source metadata.

func (PolicyAttachment) Equals

func (a PolicyAttachment) Equals(other PolicyAttachment) bool

func (PolicyAttachment) ResourceName

func (a PolicyAttachment) ResourceName() string

type PolicyCtx

type PolicyCtx struct {
	Krt         krt.HandlerContext
	Collections *AgwCollections
	References  ReferenceIndex
	Grants      ReferenceGrantChecker
	SourceGVK   schema.GroupVersionKind
	Resolver    remotehttp.Resolver
	JWKSLookup  jwks.Lookup

	// CredentialResolver resolves credential refs: the built-in Secret resolver
	// in OSS, or an injected resolver (which may itself be a chain). Access it
	// through ResolveCredentialRef, which is nil-safe.
	CredentialResolver kubeutils.CredentialResolver

	// RouteBackend resolves references emitted by route-like resources that
	// inline backend policies without participating in policy attachment.
	RouteBackend RouteBackendResolver
}

func (PolicyCtx) PolicySourceGVK added in v1.3.0

func (ctx PolicyCtx) PolicySourceGVK() schema.GroupVersionKind

PolicySourceGVK returns the Kubernetes kind that should be used as the ReferenceGrant "from" kind for backend refs emitted while translating this policy.

func (PolicyCtx) ResolveCredentialKeyRef added in v1.4.0

func (ctx PolicyCtx) ResolveCredentialKeyRef(ref agentgateway.LocalSecretKeyRef, namespace, defaultKey string) (map[string][]byte, string, error)

ResolveCredentialKeyRef resolves a credential ref and returns the key to read, using defaultKey when the ref does not override it.

func (PolicyCtx) ResolveCredentialRef added in v1.3.0

func (ctx PolicyCtx) ResolveCredentialRef(ref agentgateway.LocalSecretObjectRef, namespace string) (map[string][]byte, error)

ResolveCredentialRef applies the context's credential resolver.

type PolicyPlugin

type PolicyPlugin struct {
	Build func(PolicyPluginInput) (krt.StatusCollection[controllers.Object, any], krt.Collection[AgwPolicy])
	// BuildReferences is called with the base ReferenceIndex (before PolicyAttachments)
	// to avoid self-referential graph construction.
	BuildReferences func(input PolicyPluginInput) krt.Collection[*PolicyAttachment]
}

type PolicyPluginInput

type PolicyPluginInput struct {
	References ReferenceIndex
	Grants     ReferenceGrantChecker
}

type ReferenceGrantChecker added in v1.3.0

type ReferenceGrantChecker interface {
	SecretAllowed(ctx krt.HandlerContext, kind schema.GroupVersionKind, secret types.NamespacedName, namespace string) bool
	BackendAllowed(
		ctx krt.HandlerContext,
		k schema.GroupVersionKind,
		backendName gwv1b1.ObjectName,
		backendNamespace gwv1b1.Namespace,
		sourceNamespace string,
		refKind schema.GroupKind,
		mode apisettings.BackendRefGrantMode,
	) bool
}

type ReferenceIndex

type ReferenceIndex struct {
	// Backend --> Gateway via Route
	Ancestors krt.IndexCollection[utils.TypedNamespacedName, *utils.AncestorBackend]
	// Backend --> Target via Policy
	PolicyAttachments krt.IndexCollection[utils.TypedNamespacedName, *PolicyAttachment]
	// contains filtered or unexported fields
}

func BuildReferenceIndex

BuildReferenceIndex builds a set of indexes that can lookup objects through various means. For example, lookup associated Gateways for a Backend.

func (ReferenceIndex) LookupGatewaysForBackend

func (p ReferenceIndex) LookupGatewaysForBackend(ctx krt.HandlerContext, object utils.TypedNamespacedName) sets.Set[types.NamespacedName]

func (ReferenceIndex) LookupGatewaysForPolicyTarget added in v1.2.0

func (p ReferenceIndex) LookupGatewaysForPolicyTarget(ctx krt.HandlerContext, object utils.TypedNamespacedName, policyTarget *api.PolicyTarget) sets.Set[types.NamespacedName]

TODO: PolicyAttachment and AncestorBackend are keyed by root object only (no port/section). This means section-scoped targets (e.g. svc-a:9090 vs svc-a:8080) chain identically in the recursive graph, causing over-attachment. A follow-up should add section-aware indexing to support scoped recursive chaining without over-attachment.

func (ReferenceIndex) LookupGatewaysForTarget

func (p ReferenceIndex) LookupGatewaysForTarget(ctx krt.HandlerContext, object utils.TypedNamespacedName) sets.Set[types.NamespacedName]

func (ReferenceIndex) PolicyBackend added in v1.1.0

func (p ReferenceIndex) PolicyBackend(krtctx krt.HandlerContext, defaultNamespace string, gk schema.GroupKind, name gwv1.ObjectName, namespace *gwv1.Namespace, port *gwv1.PortNumber) (*api.BackendReference, error)

func (ReferenceIndex) PolicyTarget added in v1.1.0

func (p ReferenceIndex) PolicyTarget(krtctx krt.HandlerContext, namespace string, name gwv1.ObjectName, gk schema.GroupKind, sectionName *gwv1.SectionName, port *gwv1.PortNumber) ([]*api.PolicyTarget, bool)

func (ReferenceIndex) PolicyTargetsBySelector added in v1.2.0

func (p ReferenceIndex) PolicyTargetsBySelector(krtctx krt.HandlerContext, policyNamespace string, selector agentgateway.LocalPolicyTargetSelectorWithSectionName) []ResolvedPolicySelectorTarget

func (ReferenceIndex) RouteBackend added in v1.1.0

func (p ReferenceIndex) RouteBackend(krtctx krt.HandlerContext, defaultNamespace string, gk schema.GroupKind, name gwv1.ObjectName, namespace *gwv1.Namespace, port *gwv1.PortNumber) (*api.BackendReference, error)

func (ReferenceIndex) WithListenerSetAttachments added in v1.2.0

func (p ReferenceIndex) WithListenerSetAttachments(references krt.IndexCollection[utils.TypedNamespacedName, *RouteAttachment]) ReferenceIndex

func (ReferenceIndex) WithPolicyAttachments

type ReferenceTypes added in v1.1.0

type ReferenceTypes struct {
	// KnownFromReferences is the set of GroupKinds this controller understands
	// as ReferenceGrant from entries.
	KnownFromReferences sets.Set[schema.GroupKind]
	// KnownToReferences is the set of GroupKinds this controller understands as
	// ReferenceGrant to entries. Extension authors must add their kinds here
	// when they need ReferenceGrant permission checks to recognize those targets.
	KnownToReferences       sets.Set[schema.GroupKind]
	PolicyTargets           func(krtctx krt.HandlerContext, namespace string, name gwv1.ObjectName, gk schema.GroupKind, sectionName *gwv1.SectionName, port *gwv1.PortNumber) ([]*api.PolicyTarget, bool)
	PolicyTargetsBySelector func(krtctx krt.HandlerContext, policyNamespace string, selector agentgateway.LocalPolicyTargetSelectorWithSectionName) []ResolvedPolicySelectorTarget
	PolicyBackend           func(krtctx krt.HandlerContext, defaultNamespace string, gk schema.GroupKind, name gwv1.ObjectName, namespace *gwv1.Namespace, port *gwv1.PortNumber) (*api.BackendReference, error)
	RouteBackend            func(krtctx krt.HandlerContext, defaultNamespace string, gk schema.GroupKind, name gwv1.ObjectName, namespace *gwv1.Namespace, port *gwv1.PortNumber) (*api.BackendReference, error)
	AllowedParentReferences sets.Set[schema.GroupKind]
}

func DefaultReferenceTypes added in v1.1.0

func DefaultReferenceTypes(agw *AgwCollections) ReferenceTypes

type ResolvedPolicySelectorTarget added in v1.2.0

type ResolvedPolicySelectorTarget struct {
	Name          gwv1.ObjectName
	Namespace     string
	PolicyTargets []*api.PolicyTarget
}

type ResolvedTarget

type ResolvedTarget struct {
	AgentgatewayTarget *api.PolicyTarget
	GatewayTargets     []types.NamespacedName
	AncestorRefs       []gwv1.ParentReference
	AttachmentError    string
}

type RouteAttachment

type RouteAttachment struct {
	// Route
	From utils.TypedNamespacedName
	// Immediate parent (Gateway or ListenerSet)
	To           utils.TypedNamespacedName
	ListenerName string
	// Eventual parent (always Gateway)
	Gateway types.NamespacedName
}

func (RouteAttachment) Equals

func (r RouteAttachment) Equals(other RouteAttachment) bool

func (RouteAttachment) ResourceName

func (r RouteAttachment) ResourceName() string

type RouteBackendResolver added in v1.4.0

type RouteBackendResolver func(
	krtctx krt.HandlerContext,
	defaultNamespace string,
	gk schema.GroupKind,
	name gwv1.ObjectName,
	namespace *gwv1.Namespace,
	port *gwv1.PortNumber,
) (*api.BackendReference, error)

RouteBackendResolver resolves a backend reference from a route-like resource.

Jump to

Keyboard shortcuts

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