v1beta1

package
v0.6.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package v1beta1 contains API schema definitions for the aigateway.envoyproxy.io API group. This is the beta version of the API, preferred over v1alpha1 for new resources.

+kubebuilder:object:generate=true +groupName=aigateway.envoyproxy.io +k8s:deepcopy-gen=package +k8s:defaulter-gen=TypeMeta +k8s:openapi-gen=true

Index

Constants

View Source
const (
	// ConditionTypeAccepted is a condition type for the reconciliation result
	// where resources are accepted.
	ConditionTypeAccepted = "Accepted"
	// ConditionTypeNotAccepted is a condition type for the reconciliation result
	// where resources are not accepted.
	ConditionTypeNotAccepted = "NotAccepted"
)
View Source
const (
	// AIGatewayFilterMetadataNamespace is the namespace for the ai-gateway filter metadata.
	AIGatewayFilterMetadataNamespace = "io.envoy.ai_gateway"
)
View Source
const (
	// AIModelHeaderKey is the header key whose value is extracted from the request by the ai-gateway.
	// This can be used to describe the routing behavior in HTTPRoute referenced by AIGatewayRoute.
	AIModelHeaderKey = "x-ai-eg-model"
)
View Source
const GroupName = "aigateway.envoyproxy.io"

Variables

View Source
var (
	// SchemeGroupVersion is group version used to register these objects.
	SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta1"}

	// SchemeBuilder is used to add go types to the GroupVersionKind scheme.
	SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion}

	// AddToScheme adds the types in this group-version to the given scheme.
	AddToScheme = SchemeBuilder.AddToScheme
)

Functions

func AddKnownTypes

func AddKnownTypes(scheme *runtime.Scheme) error

AddKnownTypes adds the list of known types to the given scheme for code generation.

func Resource

func Resource(resource string) schema.GroupResource

Resource takes an unqualified resource and returns a Group qualified GroupResource

Types

type AIGatewayRoute

type AIGatewayRoute struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	// Spec defines the details of the AIGatewayRoute.
	Spec AIGatewayRouteSpec `json:"spec,omitempty"`
	// Status defines the status details of the AIGatewayRoute.
	Status AIGatewayRouteStatus `json:"status,omitempty"`
}

AIGatewayRoute combines multiple AIServiceBackends and attaching them to Gateway(s) resources.

This serves as a way to define a "unified" AI API for a Gateway which allows downstream clients to use a single schema API to interact with multiple AI backends.

Envoy AI Gateway will generate the following k8s resources corresponding to the AIGatewayRoute:

  • HTTPRoute of the Gateway API as a top-level resource to bind all backends. The name of the HTTPRoute is the same as the AIGatewayRoute.
  • HTTPRouteFilter of the Envoy Gateway API per namespace for automatic hostname rewrite. The name of the HTTPRouteFilter is `ai-eg-host-rewrite-${AIGatewayRoute.Name}`.

All of these resources are created in the same namespace as the AIGatewayRoute. Note that this is the implementation detail subject to change. If you want to customize the default behavior of the Envoy AI Gateway, you can use these resources as a reference and create your own resources. Alternatively, you can use EnvoyPatchPolicy API of the Envoy Gateway to patch the generated resources. For example, you can configure the retry fallback behavior by attaching BackendTrafficPolicy API of Envoy Gateway to the generated HTTPRoute.

+genclient +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +kubebuilder:object:root=true +kubebuilder:subresource:status +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.conditions[-1:].type` +kubebuilder:storageversion

func (*AIGatewayRoute) DeepCopy

func (in *AIGatewayRoute) DeepCopy() *AIGatewayRoute

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AIGatewayRoute.

func (*AIGatewayRoute) DeepCopyInto

func (in *AIGatewayRoute) DeepCopyInto(out *AIGatewayRoute)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*AIGatewayRoute) DeepCopyObject

func (in *AIGatewayRoute) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type AIGatewayRouteList

type AIGatewayRouteList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []AIGatewayRoute `json:"items"`
}

AIGatewayRouteList contains a list of AIGatewayRoute.

+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +kubebuilder:object:root=true

func (*AIGatewayRouteList) DeepCopy

func (in *AIGatewayRouteList) DeepCopy() *AIGatewayRouteList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AIGatewayRouteList.

func (*AIGatewayRouteList) DeepCopyInto

func (in *AIGatewayRouteList) DeepCopyInto(out *AIGatewayRouteList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*AIGatewayRouteList) DeepCopyObject

func (in *AIGatewayRouteList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type AIGatewayRouteRule

type AIGatewayRouteRule struct {
	// BackendRefs is the list of backends that this rule will route the traffic to.
	// Each backend can have a weight that determines the traffic distribution.
	//
	// The namespace of each backend defaults to the same namespace as the AIGatewayRoute when not specified.
	// Cross-namespace references are supported by specifying the namespace field.
	// When a namespace different than the AIGatewayRoute's namespace is specified,
	// a ReferenceGrant object is required in the referent namespace to allow that
	// namespace's owner to accept the reference.
	//
	// BackendRefs can reference either AIServiceBackend resources (default) or InferencePool resources
	// from the Gateway API Inference Extension. When referencing InferencePool resources:
	// - Only one InferencePool backend is allowed per rule
	// - Cannot mix InferencePool with AIServiceBackend references in the same rule
	// - Fallback behavior is handled by the InferencePool's endpoint picker
	//
	// For AIServiceBackend references, you can achieve fallback behavior by configuring multiple backends
	// combined with the BackendTrafficPolicy of Envoy Gateway.
	// Please refer to https://gateway.envoyproxy.io/docs/tasks/traffic/failover/ as well as
	// https://gateway.envoyproxy.io/docs/tasks/traffic/retry/.
	//
	// +optional
	// +kubebuilder:validation:MaxItems=128
	BackendRefs []AIGatewayRouteRuleBackendRef `json:"backendRefs,omitempty"`

	// Matches is the list of AIGatewayRouteMatch that this rule will match the traffic to.
	// This is a subset of the HTTPRouteMatch in the Gateway API. See for the details:
	// https://gateway-api.sigs.k8s.io/reference/spec/#gateway.networking.k8s.io%2fv1.HTTPRouteMatch
	//
	// +optional
	// +kubebuilder:validation:MaxItems=128
	Matches []AIGatewayRouteRuleMatch `json:"matches,omitempty"`

	// Timeouts defines the timeouts that can be configured for an HTTP request.
	//
	// If this field is not set, or the timeout.requestTimeout is nil, Envoy AI Gateway defaults to
	// set 60s for the request timeout as opposed to 15s of the Envoy Gateway's default value.
	//
	// For streaming responses (like chat completions with stream=true), consider setting
	// longer timeouts as the response may take time until the completion.
	//
	// +optional
	Timeouts *gwapiv1.HTTPRouteTimeouts `json:"timeouts,omitempty"`

	// ModelsOwnedBy represents the owner of the running models serving by the backends,
	// which will be exported as the field of "OwnedBy" in openai-compatible API "/models".
	//
	// This is used only when this rule contains "x-ai-eg-model" in its header matching
	// where the header value will be recognized as a "model" in "/models" endpoint.
	// All the matched models will share the same owner.
	//
	// Default to "Envoy AI Gateway" if not set.
	//
	// +optional
	// +kubebuilder:default="Envoy AI Gateway"
	ModelsOwnedBy *string `json:"modelsOwnedBy,omitempty"`

	// ModelsCreatedAt represents the creation timestamp of the running models serving by the backends,
	// which will be exported as the field of "Created" in openai-compatible API "/models".
	// It follows the format of RFC 3339, for example "2024-05-21T10:00:00Z".
	//
	// This is used only when this rule contains "x-ai-eg-model" in its header matching
	// where the header value will be recognized as a "model" in "/models" endpoint.
	// All the matched models will share the same creation time.
	//
	// Default to the creation timestamp of the AIGatewayRoute if not set.
	//
	// +optional
	// +kubebuilder:validation:Format=date-time
	ModelsCreatedAt *metav1.Time `json:"modelsCreatedAt,omitempty"`
}

AIGatewayRouteRule is a rule that defines the routing behavior of the AIGatewayRoute.

+kubebuilder:validation:XValidation:rule="!has(self.backendRefs) || size(self.backendRefs) == 0 || (self.backendRefs.all(ref, !has(ref.group) && !has(ref.kind)) || self.backendRefs.all(ref, has(ref.group) && has(ref.kind)))", message="cannot mix InferencePool and AIServiceBackend references in the same rule" +kubebuilder:validation:XValidation:rule="!has(self.backendRefs) || size(self.backendRefs) == 0 || !self.backendRefs.exists(ref, has(ref.group) && has(ref.kind)) || size(self.backendRefs) == 1", message="only one InferencePool backend is allowed per rule"

func (*AIGatewayRouteRule) DeepCopy

func (in *AIGatewayRouteRule) DeepCopy() *AIGatewayRouteRule

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AIGatewayRouteRule.

func (*AIGatewayRouteRule) DeepCopyInto

func (in *AIGatewayRouteRule) DeepCopyInto(out *AIGatewayRouteRule)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*AIGatewayRouteRule) GetTimeoutsOrDefault

func (r *AIGatewayRouteRule) GetTimeoutsOrDefault() *gwapiv1.HTTPRouteTimeouts

GetTimeoutsOrDefault returns the timeouts with default values applied when not specified. This ensures that AI Gateway routes have appropriate timeout defaults for AI workloads.

func (*AIGatewayRouteRule) HasAIServiceBackends

func (r *AIGatewayRouteRule) HasAIServiceBackends() bool

HasAIServiceBackends returns true if the rule contains any AIServiceBackend references.

func (*AIGatewayRouteRule) HasInferencePoolBackends

func (r *AIGatewayRouteRule) HasInferencePoolBackends() bool

HasInferencePoolBackends returns true if the rule contains any InferencePool backend references.

type AIGatewayRouteRuleBackendRef

type AIGatewayRouteRuleBackendRef struct {
	// Name is the name of the backend resource.
	// When Group and Kind are not specified, this refers to an AIServiceBackend.
	// When Group and Kind are specified, this refers to the resource of the specified type.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MinLength=1
	Name string `json:"name"`

	// Namespace is the namespace of the backend resource.
	// When unspecified (or empty string), this refers to the local namespace of the AIGatewayRoute.
	//
	// Note that when a namespace different than the local namespace is specified,
	// a ReferenceGrant object is required in the referent namespace to allow that
	// namespace's owner to accept the reference. See the ReferenceGrant
	// documentation for details.
	//
	// +optional
	Namespace *gwapiv1.Namespace `json:"namespace,omitempty"`

	// Group is the group of the backend resource.
	// When not specified, defaults to aigateway.envoyproxy.io (AIServiceBackend).
	// Currently, only "inference.networking.k8s.io" is supported for InferencePool resources.
	//
	// +optional
	// +kubebuilder:validation:MaxLength=253
	// +kubebuilder:validation:Pattern=`^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$`
	Group *string `json:"group,omitempty"`

	// Kind is the kind of the backend resource.
	// When not specified, defaults to AIServiceBackend.
	// Currently, only "InferencePool" is supported when Group is specified.
	//
	// +optional
	// +kubebuilder:validation:MaxLength=63
	// +kubebuilder:validation:Pattern=`^$|^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$`
	Kind *string `json:"kind,omitempty"`

	// Name of the model in the backend. If provided this will override the name provided in the request.
	// This field is ignored when referencing InferencePool resources.
	//
	// +optional
	ModelNameOverride string `json:"modelNameOverride,omitempty"`

	// HeaderMutation defines the request header mutation to be applied to this backend.
	// When both route-level and backend-level HeaderMutation are defined,
	// route-level takes precedence over backend-level for conflicting operations.
	// This field is ignored when referencing InferencePool resources.
	//
	// +optional
	HeaderMutation *HTTPHeaderMutation `json:"headerMutation,omitempty"`

	// BodyMutation defines the request body mutation to be applied to this backend.
	// This allows modification of JSON fields in the request body before sending to the backend.
	// When both route-level and backend-level BodyMutation are defined,
	// route-level takes precedence over backend-level for conflicting operations.
	// This field is ignored when referencing InferencePool resources.
	//
	// +optional
	BodyMutation *HTTPBodyMutation `json:"bodyMutation,omitempty"`

	// Weight is the weight of the backend. This is exactly the same as the weight in
	// the BackendRef in the Gateway API. See for the details:
	// https://gateway-api.sigs.k8s.io/reference/spec/#gateway.networking.k8s.io%2fv1.BackendRef
	//
	// Default is 1.
	//
	// +optional
	// +kubebuilder:validation:Minimum=0
	// +kubebuilder:default=1
	Weight *int32 `json:"weight,omitempty"`
	// Priority is the priority of the backend. This sets the priority on the underlying endpoints.
	// See: https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/upstream/load_balancing/priority
	// Note: This will override the `faillback` property of the underlying Envoy Gateway Backend
	// This field is ignored when referencing InferencePool resources.
	//
	// Default is 0.
	//
	// +optional
	// +kubebuilder:validation:Minimum=0
	// +kubebuilder:default=0
	Priority *uint32 `json:"priority,omitempty"`
}

AIGatewayRouteRuleBackendRef is a reference to a backend with a weight. It can reference either an AIServiceBackend or an InferencePool resource.

+kubebuilder:validation:XValidation:rule="!has(self.group) && !has(self.kind) || (has(self.group) && has(self.kind))", message="group and kind must be specified together" +kubebuilder:validation:XValidation:rule="!has(self.group) || (self.group == 'inference.networking.k8s.io' && self.kind == 'InferencePool')", message="only InferencePool from inference.networking.k8s.io group is supported"

func (*AIGatewayRouteRuleBackendRef) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AIGatewayRouteRuleBackendRef.

func (*AIGatewayRouteRuleBackendRef) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*AIGatewayRouteRuleBackendRef) GetNamespace

func (ref *AIGatewayRouteRuleBackendRef) GetNamespace(defaultNamespace string) string

GetNamespace returns the namespace for the backend reference. If the namespace is not specified, it returns the provided defaultNamespace.

func (*AIGatewayRouteRuleBackendRef) IsAIServiceBackend

func (ref *AIGatewayRouteRuleBackendRef) IsAIServiceBackend() bool

IsAIServiceBackend returns true if the backend reference points to an AIServiceBackend resource.

func (*AIGatewayRouteRuleBackendRef) IsCrossNamespace

func (ref *AIGatewayRouteRuleBackendRef) IsCrossNamespace(routeNamespace string) bool

IsCrossNamespace returns true if the backend reference is a cross-namespace reference. A cross-namespace reference is one where the namespace field is specified and differs from the routeNamespace.

func (*AIGatewayRouteRuleBackendRef) IsInferencePool

func (ref *AIGatewayRouteRuleBackendRef) IsInferencePool() bool

IsInferencePool returns true if the backend reference points to an InferencePool resource.

type AIGatewayRouteRuleMatch

type AIGatewayRouteRuleMatch struct {
	// Headers specifies HTTP request header matchers. See HeaderMatch in the Gateway API for the details:
	// https://gateway-api.sigs.k8s.io/reference/spec/#gateway.networking.k8s.io%2fv1.HTTPHeaderMatch
	//
	// +listType=map
	// +listMapKey=name
	// +optional
	// +kubebuilder:validation:MaxItems=16
	Headers []gwapiv1.HTTPHeaderMatch `json:"headers,omitempty"`
}

func (*AIGatewayRouteRuleMatch) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AIGatewayRouteRuleMatch.

func (*AIGatewayRouteRuleMatch) DeepCopyInto

func (in *AIGatewayRouteRuleMatch) DeepCopyInto(out *AIGatewayRouteRuleMatch)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type AIGatewayRouteSpec

type AIGatewayRouteSpec struct {
	// ParentRefs are the names of the Gateway resources this AIGatewayRoute is being attached to.
	// Currently, each reference's Kind must be Gateway.
	//
	// +kubebuilder:validation:MaxItems=16
	// +kubebuilder:validation:XValidation:rule="self.all(match, match.kind == 'Gateway')", message="only Gateway is supported"
	//
	// +optional
	ParentRefs []gwapiv1.ParentReference `json:"parentRefs,omitempty"`

	// Rules is the list of AIGatewayRouteRule that this AIGatewayRoute will match the traffic to.
	// Each rule is a subset of the HTTPRoute in the Gateway API (https://gateway-api.sigs.k8s.io/api-types/httproute/).
	//
	// AI Gateway controller will generate a HTTPRoute based on the configuration given here with the additional
	// modifications to achieve the necessary jobs, notably inserting the AI Gateway filter responsible for
	// the transformation of the request and response, etc.
	//
	// In the matching conditions in the AIGatewayRouteRule, `x-ai-eg-model` header is available
	// if we want to describe the routing behavior based on the model name. The model name is extracted
	// from the request content before the routing decision.
	//
	// How multiple rules are matched is the same as the Gateway API. See for the details:
	// https://gateway-api.sigs.k8s.io/reference/spec/#gateway.networking.k8s.io%2fv1.HTTPRoute
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MaxItems=128
	Rules []AIGatewayRouteRule `json:"rules"`

	// LLMRequestCosts specifies how to capture the cost of the LLM-related request, notably the token usage.
	// The AI Gateway filter will capture each specified number and store it in the Envoy's dynamic
	// metadata per HTTP request. The namespaced key is "io.envoy.ai_gateway".
	//
	// These route-level costs override any global defaults defined in GatewayConfig.Spec.GlobalLLMRequestCosts
	// for the same metadataKey. If a metadataKey is not defined in either place, no cost is calculated for it.
	//
	// This allows you to define common cost formulas once at the gateway level (e.g., via GatewayConfig)
	// and only override them in specific routes when needed (e.g., premium routes with different pricing).
	//
	// For example, let's say we have the following LLMRequestCosts configuration:
	// “`yaml
	//	llmRequestCosts:
	//	- metadataKey: llm_input_token
	//	  type: InputToken
	//	- metadataKey: llm_output_token
	//	  type: OutputToken
	//	- metadataKey: llm_total_token
	//	  type: TotalToken
	//	- metadataKey: llm_cached_input_token
	//	  type: CachedInputToken
	// - metadataKey: llm_cache_creation_input_token
	//    type: CacheCreationInputToken
	// “`
	// Then, with the following BackendTrafficPolicy of Envoy Gateway, you can have three
	// rate limit buckets for each unique x-tenant-id header value. One bucket is for the input token,
	// the other is for the output token, and the last one is for the total token.
	// Each bucket will be reduced by the corresponding token usage captured by the AI Gateway filter.
	//
	// “`yaml
	//	apiVersion: gateway.envoyproxy.io/v1alpha1
	//	kind: BackendTrafficPolicy
	//	metadata:
	//	  name: some-example-token-rate-limit
	//	  namespace: default
	//	spec:
	//	  targetRefs:
	//	  - group: gateway.networking.k8s.io
	//	     kind: HTTPRoute
	//	     name: usage-rate-limit
	//	  rateLimit:
	//	    type: Global
	//	    global:
	//	      rules:
	//	        - clientSelectors:
	//	            # Do the rate limiting based on the x-tenant-id header.
	//	            - headers:
	//	                - name: x-tenant-id
	//	                  type: Distinct
	//	          limit:
	//	            # Configures the number of "tokens" allowed per hour.
	//	            requests: 10000
	//	            unit: Hour
	//	          cost:
	//	            request:
	//	              from: Number
	//	              # Setting the request cost to zero allows to only check the rate limit budget,
	//	              # and not consume the budget on the request path.
	//	              number: 0
	//	            # This specifies the cost of the response retrieved from the dynamic metadata set by the AI Gateway filter.
	//	            # The extracted value will be used to consume the rate limit budget, and subsequent requests will be rate limited
	//	            # if the budget is exhausted.
	//	            response:
	//	              from: Metadata
	//	              metadata:
	//	                namespace: io.envoy.ai_gateway
	//	                key: llm_input_token
	//	        - clientSelectors:
	//	            - headers:
	//	                - name: x-tenant-id
	//	                  type: Distinct
	//	          limit:
	//	            requests: 10000
	//	            unit: Hour
	//	          cost:
	//	            request:
	//	              from: Number
	//	              number: 0
	//	            response:
	//	              from: Metadata
	//	              metadata:
	//	                namespace: io.envoy.ai_gateway
	//	                key: llm_output_token
	//	        - clientSelectors:
	//	            - headers:
	//	                - name: x-tenant-id
	//	                  type: Distinct
	//	          limit:
	//	            requests: 10000
	//	            unit: Hour
	//	          cost:
	//	            request:
	//	              from: Number
	//	              number: 0
	//	            response:
	//	              from: Metadata
	//	              metadata:
	//	                namespace: io.envoy.ai_gateway
	//	                key: llm_total_token
	// “`
	//
	// Note that when multiple AIGatewayRoute resources are attached to the same Gateway, and
	// different costs are configured for the same metadata key, each route's rule is carried in
	// the filter configuration with the route identity; the data plane selects the matching rule
	// per request (by route), so each route can define its own cost for the same metadata key.
	//
	// +optional
	// +kubebuilder:validation:MaxItems=36
	LLMRequestCosts []LLMRequestCost `json:"llmRequestCosts,omitempty"`
}

AIGatewayRouteSpec details the AIGatewayRoute configuration.

func (*AIGatewayRouteSpec) DeepCopy

func (in *AIGatewayRouteSpec) DeepCopy() *AIGatewayRouteSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AIGatewayRouteSpec.

func (*AIGatewayRouteSpec) DeepCopyInto

func (in *AIGatewayRouteSpec) DeepCopyInto(out *AIGatewayRouteSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type AIGatewayRouteStatus

type AIGatewayRouteStatus struct {
	// Conditions is the list of conditions by the reconciliation result.
	// Currently, at most one condition is set.
	//
	// Known .status.conditions.type are: "Accepted", "NotAccepted".
	Conditions []metav1.Condition `json:"conditions,omitempty"`
}

AIGatewayRouteStatus contains the conditions by the reconciliation result.

func (*AIGatewayRouteStatus) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AIGatewayRouteStatus.

func (*AIGatewayRouteStatus) DeepCopyInto

func (in *AIGatewayRouteStatus) DeepCopyInto(out *AIGatewayRouteStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type AIServiceBackend

type AIServiceBackend struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	// Spec defines the details of AIServiceBackend.
	Spec AIServiceBackendSpec `json:"spec,omitempty"`
	// Status defines the status details of the AIServiceBackend.
	Status AIServiceBackendStatus `json:"status,omitempty"`
}

AIServiceBackend is a resource that represents a single backend for AIGatewayRoute. A backend is a service that handles traffic with a concrete API specification.

A AIServiceBackend is "attached" to a Backend which is either a k8s Service or a Backend resource of the Envoy Gateway.

When a backend with an attached AIServiceBackend is used as a routing target in the AIGatewayRoute (more precisely, the HTTPRouteSpec defined in the AIGatewayRoute), the ai-gateway will generate the necessary configuration to do the backend specific logic in the final HTTPRoute.

+genclient +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +kubebuilder:object:root=true +kubebuilder:subresource:status +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.conditions[-1:].type` +kubebuilder:storageversion

func (*AIServiceBackend) DeepCopy

func (in *AIServiceBackend) DeepCopy() *AIServiceBackend

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AIServiceBackend.

func (*AIServiceBackend) DeepCopyInto

func (in *AIServiceBackend) DeepCopyInto(out *AIServiceBackend)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*AIServiceBackend) DeepCopyObject

func (in *AIServiceBackend) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type AIServiceBackendList

type AIServiceBackendList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []AIServiceBackend `json:"items"`
}

AIServiceBackendList contains a list of AIServiceBackends.

+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +kubebuilder:object:root=true

func (*AIServiceBackendList) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AIServiceBackendList.

func (*AIServiceBackendList) DeepCopyInto

func (in *AIServiceBackendList) DeepCopyInto(out *AIServiceBackendList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*AIServiceBackendList) DeepCopyObject

func (in *AIServiceBackendList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type AIServiceBackendSpec

type AIServiceBackendSpec struct {
	// APISchema specifies the API schema of the output format of requests from
	// Envoy that this AIServiceBackend can accept as incoming requests.
	// Based on this schema, the ai-gateway will perform the necessary transformation for
	// the pair of AIGatewayRouteSpec.APISchema and AIServiceBackendSpec.APISchema.
	//
	// This is required to be set.
	//
	// +kubebuilder:validation:Required
	APISchema VersionedAPISchema `json:"schema"`
	// BackendRef is the reference to the Backend resource that this AIServiceBackend corresponds to.
	//
	// A backend must be a Backend resource of Envoy Gateway. Note that k8s Service will be supported
	// as a backend in the future. See https://github.com/envoyproxy/ai-gateway/issues/902 for more details.
	//
	// This is required to be set.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:XValidation:rule="has(self.kind) && self.kind == 'Backend' && has(self.group) && self.group == 'gateway.envoyproxy.io'",message="BackendRef must be a Backend resource of Envoy Gateway. See https://github.com/envoyproxy/ai-gateway/issues/902 for more details."
	BackendRef gwapiv1.BackendObjectReference `json:"backendRef"`

	// HeaderMutation defines the mutation of HTTP headers that will be applied to the request
	// before sending it to the backend.
	// +optional
	HeaderMutation *HTTPHeaderMutation `json:"headerMutation,omitempty"`

	// BodyMutation defines the mutation of HTTP request body JSON fields that will be applied to the request
	// before sending it to the backend.
	// +optional
	BodyMutation *HTTPBodyMutation `json:"bodyMutation,omitempty"`
}

AIServiceBackendSpec details the AIServiceBackend configuration.

func (*AIServiceBackendSpec) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AIServiceBackendSpec.

func (*AIServiceBackendSpec) DeepCopyInto

func (in *AIServiceBackendSpec) DeepCopyInto(out *AIServiceBackendSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type AIServiceBackendStatus

type AIServiceBackendStatus struct {
	// Conditions is the list of conditions by the reconciliation result.
	// Currently, at most one condition is set.
	//
	// Known .status.conditions.type are: "Accepted", "NotAccepted".
	Conditions []metav1.Condition `json:"conditions,omitempty"`
}

AIServiceBackendStatus contains the conditions by the reconciliation result.

func (*AIServiceBackendStatus) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AIServiceBackendStatus.

func (*AIServiceBackendStatus) DeepCopyInto

func (in *AIServiceBackendStatus) DeepCopyInto(out *AIServiceBackendStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type APISchema

type APISchema string

APISchema defines the API schema.

const (
	// APISchemaOpenAI is the OpenAI schema.
	//
	// https://github.com/openai/openai-openapi
	APISchemaOpenAI APISchema = "OpenAI"
	// APISchemaCohere is the Cohere schema.
	//
	// https://docs.cohere.com/v2
	APISchemaCohere APISchema = "Cohere"
	// APISchemaAWSBedrock is the AWS Bedrock schema.
	//
	// https://docs.aws.amazon.com/bedrock/latest/APIReference/API_Operations_Amazon_Bedrock_Runtime.html
	APISchemaAWSBedrock APISchema = "AWSBedrock"
	// APISchemaAzureOpenAI APISchemaAzure is the Azure OpenAI schema.
	//
	// https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#api-specs
	APISchemaAzureOpenAI APISchema = "AzureOpenAI"
	// APISchemaGCPVertexAI is the schema followed by Gemini models hosted on GCP's Vertex AI platform.
	// Note: Using this schema requires a BackendSecurityPolicy to be configured and attached,
	// as the transformation will use the gcp-region and project-name from the BackendSecurityPolicy.
	//
	// https://cloud.google.com/vertex-ai/docs/reference/rest/v1/projects.locations.endpoints/generateContent?hl=en
	APISchemaGCPVertexAI APISchema = "GCPVertexAI"
	// APISchemaGCPAnthropic is the schema for Anthropic models hosted on GCP's Vertex AI platform.
	// Returns native Anthropic format responses for seamless integration.
	//
	// https://docs.anthropic.com/en/api/claude-on-vertex-ai
	APISchemaGCPAnthropic APISchema = "GCPAnthropic"
	// APISchemaAnthropic is the native Anthropic API schema.
	// https://docs.claude.com/en/home
	APISchemaAnthropic APISchema = "Anthropic"
	// APISchemaAWSAnthropic is the schema for Anthropic models hosted on AWS Bedrock.
	// Uses the native Anthropic Messages API format for requests and responses.
	// When used with /v1/chat/completions endpoint, translates OpenAI format to Anthropic.
	// When used with /v1/messages endpoint, passes through native Anthropic format.
	//
	// https://aws.amazon.com/bedrock/anthropic/
	// https://docs.claude.com/en/api/claude-on-amazon-bedrock
	APISchemaAWSAnthropic APISchema = "AWSAnthropic"
)

type AWSCredentialsFile

type AWSCredentialsFile struct {
	// SecretRef is the reference to the credential file.
	//
	// The secret should contain the AWS credentials file keyed on "credentials".
	SecretRef *gwapiv1.SecretObjectReference `json:"secretRef"`

	// Profile is the profile to use in the credentials file.
	//
	// +kubebuilder:default=default
	Profile string `json:"profile,omitempty"`
}

AWSCredentialsFile specifies the credentials file to use for the AWS provider. Envoy reads the secret file, and the profile to use is specified by the Profile field.

func (*AWSCredentialsFile) DeepCopy

func (in *AWSCredentialsFile) DeepCopy() *AWSCredentialsFile

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSCredentialsFile.

func (*AWSCredentialsFile) DeepCopyInto

func (in *AWSCredentialsFile) DeepCopyInto(out *AWSCredentialsFile)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type AWSOIDCExchangeToken

type AWSOIDCExchangeToken struct {
	// BackendSecurityPolicyOIDC is the generic OIDC fields.
	BackendSecurityPolicyOIDC `json:",inline"`

	// AwsRoleArn is the AWS IAM Role with the permission to use specific resources in AWS account
	// which maps to the temporary AWS security credentials exchanged using the authentication token issued by OIDC provider.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MinLength=1
	AwsRoleArn string `json:"awsRoleArn"`
}

AWSOIDCExchangeToken specifies credentials to obtain oidc token from a sso server. For AWS, the controller will query STS to obtain AWS AccessKeyId, SecretAccessKey, and SessionToken, and store them in a temporary credentials file.

func (*AWSOIDCExchangeToken) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AWSOIDCExchangeToken.

func (*AWSOIDCExchangeToken) DeepCopyInto

func (in *AWSOIDCExchangeToken) DeepCopyInto(out *AWSOIDCExchangeToken)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type AzureOIDCExchangeToken

type AzureOIDCExchangeToken struct {
	// BackendSecurityPolicyOIDC is the generic OIDC fields.
	BackendSecurityPolicyOIDC `json:",inline"`
}

AzureOIDCExchangeToken specifies credentials to obtain oidc token from a sso server. For Azure, the controller will query Azure Entra ID to get an Azure Access Token, and store them in a secret.

func (*AzureOIDCExchangeToken) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureOIDCExchangeToken.

func (*AzureOIDCExchangeToken) DeepCopyInto

func (in *AzureOIDCExchangeToken) DeepCopyInto(out *AzureOIDCExchangeToken)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type BackendSecurityPolicy

type BackendSecurityPolicy struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	Spec              BackendSecurityPolicySpec `json:"spec,omitempty"`
	// Status defines the status details of the BackendSecurityPolicy.
	Status BackendSecurityPolicyStatus `json:"status,omitempty"`
}

BackendSecurityPolicy specifies configuration for authentication and authorization rules on the traffic exiting the gateway to the backend.

+genclient +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +kubebuilder:object:root=true +kubebuilder:subresource:status +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.conditions[-1:].type` +kubebuilder:metadata:labels="gateway.networking.k8s.io/policy=direct" +kubebuilder:storageversion

func (*BackendSecurityPolicy) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendSecurityPolicy.

func (*BackendSecurityPolicy) DeepCopyInto

func (in *BackendSecurityPolicy) DeepCopyInto(out *BackendSecurityPolicy)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*BackendSecurityPolicy) DeepCopyObject

func (in *BackendSecurityPolicy) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type BackendSecurityPolicyAPIKey

type BackendSecurityPolicyAPIKey struct {
	// SecretRef is the reference to the secret containing the API key.
	// ai-gateway must be given the permission to read this secret.
	// The key of the secret should be "apiKey".
	SecretRef *gwapiv1.SecretObjectReference `json:"secretRef"`
}

BackendSecurityPolicyAPIKey specifies the API key.

func (*BackendSecurityPolicyAPIKey) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendSecurityPolicyAPIKey.

func (*BackendSecurityPolicyAPIKey) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type BackendSecurityPolicyAWSCredentials

type BackendSecurityPolicyAWSCredentials struct {
	// Region specifies the AWS region associated with the policy.
	//
	// +kubebuilder:validation:MinLength=1
	Region string `json:"region"`

	// CredentialsFile specifies the credentials file to use for the AWS provider.
	// When specified, this takes precedence over the default credential chain.
	//
	// +optional
	CredentialsFile *AWSCredentialsFile `json:"credentialsFile,omitempty"`

	// OIDCExchangeToken specifies the oidc configurations used to obtain an oidc token. The oidc token will be
	// used to obtain temporary credentials to access AWS.
	// When specified, this takes precedence over the default credential chain.
	//
	// +optional
	OIDCExchangeToken *AWSOIDCExchangeToken `json:"oidcExchangeToken,omitempty"`
}

BackendSecurityPolicyAWSCredentials contains the supported authentication mechanisms to access AWS.

When neither CredentialsFile nor OIDCExchangeToken is specified, the AWS SDK's default credential chain will be used. This automatically supports various authentication methods in the following order:

  1. Environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN)
  2. EKS Pod Identity - automatically rotates credentials for pods in EKS clusters
  3. IAM Roles for Service Accounts (IRSA) - injects credentials via mounted service account tokens
  4. EC2 instance metadata (IAM instance roles)
  5. ECS task roles

The default credential chain is recommended for Kubernetes deployments as it supports automatic credential rotation without manual configuration. Credentials are refreshed automatically when they approach expiration (typically hourly for IRSA and Pod Identity).

func (*BackendSecurityPolicyAWSCredentials) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendSecurityPolicyAWSCredentials.

func (*BackendSecurityPolicyAWSCredentials) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type BackendSecurityPolicyAnthropicAPIKey

type BackendSecurityPolicyAnthropicAPIKey struct {
	// SecretRef is the reference to the secret containing the Anthropic API key.
	// ai-gateway must be given the permission to read this secret.
	// The key of the secret should be "apiKey".
	SecretRef *gwapiv1.SecretObjectReference `json:"secretRef"`
}

BackendSecurityPolicyAnthropicAPIKey specifies the Anthropic API key.

func (*BackendSecurityPolicyAnthropicAPIKey) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendSecurityPolicyAnthropicAPIKey.

func (*BackendSecurityPolicyAnthropicAPIKey) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type BackendSecurityPolicyAzureAPIKey

type BackendSecurityPolicyAzureAPIKey struct {
	// SecretRef is the reference to the secret containing the Azure API key.
	// ai-gateway must be given the permission to read this secret.
	// The key of the secret should be "apiKey".
	SecretRef *gwapiv1.SecretObjectReference `json:"secretRef"`
}

BackendSecurityPolicyAzureAPIKey specifies the Azure OpenAI API key.

func (*BackendSecurityPolicyAzureAPIKey) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendSecurityPolicyAzureAPIKey.

func (*BackendSecurityPolicyAzureAPIKey) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type BackendSecurityPolicyAzureCredentials

type BackendSecurityPolicyAzureCredentials struct {
	// ClientID is a unique identifier for an application in Azure.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MinLength=1
	ClientID string `json:"clientID"`

	// TenantId is a unique identifier for an Azure Active Directory instance.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MinLength=1
	TenantID string `json:"tenantID"`

	// ClientSecretRef is the reference to the secret containing the Azure client secret.
	// ai-gateway must be given the permission to read this secret.
	// The key of secret should be "client-secret".
	//
	// +optional
	ClientSecretRef *gwapiv1.SecretObjectReference `json:"clientSecretRef,omitempty"`

	// OIDCExchangeToken specifies the oidc configurations used to obtain an oidc token. The oidc token will be
	// used to obtain temporary credentials to access Azure.
	//
	// +optional
	OIDCExchangeToken *AzureOIDCExchangeToken `json:"oidcExchangeToken,omitempty"`
}

BackendSecurityPolicyAzureCredentials contains the supported authentication mechanisms to access Azure. Only one of ClientSecretRef or OIDCExchangeToken must be specified. Credentials will not be generated if neither are set.

+kubebuilder:validation:XValidation:rule="(has(self.clientSecretRef) && !has(self.oidcExchangeToken)) || (!has(self.clientSecretRef) && has(self.oidcExchangeToken))",message="Exactly one of clientSecretRef or oidcExchangeToken must be specified"

func (*BackendSecurityPolicyAzureCredentials) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendSecurityPolicyAzureCredentials.

func (*BackendSecurityPolicyAzureCredentials) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type BackendSecurityPolicyGCPCredentials

type BackendSecurityPolicyGCPCredentials struct {
	// ProjectName is the GCP project name.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MinLength=1
	ProjectName string `json:"projectName"`
	// Region is the GCP region associated with the policy.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MinLength=1
	Region string `json:"region"`

	// CredentialsFile specifies the service account credentials file to use for the GCP provider.
	//
	// +optional
	CredentialsFile *GCPCredentialsFile `json:"credentialsFile,omitempty"`

	// WorkloadIdentityFederationConfig is the configuration for the GCP Workload Identity Federation.
	//
	// +optional
	WorkloadIdentityFederationConfig *GCPWorkloadIdentityFederationConfig `json:"workloadIdentityFederationConfig,omitempty"`
}

BackendSecurityPolicyGCPCredentials contains the supported authentication mechanisms to access GCP.

When neither CredentialsFile nor WorkloadIdentityFederationConfig is specified, Application Default Credentials (ADC) will be used. This supports GKE Workload Identity, environment variables, and default service account credentials when running on GCP.

+kubebuilder:validation:XValidation:rule="!(has(self.credentialsFile) && has(self.workloadIdentityFederationConfig))",message="At most one of credentialsFile or workloadIdentityFederationConfig may be specified"

func (*BackendSecurityPolicyGCPCredentials) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendSecurityPolicyGCPCredentials.

func (*BackendSecurityPolicyGCPCredentials) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type BackendSecurityPolicyList

type BackendSecurityPolicyList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []BackendSecurityPolicy `json:"items"`
}

BackendSecurityPolicyList contains a list of BackendSecurityPolicy

+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +kubebuilder:object:root=true

func (*BackendSecurityPolicyList) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendSecurityPolicyList.

func (*BackendSecurityPolicyList) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*BackendSecurityPolicyList) DeepCopyObject

func (in *BackendSecurityPolicyList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type BackendSecurityPolicyOIDC

type BackendSecurityPolicyOIDC struct {
	// OIDC is used to obtain oidc tokens via an SSO server which will be used to exchange for provider credentials.
	//
	// +kubebuilder:validation:Required
	OIDC egv1a1.OIDC `json:"oidc"`

	// GrantType is the method application gets access token.
	//
	// +optional
	GrantType string `json:"grantType,omitempty"`

	// Aud defines the audience that this ID Token is intended for.
	//
	// +optional
	Aud string `json:"aud,omitempty"`
}

BackendSecurityPolicyOIDC specifies OIDC related fields.

func (*BackendSecurityPolicyOIDC) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendSecurityPolicyOIDC.

func (*BackendSecurityPolicyOIDC) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type BackendSecurityPolicySpec

type BackendSecurityPolicySpec struct {
	// TargetRefs are the names of the AIServiceBackend or InferencePool resources this BackendSecurityPolicy is being attached to.
	// Attaching multiple BackendSecurityPolicies to the same resource is invalid and will result in an error
	// during the reconciliation of the resource.
	//
	// +optional
	// +kubebuilder:validation:MaxItems=16
	// +kubebuilder:validation:XValidation:rule="self.all(ref, (ref.group == 'aigateway.envoyproxy.io' && ref.kind == 'AIServiceBackend') || (ref.group == 'inference.networking.k8s.io' && ref.kind == 'InferencePool'))", message="targetRefs must reference AIServiceBackend or InferencePool resources"
	TargetRefs []gwapiv1a2.LocalPolicyTargetReference `json:"targetRefs,omitempty"`

	// Type specifies the type of the backend security policy.
	//
	// +kubebuilder:validation:Enum=APIKey;AWSCredentials;AzureAPIKey;AzureCredentials;GCPCredentials;AnthropicAPIKey
	Type BackendSecurityPolicyType `json:"type"`

	// APIKey is a mechanism to access a backend(s). The API key will be injected into the Authorization header.
	//
	// +optional
	APIKey *BackendSecurityPolicyAPIKey `json:"apiKey,omitempty"`

	// AWSCredentials is a mechanism to access a backend(s). AWS specific logic will be applied.
	//
	// +optional
	AWSCredentials *BackendSecurityPolicyAWSCredentials `json:"awsCredentials,omitempty"`

	// AzureAPIKey is a mechanism to access Azure OpenAI backend(s). The API key will be injected into the api-key header.
	//
	// +optional
	AzureAPIKey *BackendSecurityPolicyAzureAPIKey `json:"azureAPIKey,omitempty"`

	// AzureCredentials is a mechanism to access a backend(s). Azure OpenAI specific logic will be applied.
	//
	// +optional
	AzureCredentials *BackendSecurityPolicyAzureCredentials `json:"azureCredentials,omitempty"`

	// GCPCredentials is a mechanism to access a backend(s). GCP specific logic will be applied.
	//
	// +optional
	GCPCredentials *BackendSecurityPolicyGCPCredentials `json:"gcpCredentials,omitempty"`

	// AnthropicAPIKey is a mechanism to access Anthropic backend(s). The API key will be injected into the "x-api-key" header.
	// https://docs.claude.com/en/api/overview#authentication
	//
	// +optional
	AnthropicAPIKey *BackendSecurityPolicyAnthropicAPIKey `json:"anthropicAPIKey,omitempty"`
}

BackendSecurityPolicySpec specifies authentication rules on access the provider from the Gateway. Only one mechanism to access a backend(s) can be specified.

Only one type of BackendSecurityPolicy can be defined. +kubebuilder:validation:MaxProperties=3 +kubebuilder:validation:XValidation:rule="self.type == 'APIKey' ? (has(self.apiKey) && !has(self.awsCredentials) && !has(self.azureAPIKey) && !has(self.azureCredentials) && !has(self.gcpCredentials) && !has(self.anthropicAPIKey)) : true",message="When type is APIKey, only apiKey field should be set" +kubebuilder:validation:XValidation:rule="self.type == 'AWSCredentials' ? (has(self.awsCredentials) && !has(self.apiKey) && !has(self.azureAPIKey) && !has(self.azureCredentials) && !has(self.gcpCredentials) && !has(self.anthropicAPIKey)) : true",message="When type is AWSCredentials, only awsCredentials field should be set" +kubebuilder:validation:XValidation:rule="self.type == 'AzureAPIKey' ? (has(self.azureAPIKey) && !has(self.apiKey) && !has(self.awsCredentials) && !has(self.azureCredentials) && !has(self.gcpCredentials) && !has(self.anthropicAPIKey)) : true",message="When type is AzureAPIKey, only azureAPIKey field should be set" +kubebuilder:validation:XValidation:rule="self.type == 'AzureCredentials' ? (has(self.azureCredentials) && !has(self.apiKey) && !has(self.awsCredentials) && !has(self.azureAPIKey) && !has(self.gcpCredentials) && !has(self.anthropicAPIKey)) : true",message="When type is AzureCredentials, only azureCredentials field should be set" +kubebuilder:validation:XValidation:rule="self.type == 'GCPCredentials' ? (has(self.gcpCredentials) && !has(self.apiKey) && !has(self.awsCredentials) && !has(self.azureAPIKey) && !has(self.azureCredentials) && !has(self.anthropicAPIKey)) : true",message="When type is GCPCredentials, only gcpCredentials field should be set" +kubebuilder:validation:XValidation:rule="self.type == 'AnthropicAPIKey' ? (has(self.anthropicAPIKey) && !has(self.apiKey) && !has(self.awsCredentials) && !has(self.azureAPIKey) && !has(self.azureCredentials) && !has(self.gcpCredentials)) : true",message="When type is AnthropicAPIKey, only anthropicAPIKey field should be set"

func (*BackendSecurityPolicySpec) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendSecurityPolicySpec.

func (*BackendSecurityPolicySpec) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type BackendSecurityPolicyStatus

type BackendSecurityPolicyStatus struct {
	// Conditions is the list of conditions by the reconciliation result.
	// Currently, at most one condition is set.
	//
	// Known .status.conditions.type are: "Accepted", "NotAccepted".
	Conditions []metav1.Condition `json:"conditions,omitempty"`
}

BackendSecurityPolicyStatus contains the conditions by the reconciliation result.

func (*BackendSecurityPolicyStatus) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackendSecurityPolicyStatus.

func (*BackendSecurityPolicyStatus) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type BackendSecurityPolicyType

type BackendSecurityPolicyType string

BackendSecurityPolicyType specifies the type of auth mechanism used to access a backend.

const (
	BackendSecurityPolicyTypeAPIKey           BackendSecurityPolicyType = "APIKey"
	BackendSecurityPolicyTypeAWSCredentials   BackendSecurityPolicyType = "AWSCredentials"
	BackendSecurityPolicyTypeAzureAPIKey      BackendSecurityPolicyType = "AzureAPIKey"
	BackendSecurityPolicyTypeAnthropicAPIKey  BackendSecurityPolicyType = "AnthropicAPIKey" // #nosec G101
	BackendSecurityPolicyTypeAzureCredentials BackendSecurityPolicyType = "AzureCredentials"
	BackendSecurityPolicyTypeGCPCredentials   BackendSecurityPolicyType = "GCPCredentials"
)

type GCPCredentialsFile

type GCPCredentialsFile struct {
	// SecretRef is the reference to the credential file.
	//
	// The secret should contain the GCP service account credentials file keyed on "service_account.json".
	SecretRef *gwapiv1.SecretObjectReference `json:"secretRef"`
}

GCPCredentialsFile specifies the service account key json file to authenticate with GCP provider.

func (*GCPCredentialsFile) DeepCopy

func (in *GCPCredentialsFile) DeepCopy() *GCPCredentialsFile

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GCPCredentialsFile.

func (*GCPCredentialsFile) DeepCopyInto

func (in *GCPCredentialsFile) DeepCopyInto(out *GCPCredentialsFile)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type GCPOIDCExchangeToken

type GCPOIDCExchangeToken struct {
	// BackendSecurityPolicyOIDC is the generic OIDC fields.
	BackendSecurityPolicyOIDC `json:",inline"`
}

func (*GCPOIDCExchangeToken) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GCPOIDCExchangeToken.

func (*GCPOIDCExchangeToken) DeepCopyInto

func (in *GCPOIDCExchangeToken) DeepCopyInto(out *GCPOIDCExchangeToken)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type GCPServiceAccountImpersonationConfig

type GCPServiceAccountImpersonationConfig struct {
	// ServiceAccountName is the name of the service account to impersonate.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MinLength=1
	ServiceAccountName string `json:"serviceAccountName"`
}

func (*GCPServiceAccountImpersonationConfig) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GCPServiceAccountImpersonationConfig.

func (*GCPServiceAccountImpersonationConfig) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type GCPWorkloadIdentityFederationConfig

type GCPWorkloadIdentityFederationConfig struct {
	// ProjectID is the GCP project ID.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MinLength=1
	ProjectID string `json:"projectID"`

	// WorkloadIdentityProviderName is the name of the external identity provider as registered on Google Cloud Platform.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MinLength=1
	WorkloadIdentityProviderName string `json:"workloadIdentityProviderName"`

	// OIDCExchangeToken specifies the oidc configurations used to obtain an oidc token. The oidc token will be
	// used to obtain temporary credentials to access GCP.
	//
	// +kubebuilder:validation:Required
	OIDCExchangeToken GCPOIDCExchangeToken `json:"oidcExchangeToken"`

	// WorkloadIdentityPoolName is the name of the workload identity pool defined in GCP.
	// https://cloud.google.com/iam/docs/workload-identity-federation?hl=en
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MinLength=1
	WorkloadIdentityPoolName string `json:"workloadIdentityPoolName"`

	// ServiceAccountImpersonation is the service account impersonation configuration.
	// This is used to impersonate a service account when getting access token.
	//
	// +optional
	ServiceAccountImpersonation *GCPServiceAccountImpersonationConfig `json:"serviceAccountImpersonation,omitempty"`
}

func (*GCPWorkloadIdentityFederationConfig) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GCPWorkloadIdentityFederationConfig.

func (*GCPWorkloadIdentityFederationConfig) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type GCPWorkloadIdentityProvider

type GCPWorkloadIdentityProvider struct {
	// Name of the external identity provider as registered on Google Cloud Platform.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MinLength=1
	Name string `json:"name"`

	// OIDCProvider is the generic OIDCProvider fields.
	//
	// +kubebuilder:validation:Required
	OIDCProvider BackendSecurityPolicyOIDC `json:"OIDCProvider"`
}

GCPWorkloadIdentityProvider specifies the external identity provider to be used to authenticate against GCP. The external identity provider can be AWS, Microsoft, etc but must be pre-registered in the GCP project

https://cloud.google.com/iam/docs/workload-identity-federation

func (*GCPWorkloadIdentityProvider) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GCPWorkloadIdentityProvider.

func (*GCPWorkloadIdentityProvider) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type GatewayConfig

type GatewayConfig struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	// Spec defines the configuration for the external processor.
	Spec GatewayConfigSpec `json:"spec,omitempty"`
	// Status defines the status of the GatewayConfig.
	Status GatewayConfigStatus `json:"status,omitempty"`
}

GatewayConfig provides configuration for the AI Gateway external processor container that is deployed alongside the Gateway.

A GatewayConfig is referenced by a Gateway via the annotation "aigateway.envoyproxy.io/gateway-config". The GatewayConfig must be in the same namespace as the Gateway that references it.

This allows gateway-level configuration of the external processor, including environment variables (e.g., for tracing configuration) and resource requirements.

Multiple Gateways can reference the same GatewayConfig to share configuration.

Environment Variable Precedence: When merging environment variables, the following precedence applies (highest to lowest):

  1. GatewayConfig.Spec.ExtProc.Kubernetes.Env (this resource)
  2. Global controller flags (extProcExtraEnvVars)

If the same environment variable name exists in both sources, the GatewayConfig value takes precedence.

+genclient +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +kubebuilder:object:root=true +kubebuilder:subresource:status +kubebuilder:resource:shortName=gwconfig +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.conditions[-1:].type` +kubebuilder:storageversion

func (*GatewayConfig) DeepCopy

func (in *GatewayConfig) DeepCopy() *GatewayConfig

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatewayConfig.

func (*GatewayConfig) DeepCopyInto

func (in *GatewayConfig) DeepCopyInto(out *GatewayConfig)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*GatewayConfig) DeepCopyObject

func (in *GatewayConfig) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type GatewayConfigExtProc

type GatewayConfigExtProc struct {
	// Kubernetes defines the configuration for running the external processor as a Kubernetes container.
	//
	// +optional
	Kubernetes *egv1a1.KubernetesContainerSpec `json:"kubernetes,omitempty"`
}

GatewayConfigExtProc holds runtime-specific configuration for the external processor.

func (*GatewayConfigExtProc) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatewayConfigExtProc.

func (*GatewayConfigExtProc) DeepCopyInto

func (in *GatewayConfigExtProc) DeepCopyInto(out *GatewayConfigExtProc)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type GatewayConfigList

type GatewayConfigList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []GatewayConfig `json:"items"`
}

GatewayConfigList contains a list of GatewayConfig.

+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +kubebuilder:object:root=true

func (*GatewayConfigList) DeepCopy

func (in *GatewayConfigList) DeepCopy() *GatewayConfigList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatewayConfigList.

func (*GatewayConfigList) DeepCopyInto

func (in *GatewayConfigList) DeepCopyInto(out *GatewayConfigList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*GatewayConfigList) DeepCopyObject

func (in *GatewayConfigList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type GatewayConfigSpec

type GatewayConfigSpec struct {
	// ExtProc defines the configuration for the external processor container.
	//
	// +optional
	ExtProc *GatewayConfigExtProc `json:"extProc,omitempty"`

	// GlobalLLMRequestCosts defines default LLM request costs that apply to all
	// routes referencing this GatewayConfig. These costs can be overridden on a
	// per-route basis via AIGatewayRoute.Spec.LLMRequestCosts.
	//
	// When a request matches a route, the cost calculation proceeds as follows:
	//  1. If the route defines LLMRequestCosts with a matching metadataKey, use that.
	//  2. Otherwise, fall back to the global cost with that metadataKey (if defined here).
	//  3. If neither exists, the cost is not calculated for that metadataKey.
	//
	// This allows you to define common cost formulas once at the gateway level
	// (e.g., billing_charges = input_tokens + output_tokens) and only override
	// them in specific routes when needed (e.g., premium routes with different pricing).
	//
	// +optional
	// +listType=map
	// +listMapKey=metadataKey
	GlobalLLMRequestCosts []LLMRequestCost `json:"globalLLMRequestCosts,omitempty"`
}

GatewayConfigSpec defines the configuration for the AI Gateway.

func (*GatewayConfigSpec) DeepCopy

func (in *GatewayConfigSpec) DeepCopy() *GatewayConfigSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatewayConfigSpec.

func (*GatewayConfigSpec) DeepCopyInto

func (in *GatewayConfigSpec) DeepCopyInto(out *GatewayConfigSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type GatewayConfigStatus

type GatewayConfigStatus struct {
	// Conditions describe the current conditions of the GatewayConfig.
	//
	// +optional
	// +listType=map
	// +listMapKey=type
	// +kubebuilder:validation:MaxItems=8
	Conditions []metav1.Condition `json:"conditions,omitempty"`
}

GatewayConfigStatus defines the observed state of GatewayConfig.

func (*GatewayConfigStatus) DeepCopy

func (in *GatewayConfigStatus) DeepCopy() *GatewayConfigStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatewayConfigStatus.

func (*GatewayConfigStatus) DeepCopyInto

func (in *GatewayConfigStatus) DeepCopyInto(out *GatewayConfigStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type HTTPBodyField

type HTTPBodyField struct {
	// Path is the top-level field name to set in the request body.
	// Examples: "service_tier", "max_tokens", "temperature"
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MinLength=1
	Path string `json:"path"`

	// Value is the JSON value to set at the specified field. This can be any valid JSON value:
	// string, number, boolean, object, array, or null.
	// The value will be parsed as JSON and inserted at the specified field.
	//
	// Examples:
	//   - "\"scale\"" (string)
	//   - "42" (number)
	//   - "true" (boolean)
	//   - "{\"key\": \"value\"}" (object)
	//   - "[1, 2, 3]" (array)
	//   - "null" (null)
	//
	// +kubebuilder:validation:Required
	Value string `json:"value"`
}

HTTPBodyField represents a JSON field name and value for body mutation

func (*HTTPBodyField) DeepCopy

func (in *HTTPBodyField) DeepCopy() *HTTPBodyField

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPBodyField.

func (*HTTPBodyField) DeepCopyInto

func (in *HTTPBodyField) DeepCopyInto(out *HTTPBodyField)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type HTTPBodyMutation

type HTTPBodyMutation struct {
	// Set overwrites/adds the request body with the given JSON field (name, value)
	// before sending to the backend. Only top-level fields are currently supported.
	//
	// Input:
	//   {
	//     "model": "gpt-4",
	//     "service_tier": "default"
	//   }
	//
	// Config:
	//   set:
	//   - path: "service_tier"
	//     value: "scale"
	//
	// Output:
	//   {
	//     "model": "gpt-4",
	//     "service_tier": "scale"
	//   }
	//
	// +optional
	// +listType=map
	// +listMapKey=path
	// +kubebuilder:validation:MaxItems=16
	Set []HTTPBodyField `json:"set,omitempty"`

	// Remove the given JSON field(s) from the HTTP request body before sending to the backend.
	// The value of Remove is a list of top-level field names to remove.
	//
	// Input:
	//   {
	//     "model": "gpt-4",
	//     "service_tier": "default",
	//     "internal_flag": true
	//   }
	//
	// Config:
	//   remove: ["service_tier", "internal_flag"]
	//
	// Output:
	//   {
	//     "model": "gpt-4"
	//   }
	//
	// +optional
	// +listType=set
	// +kubebuilder:validation:MaxItems=16
	Remove []string `json:"remove,omitempty"`
}

HTTPBodyMutation defines the mutation of HTTP request body JSON fields that will be applied to the request

func (*HTTPBodyMutation) DeepCopy

func (in *HTTPBodyMutation) DeepCopy() *HTTPBodyMutation

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPBodyMutation.

func (*HTTPBodyMutation) DeepCopyInto

func (in *HTTPBodyMutation) DeepCopyInto(out *HTTPBodyMutation)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type HTTPHeaderMutation

type HTTPHeaderMutation struct {
	// Set overwrites/adds the request with the given header (name, value)
	// before the action.
	//
	// Input:
	//   GET /foo HTTP/1.1
	//   my-header: foo
	//
	// Config:
	//   set:
	//   - name: "my-header"
	//     value: "bar"
	//
	// Output:
	//   GET /foo HTTP/1.1
	//   my-header: bar
	//
	// +optional
	// +listType=map
	// +listMapKey=name
	// +kubebuilder:validation:MaxItems=16
	Set []gwapiv1.HTTPHeader `json:"set,omitempty"`

	// Remove the given header(s) from the HTTP request before the action. The
	// value of Remove is a list of HTTP header names. Note that the header
	// names are case-insensitive (see
	// https://datatracker.ietf.org/doc/html/rfc2616#section-4.2).
	//
	// Input:
	//   GET /foo HTTP/1.1
	//   my-header1: foo
	//   my-header2: bar
	//   my-header3: baz
	//
	// Config:
	//   remove: ["my-header1", "my-header3"]
	//
	// Output:
	//   GET /foo HTTP/1.1
	//   my-header2: bar
	//
	// +optional
	// +listType=set
	// +kubebuilder:validation:MaxItems=16
	Remove []string `json:"remove,omitempty"`
}

HTTPHeaderMutation defines the mutation of HTTP headers that will be applied to the request

func (*HTTPHeaderMutation) DeepCopy

func (in *HTTPHeaderMutation) DeepCopy() *HTTPHeaderMutation

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HTTPHeaderMutation.

func (*HTTPHeaderMutation) DeepCopyInto

func (in *HTTPHeaderMutation) DeepCopyInto(out *HTTPHeaderMutation)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type JWKS

type JWKS struct {
	// RemoteJWKS defines how to fetch and cache JSON Web Key Sets (JWKS) from a remote
	// HTTP/HTTPS endpoint.
	//
	// +optional
	RemoteJWKS *egv1a1.RemoteJWKS `json:"remoteJWKS,omitempty"`

	// LocalJWKS defines how to get the JSON Web Key Sets (JWKS) from a local source.
	//
	// +optional
	LocalJWKS *egv1a1.LocalJWKS `json:"localJWKS,omitempty"`
}

JWKS defines how to obtain JSON Web Key Sets (JWKS) either from a remote HTTP/HTTPS endpoint or from a local source. +kubebuilder:validation:XValidation:rule="has(self.remoteJWKS) || has(self.localJWKS)", message="either remoteJWKS or localJWKS must be specified." +kubebuilder:validation:XValidation:rule="!(has(self.remoteJWKS) && has(self.localJWKS))", message="remoteJWKS and localJWKS cannot both be specified."

func (*JWKS) DeepCopy

func (in *JWKS) DeepCopy() *JWKS

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JWKS.

func (*JWKS) DeepCopyInto

func (in *JWKS) DeepCopyInto(out *JWKS)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type JWTSource

type JWTSource struct {
	// Scopes defines the list of JWT scopes required for the rule.
	// If multiple scopes are specified, all scopes must be present in the JWT for the rule to match.
	//
	// +kubebuilder:validation:Optional
	// +kubebuilder:validation:MaxItems=16
	// +optional
	Scopes []egv1a1.JWTScope `json:"scopes,omitempty"`

	// Claims defines the list of JWT claims required for the rule. Each claim must exist on the token
	// and have at least one of the expected values. Use to enforce tenant or subject-based access.
	//
	// +kubebuilder:validation:Optional
	// +kubebuilder:validation:MaxItems=16
	// +optional
	// +kubebuilder:validation:XValidation:rule="!self.exists(c, c.name == 'scope')",message="'scope' claim name is reserved for OAuth scopes"
	Claims []egv1a1.JWTClaim `json:"claims,omitempty"`
}

JWTSource defines the MCP authorization source for JWT tokens. At least one of scopes or claims must be provided. Scopes and claims are AND-ed: when both are specified, both sets must match.

+kubebuilder:validation:XValidation:rule="(has(self.scopes) && size(self.scopes) > 0) || (has(self.claims) && size(self.claims) > 0)",message="either scopes or claims must be specified"

func (*JWTSource) DeepCopy

func (in *JWTSource) DeepCopy() *JWTSource

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new JWTSource.

func (*JWTSource) DeepCopyInto

func (in *JWTSource) DeepCopyInto(out *JWTSource)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type LLMRequestCost

type LLMRequestCost struct {
	// MetadataKey is the key of the metadata to store this cost of the request.
	//
	// +kubebuilder:validation:Required
	MetadataKey string `json:"metadataKey"`
	// Type specifies the type of the request cost. The default is "OutputToken",
	// and it uses "output token" as the cost. The other types are "InputToken", "TotalToken",
	// "CachedInputToken", "CacheCreationInputToken", "ReasoningToken", and "CEL".
	//
	// +kubebuilder:validation:Enum=OutputToken;InputToken;CachedInputToken;CacheCreationInputToken;TotalToken;ReasoningToken;CEL
	Type LLMRequestCostType `json:"type"`
	// CEL is the CEL expression to calculate the cost of the request.
	// The CEL expression must return a signed or unsigned integer. If the
	// return value is negative, it will be error.
	//
	// The expression can use the following variables:
	//
	//	* model: the model name extracted from the request content. Type: string.
	//	* backend: the backend name in the form of "name.namespace". Type: string.
	//	* input_tokens: the number of input tokens. Type: unsigned integer.
	//	* cached_input_tokens: the number of cached read input tokens. Type: unsigned integer.
	//	* cache_creation_input_tokens: the number of cache creation input tokens. Type: unsigned integer.
	//	* output_tokens: the number of output tokens. Type: unsigned integer.
	//	* total_tokens: the total number of tokens. Type: unsigned integer.
	//	* reasoning_tokens: the number of reasoning tokens. Type: unsigned integer.
	//
	// For example, the following expressions are valid:
	//
	// 	* "model == 'llama' ?  input_tokens + output_token * 0.5 : total_tokens"
	//	* "backend == 'foo.default' ?  input_tokens + output_tokens : total_tokens"
	//	* "backend == 'bar.default' ?  (input_tokens - cached_input_tokens) + cached_input_tokens * 0.1 + cache_creation_input_tokens * 1.25 + output_tokens : total_tokens"
	//	* "input_tokens + output_tokens + total_tokens"
	//	* "input_tokens * output_tokens"
	//
	// +optional
	CEL *string `json:"cel,omitempty"`
}

LLMRequestCost configures each request cost.

func (*LLMRequestCost) DeepCopy

func (in *LLMRequestCost) DeepCopy() *LLMRequestCost

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LLMRequestCost.

func (*LLMRequestCost) DeepCopyInto

func (in *LLMRequestCost) DeepCopyInto(out *LLMRequestCost)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type LLMRequestCostType

type LLMRequestCostType string

LLMRequestCostType specifies the type of the LLMRequestCost.

const (
	// LLMRequestCostTypeInputToken is the cost type of the input token.
	LLMRequestCostTypeInputToken LLMRequestCostType = "InputToken"
	// LLMRequestCostTypeCachedInputToken is the cost type of the cached input token.
	LLMRequestCostTypeCachedInputToken LLMRequestCostType = "CachedInputToken"
	// LLMRequestCostTypeCacheCreationInputToken is the cost type of the cached input token.
	LLMRequestCostTypeCacheCreationInputToken LLMRequestCostType = "CacheCreationInputToken"
	// LLMRequestCostTypeOutputToken is the cost type of the output token.
	LLMRequestCostTypeOutputToken LLMRequestCostType = "OutputToken"
	// LLMRequestCostTypeTotalToken is the cost type of the total token.
	LLMRequestCostTypeTotalToken LLMRequestCostType = "TotalToken"
	// LLMRequestCostTypeReasoningToken is the cost type of the reasoning token.
	LLMRequestCostTypeReasoningToken LLMRequestCostType = "ReasoningToken"
	// LLMRequestCostTypeCEL is for calculating the cost using the CEL expression.
	LLMRequestCostTypeCEL LLMRequestCostType = "CEL"
)

type MCPAuthorizationSource

type MCPAuthorizationSource struct {
	// JWT defines the JWT scopes required for this rule to match.
	//
	// +kubebuilder:validation:Required
	JWT JWTSource `json:"jwt"`
}

MCPAuthorizationSource defines the source of an authorization rule.

func (*MCPAuthorizationSource) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MCPAuthorizationSource.

func (*MCPAuthorizationSource) DeepCopyInto

func (in *MCPAuthorizationSource) DeepCopyInto(out *MCPAuthorizationSource)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type MCPAuthorizationTarget

type MCPAuthorizationTarget struct {
	// Tools defines the list of tools this rule applies to.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MinItems=1
	// +kubebuilder:validation:MaxItems=16
	Tools []ToolCall `json:"tools"`
}

MCPAuthorizationTarget defines the target of an authorization rule.

func (*MCPAuthorizationTarget) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MCPAuthorizationTarget.

func (*MCPAuthorizationTarget) DeepCopyInto

func (in *MCPAuthorizationTarget) DeepCopyInto(out *MCPAuthorizationTarget)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type MCPBackendAPIKey

type MCPBackendAPIKey struct {
	// secretRef is the Kubernetes secret which contains the API keys.
	// The key of the secret should be "apiKey".
	// +optional
	SecretRef *gwapiv1.SecretObjectReference `json:"secretRef,omitempty"`

	// Inline contains the API key as an inline string.
	//
	// +optional
	Inline *string `json:"inline,omitempty"`

	// Header is the HTTP header to inject the API key into. If not specified,
	// defaults to "Authorization".
	// When the header is "Authorization", the injected header value will be
	// prefixed with "Bearer ".
	//
	// Either one of Header or QueryParam can be specified to inject the API key.
	//
	// +kubebuilder:validation:Optional
	// +kubebuilder:validation:MinLength=1
	// +optional
	Header *string `json:"header,omitempty"`

	// QueryParam is the HTTP query parameter to inject the API key into.
	// For example, if QueryParam is set to "api_key", and the API key is "mysecretkey", the request URL will be modified to include
	// "?api_key=mysecretkey".
	//
	// Either one of Header or QueryParam can be specified to inject the API key.
	//
	// +kubebuilder:validation:Optional
	// +kubebuilder:validation:MinLength=1
	// +optional
	QueryParam *string `json:"queryParam,omitempty"`
}

MCPBackendAPIKey defines the configuration for the API Key Authentication to a backend. When both `header` and `queryParam` are unspecified, the API key will be injected into the "Authorization" header by default.

+kubebuilder:validation:XValidation:rule="(has(self.secretRef) && !has(self.inline)) || (!has(self.secretRef) && has(self.inline))", message="exactly one of secretRef or inline must be set" +kubebuilder:validation:XValidation:rule="!(has(self.header) && has(self.queryParam))", message="only one of header or queryParam can be set"

func (*MCPBackendAPIKey) DeepCopy

func (in *MCPBackendAPIKey) DeepCopy() *MCPBackendAPIKey

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MCPBackendAPIKey.

func (*MCPBackendAPIKey) DeepCopyInto

func (in *MCPBackendAPIKey) DeepCopyInto(out *MCPBackendAPIKey)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type MCPBackendSecurityPolicy

type MCPBackendSecurityPolicy struct {
	// APIKey is a mechanism to access a backend. The API key will be injected into the request headers.
	// +optional
	APIKey *MCPBackendAPIKey `json:"apiKey,omitempty"`
}

MCPBackendSecurityPolicy defines the security policy for a backend MCP server.

func (*MCPBackendSecurityPolicy) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MCPBackendSecurityPolicy.

func (*MCPBackendSecurityPolicy) DeepCopyInto

func (in *MCPBackendSecurityPolicy) DeepCopyInto(out *MCPBackendSecurityPolicy)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type MCPHeaderForward

type MCPHeaderForward struct {
	// Name is the header name to extract from the incoming client request.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MinLength=1
	Name string `json:"name"`

	// BackendHeader is the header name to use when forwarding to the backend.
	// If not specified, the original header name is used.
	//
	// +kubebuilder:validation:Optional
	// +kubebuilder:validation:MinLength=1
	// +optional
	BackendHeader *string `json:"backendHeader,omitempty"`
}

MCPHeaderForward specifies a header to extract from the incoming request and forward to a backend.

func (*MCPHeaderForward) DeepCopy

func (in *MCPHeaderForward) DeepCopy() *MCPHeaderForward

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MCPHeaderForward.

func (*MCPHeaderForward) DeepCopyInto

func (in *MCPHeaderForward) DeepCopyInto(out *MCPHeaderForward)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type MCPRoute

type MCPRoute struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
	// Spec defines the details of the MCPRoute.
	Spec MCPRouteSpec `json:"spec,omitempty"`
	// Status defines the status details of the MCPRoute.
	Status MCPRouteStatus `json:"status,omitempty"`
}

MCPRoute defines how to route MCP requests to the backend MCP servers.

This serves as a way to define a "unified" AI API for a Gateway which allows downstream clients to use a single schema API to interact with multiple MCP backends.

+genclient +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +kubebuilder:object:root=true +kubebuilder:subresource:status +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.conditions[-1:].type` +kubebuilder:storageversion

func (*MCPRoute) DeepCopy

func (in *MCPRoute) DeepCopy() *MCPRoute

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MCPRoute.

func (*MCPRoute) DeepCopyInto

func (in *MCPRoute) DeepCopyInto(out *MCPRoute)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*MCPRoute) DeepCopyObject

func (in *MCPRoute) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type MCPRouteAuthorization

type MCPRouteAuthorization struct {
	// DefaultAction is the action to take when no rules match. If unspecified, defaults to Deny.
	//
	// +kubebuilder:validation:Optional
	// +kubebuilder:default:=Deny
	// +optional
	DefaultAction *egv1a1.AuthorizationAction `json:"defaultAction,omitempty"`

	// Rules defines a list of authorization rules.
	// These rules are evaluated in order, the first matching rule will be applied,
	// and the rest will be skipped.
	//
	// If no rules are defined, the default action will be applied to all requests.
	//
	// +kubebuilder:validation:MaxItems=32
	// +optional
	Rules []MCPRouteAuthorizationRule `json:"rules,omitempty"`
}

MCPRouteAuthorization defines the authorization configuration for a MCPRoute.

func (*MCPRouteAuthorization) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MCPRouteAuthorization.

func (*MCPRouteAuthorization) DeepCopyInto

func (in *MCPRouteAuthorization) DeepCopyInto(out *MCPRouteAuthorization)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type MCPRouteAuthorizationRule

type MCPRouteAuthorizationRule struct {
	// Source defines the authorization source for this rule.
	// If not specified, the rule will match all sources.
	//
	// +kubebuilder:validation:Optional
	Source *MCPAuthorizationSource `json:"source,omitempty"`

	// Target defines the authorization target for this rule.
	// If not specified, the rule will match all targets.
	//
	// +kubebuilder:validation:Optional
	Target *MCPAuthorizationTarget `json:"target,omitempty"`

	// CEL specifies a Common Expression Language (CEL) expression evaluated for this rule.
	// The expression must return a boolean; evaluation errors or non-boolean results
	// are treated as "no match".
	//
	// Example CEL expressions:
	//	* `request.method == "POST"`
	//	* `request.headers["x-custom-header"] == "AllowedValue"`
	//	* `request.mcp.tool in ["toolA", "toolB"]`
	//
	// Available attributes in the CEL expression:
	//
	//	* request.method: HTTP method such as GET or POST. Type: string.
	//	* request.headers: map of headers with lowercased keys, first value only. Type: map[string]string.
	//	* request.headers_all: map of headers with lowercased keys, all values. Type: map[string][]string.
	//	* request.path: request path such as /mcp. Type: string.
	//	* request.auth.jwt.claims: JWT claims when a bearer JWT is present. Type: map[string]any.
	//	* request.auth.jwt.scopes: JWT scopes when a bearer JWT is present. Type: []string.
	//	* request.mcp.method: MCP method such as tools/list or tools/call. Type: string.
	//	* request.mcp.backend: upstream backend name (for example, "kiwi" or "github"). Type: string.
	//	* request.mcp.tool: tool name without backend prefix (for example, "list_issues"). Type: string.
	//	* request.mcp.params: parameters of the MCP method, including keys like "_meta" and "arguments". Type: object.
	//
	// Note: The CEL expression support is experimental, and the attributes
	// available to the expression may change in future releases.
	//
	// +kubebuilder:validation:Optional
	// +kubebuilder:validation:MaxLength=4096
	// +optional
	CEL *string `json:"cel,omitempty"`

	// Action is the authorization decision for matching requests. If unspecified, defaults to Allow.
	//
	// +kubebuilder:validation:Optional
	// +kubebuilder:default:=Allow
	// +optional
	Action *egv1a1.AuthorizationAction `json:"action,omitempty"`
}

MCPRouteAuthorizationRule defines an authorization rule for MCPRoute based on the MCP authorization spec. Reference: https://modelcontextprotocol.io/specification/draft/basic/authorization#scope-challenge-handling

func (*MCPRouteAuthorizationRule) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MCPRouteAuthorizationRule.

func (*MCPRouteAuthorizationRule) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type MCPRouteBackendRef

type MCPRouteBackendRef struct {
	gwapiv1.BackendObjectReference `json:",inline"`

	// Path is the HTTP endpoint path of the backend MCP server.
	// If not specified, the default is "/mcp".
	//
	// +kubebuilder:validation:Optional
	// +kubebuilder:default:=/mcp
	// +kubebuilder:validation:MaxLength=1024
	// +optional
	Path *string `json:"path,omitempty"`

	// ToolSelector filters the tools exposed by this MCP server.
	// Supports exact matches and RE2-compatible regular expressions for both include and exclude patterns.
	// If not specified, all tools from the MCP server are exposed.
	// +kubebuilder:validation:Optional
	// +optional
	ToolSelector *MCPToolFilter `json:"toolSelector,omitempty"`

	// SecurityPolicy is the security policy to apply to this MCP server.
	//
	// +kubebuilder:validation:Optional
	// +optional
	SecurityPolicy *MCPBackendSecurityPolicy `json:"securityPolicy,omitempty"`

	// ForwardHeaders specifies HTTP headers to extract from the incoming client request
	// and forward to this backend MCP server.
	// This enables per-user authentication passthrough (e.g., personal access tokens)
	// without requiring OAuth configuration.
	// Each entry specifies a header name to extract and an optional rename for the backend.
	//
	// +kubebuilder:validation:Optional
	// +kubebuilder:validation:MaxItems=32
	// +optional
	ForwardHeaders []MCPHeaderForward `json:"forwardHeaders,omitempty"`
}

MCPRouteBackendRef wraps a EG's BackendObjectReference to reference an MCP server. TODO: move to a standalone MCPBackend CRD to avoid k8s object size limit.

func (*MCPRouteBackendRef) DeepCopy

func (in *MCPRouteBackendRef) DeepCopy() *MCPRouteBackendRef

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MCPRouteBackendRef.

func (*MCPRouteBackendRef) DeepCopyInto

func (in *MCPRouteBackendRef) DeepCopyInto(out *MCPRouteBackendRef)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type MCPRouteList

type MCPRouteList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []MCPRoute `json:"items"`
}

MCPRouteList contains a list of MCPRoute.

+k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +kubebuilder:object:root=true

func (*MCPRouteList) DeepCopy

func (in *MCPRouteList) DeepCopy() *MCPRouteList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MCPRouteList.

func (*MCPRouteList) DeepCopyInto

func (in *MCPRouteList) DeepCopyInto(out *MCPRouteList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*MCPRouteList) DeepCopyObject

func (in *MCPRouteList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type MCPRouteOAuth

type MCPRouteOAuth struct {
	// Issuer is the authorization server's issuer identity.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:Format=uri
	Issuer string `json:"issuer"`

	// Audiences is a list of JWT audiences allowed access.
	// It is recommended to set this field for token audience validation, as it is a security best practice to prevent token misuse.
	// Reference: https://modelcontextprotocol.io/specification/2025-06-18/basic/authorization#token-audience-binding-and-validation
	//
	// +kubebuilder:validation:Optional
	// +kubebuilder:validation:MaxItems=32
	Audiences []string `json:"audiences"`

	// JWKS defines how a JSON Web Key Sets (JWKS) can be obtained to verify the access tokens presented by the clients.
	//
	// If not specified, the JWKS URI will be discovered from the OAuth 2.0 Authorization Server Metadata
	// as per RFC 8414 by querying the `/.well-known/oauth-authorization-server` endpoint on the Issuer.
	//
	// +optional
	JWKS *JWKS `json:"jwks,omitempty"`

	// ProtectedResourceMetadata defines the OAuth 2.0 Resource Server Metadata as per RFC 8414.
	// This is used to expose the metadata endpoint for mcp clients to discover the authorization servers,
	// supported scopes, and JWKS URI.
	//
	// +kubebuilder:validation:Required
	ProtectedResourceMetadata ProtectedResourceMetadata `json:"protectedResourceMetadata"`

	// ClaimToHeaders specifies JWT claims to extract and forward as HTTP headers to backend MCP servers.
	// This enables backends to access user identity for authorization, auditing, or personalization.
	//
	// Security considerations:
	// - Any client-provided headers matching the configured header names will be stripped to prevent forgery
	// - Only the specified claims are extracted; the full JWT is not forwarded to backends
	// - Consider using a header prefix (e.g., "X-Jwt-Claim-") to avoid conflicts with other headers
	//
	// +kubebuilder:validation:Optional
	// +kubebuilder:validation:MaxItems=16
	// +optional
	ClaimToHeaders []egv1a1.ClaimToHeader `json:"claimToHeaders,omitempty"`
}

MCPRouteOAuth defines a MCP spec compatible OAuth authentication configuration for a MCPRoute. Reference: https://modelcontextprotocol.io/specification/2025-06-18/basic/authorization

func (*MCPRouteOAuth) DeepCopy

func (in *MCPRouteOAuth) DeepCopy() *MCPRouteOAuth

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MCPRouteOAuth.

func (*MCPRouteOAuth) DeepCopyInto

func (in *MCPRouteOAuth) DeepCopyInto(out *MCPRouteOAuth)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type MCPRouteSecurityPolicy

type MCPRouteSecurityPolicy struct {
	// OAuth defines the configuration for the MCP spec compatible OAuth authentication.
	//
	// +optional
	OAuth *MCPRouteOAuth `json:"oauth,omitempty"`

	// APIKeyAuth defines the configuration for the API Key Authentication.
	//
	// +optional
	APIKeyAuth *egv1a1.APIKeyAuth `json:"apiKeyAuth,omitempty"`

	// ExtAuth defines the configuration for External Authorization.
	//
	// +optional
	ExtAuth *egv1a1.ExtAuth `json:"extAuth,omitempty"`

	// Authorization defines the configuration for the MCP spec compatible authorization.
	//
	// +optional
	Authorization *MCPRouteAuthorization `json:"authorization,omitempty"`
}

MCPRouteSecurityPolicy defines the security policy for a MCPRoute.

+kubebuilder:validation:XValidation:rule="!(has(self.authorization) && self.authorization.rules.exists(r, has(r.source) && has(r.source.jwt)) && !has(self.oauth))",message="oauth must be configured when any authorization rule uses a jwt source"

func (*MCPRouteSecurityPolicy) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MCPRouteSecurityPolicy.

func (*MCPRouteSecurityPolicy) DeepCopyInto

func (in *MCPRouteSecurityPolicy) DeepCopyInto(out *MCPRouteSecurityPolicy)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type MCPRouteSpec

type MCPRouteSpec struct {
	// ParentRefs are the names of the Gateway resources this MCPRoute is being attached to.
	// Cross namespace references are not supported. In other words, the Gateway resources must be in the
	// same namespace as the MCPRoute. Currently, each reference's Kind must be Gateway.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MinItems=1
	// +kubebuilder:validation:MaxItems=16
	// +kubebuilder:validation:XValidation:rule="self.all(match, match.kind == 'Gateway')", message="only Gateway is supported"
	ParentRefs []gwapiv1.ParentReference `json:"parentRefs"`

	// Path is the HTTP endpoint path that serves MCP requests over the Streamable HTTP transport.
	// If not specified, the default is "/mcp".
	//
	// +kubebuilder:validation:Optional
	// +kubebuilder:default:=/mcp
	// +kubebuilder:validation:MaxLength=1024
	// +optional
	Path *string `json:"path,omitempty"`

	// Headers are HTTP headers that must match for this route to be selected.
	// Multiple match values are ANDed together, meaning, a request must match all the specified headers to select the route.
	//
	// +listType=map
	// +listMapKey=name
	// +optional
	// +kubebuilder:validation:MaxItems=16
	Headers []gwapiv1.HTTPHeaderMatch `json:"headers,omitempty"`

	// BackendRefs is a list of backend references to the MCP servers.
	// These MCP servers will be aggregated and exposed as a single MCP endpoint to the clients.
	// From the client's perspective, they only need to configure a single MCP server URL, e.g. "https://api.example.com/mcp",
	// and the Envoy AI Gateway will route the requests to the appropriate MCP server based on the requests.
	//
	// All names must be unique within this list to avoid potential tools, resources, etc. name collisions.
	// Also, cross-namespace references are not supported. In other words, the backend MCP servers must be in the
	// same namespace as the MCPRoute.
	//
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:MinItems=1
	// +kubebuilder:validation:MaxItems=256
	// +kubebuilder:validation:XValidation:rule="self.all(i, self.exists_one(j, j.name == i.name))", message="all backendRefs names must be unique"
	BackendRefs []MCPRouteBackendRef `json:"backendRefs"`

	// SecurityPolicy defines the security policy for this MCPRoute.
	//
	// +kubebuilder:validation:Optional
	// +optional
	SecurityPolicy *MCPRouteSecurityPolicy `json:"securityPolicy,omitempty"`
}

MCPRouteSpec details the MCPRoute configuration.

func (*MCPRouteSpec) DeepCopy

func (in *MCPRouteSpec) DeepCopy() *MCPRouteSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MCPRouteSpec.

func (*MCPRouteSpec) DeepCopyInto

func (in *MCPRouteSpec) DeepCopyInto(out *MCPRouteSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type MCPRouteStatus

type MCPRouteStatus struct {
	// Conditions is the list of conditions by the reconciliation result.
	// Currently, at most one condition is set.
	//
	// Known .status.conditions.type are: "Accepted", "NotAccepted".
	Conditions []metav1.Condition `json:"conditions,omitempty"`
}

MCPRouteStatus contains the conditions by the reconciliation result.

func (*MCPRouteStatus) DeepCopy

func (in *MCPRouteStatus) DeepCopy() *MCPRouteStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MCPRouteStatus.

func (*MCPRouteStatus) DeepCopyInto

func (in *MCPRouteStatus) DeepCopyInto(out *MCPRouteStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type MCPToolFilter

type MCPToolFilter struct {
	// Include is a list of tool names to include. Only the specified tools will be available.
	//
	// +kubebuilder:validation:Optional
	// +kubebuilder:validation:MaxItems=32
	// +optional
	Include []string `json:"include,omitempty"`

	// IncludeRegex is a list of RE2-compatible regular expressions that, when matched, include the tool.
	// Only tools matching these patterns will be available.
	//
	// +kubebuilder:validation:Optional
	// +kubebuilder:validation:MaxItems=32
	// +optional
	IncludeRegex []string `json:"includeRegex,omitempty"`

	// Exclude is a list of tool names to exclude. The specified tools will not be available.
	// Exclude rules take precedence over include rules.
	//
	// +kubebuilder:validation:Optional
	// +kubebuilder:validation:MaxItems=32
	// +optional
	Exclude []string `json:"exclude,omitempty"`

	// ExcludeRegex is a list of RE2-compatible regular expressions that, when matched, exclude the tool.
	// Tools matching these patterns will not be available. Exclude rules take precedence over include rules.
	//
	// +kubebuilder:validation:Optional
	// +kubebuilder:validation:MaxItems=32
	// +optional
	ExcludeRegex []string `json:"excludeRegex,omitempty"`
}

MCPToolFilter filters tools using include and exclude patterns with exact matches or regular expressions. Exclude rules take precedence over include rules (deny-wins). When both include and exclude are specified, a tool must match an include rule AND not match any exclude rule to be allowed.

+kubebuilder:validation:XValidation:rule="!(has(self.include) && has(self.includeRegex))", message="include and includeRegex are mutually exclusive" +kubebuilder:validation:XValidation:rule="!(has(self.exclude) && has(self.excludeRegex))", message="exclude and excludeRegex are mutually exclusive" +kubebuilder:validation:XValidation:rule="has(self.include) || has(self.includeRegex) || has(self.exclude) || has(self.excludeRegex)", message="at least one of include, includeRegex, exclude, or excludeRegex must be specified"

func (*MCPToolFilter) DeepCopy

func (in *MCPToolFilter) DeepCopy() *MCPToolFilter

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MCPToolFilter.

func (*MCPToolFilter) DeepCopyInto

func (in *MCPToolFilter) DeepCopyInto(out *MCPToolFilter)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ProtectedResourceMetadata

type ProtectedResourceMetadata struct {
	// Resource is the identifier of the protected resource.
	// This should match the MCPRoute's URL. For example, if the MCPRoute's URL is
	// "https://api.example.com/mcp", the Resource should be "https://api.example.com/mcp".
	// +kubebuilder:validation:Required
	// +kubebuilder:validation:Format=uri
	Resource string `json:"resource"`

	// ResourceName is a human-readable name for the protected resource.
	// +kubebuilder:validation:Optional
	// +kubebuilder:validation:MaxLength=256
	// +optional
	ResourceName *string `json:"resourceName,omitempty"`

	// ScopesSupported defines the minimal set of scopes required for the basic functionality of the MCPRoute.
	// It should avoid broad or overly permissive scopes to prevent clients from requesting tokens with excessive privileges.
	//
	// If an operation requires additional scopes that are not present in the access token, the client will receive a
	// 403 Forbidden response that includes the required scopes in the `scope` field of the `WWW-Authenticate` header.
	// This enables incremental privilege elevation through targeted `WWW-Authenticate: scope="..."` challenges when
	// privileged operations are first attempted.
	//
	// +kubebuilder:validation:Optional
	// +kubebuilder:validation:MaxItems=32
	// +optional
	ScopesSupported []string `json:"scopesSupported,omitempty"`

	// ResourceSigningAlgValuesSupported is a list of JWS signing algorithms supported by the resource server.
	// These algorithms are used in the "alg" field of the JOSE header in signed tokens.
	//
	// +kubebuilder:validation:Optional
	// +kubebuilder:validation:MinItems=1
	// +kubebuilder:validation:MaxItems=16
	// +optional
	ResourceSigningAlgValuesSupported []string `json:"resourceSigningAlgValuesSupported,omitempty"`

	// ResourceDocumentation is a URL that provides human-readable documentation for the resource.
	//
	// +kubebuilder:validation:Optional
	// +kubebuilder:validation:Format=uri
	// +optional
	ResourceDocumentation *string `json:"resourceDocumentation,omitempty"`

	// ResourcePolicyURI is a URL that points to the resource server's policy document.
	//
	// +kubebuilder:validation:Optional
	// +kubebuilder:validation:Format=uri
	// +optional
	ResourcePolicyURI *string `json:"resourcePolicyUri,omitempty"`
}

ProtectedResourceMetadata represents the Protected Resource Metadata of the MCP server as per RFC 9728.

References: * https://modelcontextprotocol.io/specification/2025-06-18/basic/authorization#authorization-server-location * https://datatracker.ietf.org/doc/html/rfc9728#name-protected-resource-metadata

func (*ProtectedResourceMetadata) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ProtectedResourceMetadata.

func (*ProtectedResourceMetadata) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ToolCall

type ToolCall struct {
	// Backend is the name of the backend this tool belongs to.
	//
	// +kubebuilder:validation:Required
	Backend string `json:"backend"`

	// Tool is the name of the tool.
	//
	// +kubebuilder:validation:Required
	Tool string `json:"tool"`
}

ToolCall represents a tool call in the MCP authorization target.

func (*ToolCall) DeepCopy

func (in *ToolCall) DeepCopy() *ToolCall

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ToolCall.

func (*ToolCall) DeepCopyInto

func (in *ToolCall) DeepCopyInto(out *ToolCall)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type VersionedAPISchema

type VersionedAPISchema struct {
	// Name is the name of the API schema of the AIGatewayRoute or AIServiceBackend.
	//
	// +kubebuilder:validation:Enum=OpenAI;Cohere;AWSBedrock;AzureOpenAI;GCPVertexAI;GCPAnthropic;Anthropic;AWSAnthropic
	Name APISchema `json:"name"`

	// Version is the version of the API schema.
	//
	// When the name is set to AzureOpenAI, this version maps to "API Version" in the
	// Azure OpenAI API documentation (https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#rest-api-versioning).
	//
	// See https://aigateway.envoyproxy.io/docs/capabilities/llm-integrations/supported-providers for details.
	// +optional
	Version *string `json:"version,omitempty"`

	// Prefix is the prefix for the API.
	//
	// When the name is set to "OpenAI", "chat completions" API endpoint will be "${this_field}/chat/completions".
	// It can be with or without a leading slash ("/").
	//
	// This is especially useful when routing to the backend that has an OpenAI compatible API but has a different
	// prefix. For example, Gemini OpenAI compatible API (https://ai.google.dev/gemini-api/docs/openai) uses
	// "/v1beta/openai" prefix. Another example is that Cohere AI (https://docs.cohere.com/v2/docs/compatibility-api)
	// uses "/compatibility/v1" prefix. On the other hand, DeepSeek (https://api-docs.deepseek.com/) doesn't
	// use prefix, so you can leave this field unset.
	//
	// See https://aigateway.envoyproxy.io/docs/capabilities/llm-integrations/supported-providers for details.
	// +optional
	Prefix *string `json:"prefix,omitempty"`
}

VersionedAPISchema defines the API schema of either AIGatewayRoute (the input) or AIServiceBackend (the output).

This allows the ai-gateway to understand the input and perform the necessary transformation depending on the API schema pair (input, output).

Note that this is vendor specific, and the stability of the API schema is not guaranteed by the ai-gateway, but by the vendor via proper versioning.

func (*VersionedAPISchema) DeepCopy

func (in *VersionedAPISchema) DeepCopy() *VersionedAPISchema

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VersionedAPISchema.

func (*VersionedAPISchema) DeepCopyInto

func (in *VersionedAPISchema) DeepCopyInto(out *VersionedAPISchema)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

Directories

Path Synopsis
client
clientset/versioned/fake
This package has the automatically generated fake clientset.
This package has the automatically generated fake clientset.
clientset/versioned/scheme
This package contains the scheme of the automatically generated clientset.
This package contains the scheme of the automatically generated clientset.
clientset/versioned/typed/api/v1beta1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
clientset/versioned/typed/api/v1beta1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.

Jump to

Keyboard shortcuts

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