AgentgatewayBackend
agentgateway.dev / v1alpha1
apiVersion: agentgateway.dev/v1alpha1
kind: AgentgatewayBackend
metadata:
name: example
apiVersion
string
APIVersion defines the versioned schema of this representation of an object.
Servers should convert recognized schemas to the latest internal value, and
may reject unrecognized values.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources
kind
string
Kind is a string value representing the REST resource this object represents.
Servers may infer this from the endpoint the client submits requests to.
Cannot be updated.
In CamelCase.
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
metadata
object
spec object required
spec defines the desired state of AgentgatewayBackend.
ai object
ai represents a LLM backend.
groups []object
groups specifies a list of groups in priority order where each group defines
a set of LLM providers. The priority determines the priority of the backend endpoints chosen.
Note: provider names must be unique across all providers in all priority groups. Backend policies
may target a specific provider by name using targetRefs[].sectionName.
Example configuration with two priority groups:
```yaml
groups:
- providers:
- azureopenai:
deploymentName: gpt-4o-mini
apiVersion: 2024-02-15-preview
endpoint: ai-gateway.openai.azure.com
- providers:
- azureopenai:
deploymentName: gpt-4o-mini-2
apiVersion: 2024-02-15-preview
endpoint: ai-gateway-2.openai.azure.com
policies:
auth:
secretRef:
name: azure-secret
```
minItems:
1maxItems:
32providers []object required
providers specifies a list of LLM providers within this group. Each provider is treated equally in terms of priority,
with automatic weighting based on health.
minItems:
1maxItems:
32anthropic object
Anthropic provider
model
string
Optional: Override the model name, such as `gpt-4o-mini`.
If unset, the model name is taken from the request.
minLength:
1maxLength:
256azureopenai object
Azure OpenAI provider
apiVersion
string
The version of the Azure OpenAI API to use.
For more information, see the [Azure OpenAI API version reference](https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#api-specs).
If unset, defaults to "v1"
minLength:
1maxLength:
64
deploymentName
string
The name of the Azure OpenAI model deployment to use.
For more information, see the [Azure OpenAI model docs](https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/models).
This is required if ApiVersion is not 'v1'. For v1, the model can be set in the request.
minLength:
1maxLength:
256
endpoint
string required
The endpoint for the Azure OpenAI API to use, such as `my-endpoint.openai.azure.com`.
If the scheme is included, it is stripped.
minLength:
1maxLength:
256bedrock object
Bedrock provider
guardrail object
Guardrail configures the Guardrail policy to use for the backend. See <https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails.html>
If not specified, the AWS Guardrail policy will not be used.
identifier
string required
GuardrailIdentifier is the identifier of the Guardrail policy to use for the backend.
minLength:
1maxLength:
256
version
string required
GuardrailVersion is the version of the Guardrail policy to use for the backend.
minLength:
1maxLength:
256
model
string
Optional: Override the model name, such as `gpt-4o-mini`.
If unset, the model name is taken from the request.
minLength:
1maxLength:
256
region
string
Region is the AWS region to use for the backend.
Defaults to us-east-1 if not specified.
pattern:
^[a-z0-9-]+$minLength:
1maxLength:
63gemini object
Gemini provider
model
string
Optional: Override the model name, such as `gemini-2.5-pro`.
If unset, the model name is taken from the request.
minLength:
1maxLength:
256
host
string
Host specifies the hostname to send the requests to.
If not specified, the default hostname for the provider is used.
minLength:
1maxLength:
256
name
string required
Name of the provider. Policies can target this provider by name.
pattern:
^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$minLength:
1maxLength:
253openai object
OpenAI provider
model
string
Optional: Override the model name, such as `gpt-4o-mini`.
If unset, the model name is taken from the request.
minLength:
1maxLength:
256
path
string
Path specifies the URL path to use for the LLM provider API requests.
This is useful when you need to route requests to a different API endpoint while maintaining
compatibility with the original provider's API structure.
If not specified, the default path for the provider is used.
minLength:
1maxLength:
1024policies object
policies controls policies for communicating with this backend. Policies may also be set in AgentgatewayPolicy, or
in the top level AgentgatewayBackend. policies are merged on a field-level basis, with order: AgentgatewayPolicy <
AgentgatewayBackend < AgentgatewayBackend LLM provider (this field).
ai object
ai specifies settings for AI workloads. This is only applicable when connecting to a Backend of type 'ai'.
defaults []object
Provide defaults to merge with user input fields. If the field is already set, the field in the request is used.
minItems:
1maxItems:
64
field
string required
The name of the field.
minLength:
1maxLength:
256
value
object required
The field default value, which can be any JSON Data Type.
modelAliases
object
ModelAliases maps friendly model names to actual provider model names.
Example: {"fast": "gpt-3.5-turbo", "smart": "gpt-4-turbo"}
Note: This field is only applicable when using the agentgateway data plane.
overrides []object
Provide overrides to merge with user input fields. If the field is already set, the field will be overwritten.
minItems:
1maxItems:
64
field
string required
The name of the field.
minLength:
1maxLength:
256
value
object required
The field default value, which can be any JSON Data Type.
prompt object
Enrich requests sent to the LLM provider by appending and prepending system prompts. This can be configured only for
LLM providers that use the `CHAT` or `CHAT_STREAMING` API route type.
append []object
A list of messages to be appended to the prompt sent by the client.
content
string required
String content of the message.
role
string required
Role of the message. The available roles depend on the backend
LLM provider model, such as `SYSTEM` or `USER` in the OpenAI API.
prepend []object
A list of messages to be prepended to the prompt sent by the client.
content
string required
String content of the message.
role
string required
Role of the message. The available roles depend on the backend
LLM provider model, such as `SYSTEM` or `USER` in the OpenAI API.
promptCaching object
promptCaching enables automatic prompt caching for supported providers (AWS Bedrock).
Reduces API costs by caching static content like system prompts and tool definitions.
Only applicable for Bedrock Claude 3+ and Nova models.
cacheMessages
boolean
CacheMessages enables caching for conversation messages.
Caches all messages in the conversation for cost savings.
cacheSystem
boolean
CacheSystem enables caching for system prompts.
Inserts a cache point after all system messages.
cacheTools
boolean
CacheTools enables caching for tool definitions.
Inserts a cache point after all tool specifications.
minTokens
integer
MinTokens specifies the minimum estimated token count
before caching is enabled. Uses rough heuristic (word count × 1.3) to estimate tokens.
Bedrock requires at least 1,024 tokens for caching to be effective.
minimum:
0promptGuard object
promptGuard enables adding guardrails to LLM requests and responses.
request []object
Prompt guards to apply to requests sent by the client.
minItems:
1maxItems:
8openAIModeration object
openAIModeration passes prompt data through the OpenAI Moderations endpoint.
See https://platform.openai.com/docs/api-reference/moderations for more information.
model
string
model specifies the moderation model to use. For example, `omni-moderation`.
policies object
policies controls policies for communicating with OpenAI.
auth object
auth defines settings for managing authentication to the backend
aws object
Auth specifies an explicit AWS authentication method for the backend.
When omitted, we will try to use the default AWS SDK authentication methods.
secretRef object required
SecretRef references a Kubernetes Secret containing the AWS credentials.
The Secret must have keys "accessKey", "secretKey", and optionally "sessionToken".
name
string
Name of the referent.
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
key
string
key provides an inline key to use as the value of the Authorization header.
This option is the least secure; usage of a Secret is preferred.
maxLength:
2048
passthrough
object
passthrough passes through an existing token that has been sent by the client and validated. Other policies, like
JWT and API Key authentication, will strip the original client credentials. Passthrough backend authentication
causes the original token to be added back into the request. If there are no client authentication policies on the
request, the original token would be unchanged, so this would have no effect.
secretRef object
secretRef references a Kubernetes secret storing the key to use the authorization value. This must be stored in the
'Authorization' key.
name
string
Name of the referent.
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
http object
http defines settings for managing HTTP requests to the backend.
requestTimeout
string
requestTimeout specifies the deadline for receiving a response from the backend.
version
string
version specifies the HTTP protocol version to use when connecting to the backend.
If not specified, the version is automatically determined:
* Service types can specify it with 'appProtocol' on the Service port.
* If traffic is identified as gRPC, HTTP2 is used.
* If the incoming traffic was plaintext HTTP, the original protocol will be used.
* If the incoming traffic was HTTPS, HTTP1 will be used. This is because most clients will
transparently upgrade HTTPS traffic to HTTP2, even if the backend doesn't support it
enum:
HTTP1, HTTP2tcp object
tcp defines settings for managing TCP connections to the backend.
connectTimeout
string
connectTimeout defines the deadline for establishing a connection to the destination.
keepalive object
keepAlive defines settings for enabling TCP keepalives on the connection.
interval
string
interval specifies the number of seconds between keep-alive probes.
If unset, this defaults to 180s.
retries
integer
retries specifies the maximum number of keep-alive probes to send before dropping the connection.
If unset, this defaults to 9.
format:
int32minimum:
1maximum:
64
time
string
time specifies the number of seconds a connection needs to be idle before keep-alive probes start being sent.
If unset, this defaults to 180s.
tls object
tls defines settings for managing TLS connections to the backend.
If this field is set, TLS will be initiated to the backend; the system trusted CA certificates will be used to
validate the server, and the SNI will automatically be set based on the destination.
alpnProtocols
[]string
alpnProtocols sets the Application Level Protocol Negotiation (ALPN) value to use in the TLS handshake.
If not present, defaults to ["h2", "http/1.1"].
minItems:
1maxItems:
16caCertificateRefs []object
caCertificateRefs defines the CA certificate ConfigMap to use to verify the server certificate.
If unset, the system's trusted certificates are used.
maxItems:
1
name
string
Name of the referent.
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
insecureSkipVerify
string
insecureSkipVerify originates TLS but skips verification of the backend's certificate.
WARNING: This is an insecure option that should only be used if the risks are understood.
There are two modes:
* All disables all TLS verification
* Hostname verifies the CA certificate is trusted, but ignores any mismatch of hostname/SANs. Note that this method
is still insecure; prefer setting verifySubjectAltNames to customize the valid hostnames if possible.
enum:
All, HostnamemtlsCertificateRef []object
mtlsCertificateRef enables mutual TLS to the backend, using the specified key (tls.key) and cert (tls.crt) from the
refenced Secret.
An optional 'ca.cert' field, if present, will be used to verify the server certificate if present. If
caCertificateRefs is also specified, the caCertificateRefs field takes priority.
If unspecified, no client certificate will be used.
maxItems:
1
name
string
Name of the referent.
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
sni
string
sni specifies the Server Name Indicator (SNI) to be used in the TLS handshake. If unset, the SNI is automatically
set based on the destination hostname.
pattern:
^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$minLength:
1maxLength:
253
verifySubjectAltNames
[]string
verifySubjectAltNames specifies the Subject Alternative Names (SAN) to verify in the server certificate.
If not present, the destination hostname is automatically used.
minItems:
1maxItems:
16regex object
Regular expression (regex) matching for prompt guards and data masking.
action
string
The action to take if a regex pattern is matched in a request or response.
This setting applies only to request matches. PromptguardResponse matches are always masked by default.
Defaults to `Mask`.
enum:
Mask, Reject
builtins
[]string
A list of built-in regex patterns to match against the request or response.
Matches and built-ins are additive.
matches
[]string
A list of regex patterns to match against the request or response.
Matches and built-ins are additive.
response object
A custom response message to return to the client. If not specified, defaults to
"The request was rejected due to inappropriate content".
message
string
A custom response message to return to the client. If not specified, defaults to
"The request was rejected due to inappropriate content".
statusCode
integer
The status code to return to the client. Defaults to 403.
format:
int32minimum:
200maximum:
599webhook object
Configure a webhook to forward requests to for prompt guarding.
backendRef object required
backendRef references the webhook server to reach.
Supported types: Service and Backend.
group
string
Group is the group of the referent. For example, "gateway.networking.k8s.io".
When unspecified or empty string, core API group is inferred.
pattern:
^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$maxLength:
253
kind
string
Kind is the Kubernetes resource kind of the referent. For example
"Service".
Defaults to "Service" when not specified.
ExternalName services can refer to CNAME DNS records that may live
outside of the cluster and as such are difficult to reason about in
terms of conformance. They also may not be safe to forward to (see
CVE-2021-25740 for more information). Implementations SHOULD NOT
support ExternalName Services.
Support: Core (Services with a type other than ExternalName)
Support: Implementation-specific (Services with type ExternalName)
pattern:
^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$minLength:
1maxLength:
63
name
string required
Name is the name of the referent.
minLength:
1maxLength:
253
namespace
string
Namespace is the namespace of the backend. When unspecified, the local
namespace is inferred.
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.
Support: Core
pattern:
^[a-z0-9]([-a-z0-9]*[a-z0-9])?$minLength:
1maxLength:
63
port
integer
Port specifies the destination port number to use for this resource.
Port is required when the referent is a Kubernetes Service. In this
case, the port number is the service port number, not the target port.
For other resources, destination port might be derived from the referent
resource or this field.
format:
int32minimum:
1maximum:
65535forwardHeaderMatches []object
ForwardHeaderMatches defines a list of HTTP header matches that will be
used to select the headers to forward to the webhook.
Request headers are used when forwarding requests and response headers
are used when forwarding responses.
By default, no headers are forwarded.
name
string required
Name is the name of the HTTP Header to be matched. Name matching MUST be
case-insensitive. (See https://tools.ietf.org/html/rfc7230#section-3.2).
If multiple entries specify equivalent header names, only the first
entry with an equivalent name MUST be considered for a match. Subsequent
entries with an equivalent header name MUST be ignored. Due to the
case-insensitivity of header names, "foo" and "Foo" are considered
equivalent.
When a header is repeated in an HTTP request, it is
implementation-specific behavior as to how this is represented.
Generally, proxies should follow the guidance from the RFC:
https://www.rfc-editor.org/rfc/rfc7230.html#section-3.2.2 regarding
processing a repeated header, with special handling for "Set-Cookie".
pattern:
^[A-Za-z0-9!#$%&'*+\-.^_\x60|~]+$minLength:
1maxLength:
256
type
string
Type specifies how to match against the value of the header.
Support: Core (Exact)
Support: Implementation-specific (RegularExpression)
Since RegularExpression HeaderMatchType has implementation-specific
conformance, implementations can support POSIX, PCRE or any other dialects
of regular expressions. Please read the implementation's documentation to
determine the supported dialect.
enum:
Exact, RegularExpression
value
string required
Value is the value of HTTP Header to be matched.
minLength:
1maxLength:
4096response []object
Prompt guards to apply to responses returned by the LLM provider.
minItems:
1maxItems:
8regex object
Regular expression (regex) matching for prompt guards and data masking.
action
string
The action to take if a regex pattern is matched in a request or response.
This setting applies only to request matches. PromptguardResponse matches are always masked by default.
Defaults to `Mask`.
enum:
Mask, Reject
builtins
[]string
A list of built-in regex patterns to match against the request or response.
Matches and built-ins are additive.
matches
[]string
A list of regex patterns to match against the request or response.
Matches and built-ins are additive.
response object
A custom response message to return to the client. If not specified, defaults to
"The response was rejected due to inappropriate content".
message
string
A custom response message to return to the client. If not specified, defaults to
"The request was rejected due to inappropriate content".
statusCode
integer
The status code to return to the client. Defaults to 403.
format:
int32minimum:
200maximum:
599webhook object
Configure a webhook to forward responses to for prompt guarding.
backendRef object required
backendRef references the webhook server to reach.
Supported types: Service and Backend.
group
string
Group is the group of the referent. For example, "gateway.networking.k8s.io".
When unspecified or empty string, core API group is inferred.
pattern:
^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$maxLength:
253
kind
string
Kind is the Kubernetes resource kind of the referent. For example
"Service".
Defaults to "Service" when not specified.
ExternalName services can refer to CNAME DNS records that may live
outside of the cluster and as such are difficult to reason about in
terms of conformance. They also may not be safe to forward to (see
CVE-2021-25740 for more information). Implementations SHOULD NOT
support ExternalName Services.
Support: Core (Services with a type other than ExternalName)
Support: Implementation-specific (Services with type ExternalName)
pattern:
^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$minLength:
1maxLength:
63
name
string required
Name is the name of the referent.
minLength:
1maxLength:
253
namespace
string
Namespace is the namespace of the backend. When unspecified, the local
namespace is inferred.
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.
Support: Core
pattern:
^[a-z0-9]([-a-z0-9]*[a-z0-9])?$minLength:
1maxLength:
63
port
integer
Port specifies the destination port number to use for this resource.
Port is required when the referent is a Kubernetes Service. In this
case, the port number is the service port number, not the target port.
For other resources, destination port might be derived from the referent
resource or this field.
format:
int32minimum:
1maximum:
65535forwardHeaderMatches []object
ForwardHeaderMatches defines a list of HTTP header matches that will be
used to select the headers to forward to the webhook.
Request headers are used when forwarding requests and response headers
are used when forwarding responses.
By default, no headers are forwarded.
name
string required
Name is the name of the HTTP Header to be matched. Name matching MUST be
case-insensitive. (See https://tools.ietf.org/html/rfc7230#section-3.2).
If multiple entries specify equivalent header names, only the first
entry with an equivalent name MUST be considered for a match. Subsequent
entries with an equivalent header name MUST be ignored. Due to the
case-insensitivity of header names, "foo" and "Foo" are considered
equivalent.
When a header is repeated in an HTTP request, it is
implementation-specific behavior as to how this is represented.
Generally, proxies should follow the guidance from the RFC:
https://www.rfc-editor.org/rfc/rfc7230.html#section-3.2.2 regarding
processing a repeated header, with special handling for "Set-Cookie".
pattern:
^[A-Za-z0-9!#$%&'*+\-.^_\x60|~]+$minLength:
1maxLength:
256
type
string
Type specifies how to match against the value of the header.
Support: Core (Exact)
Support: Implementation-specific (RegularExpression)
Since RegularExpression HeaderMatchType has implementation-specific
conformance, implementations can support POSIX, PCRE or any other dialects
of regular expressions. Please read the implementation's documentation to
determine the supported dialect.
enum:
Exact, RegularExpression
value
string required
Value is the value of HTTP Header to be matched.
minLength:
1maxLength:
4096
routes
object
routes defines how to identify the type of traffic to handle.
The keys are URL path suffixes matched using ends-with comparison (e.g., "/v1/chat/completions").
The special "*" wildcard matches any path.
If not specified, all traffic defaults to "completions" type.
auth object
auth defines settings for managing authentication to the backend
aws object
Auth specifies an explicit AWS authentication method for the backend.
When omitted, we will try to use the default AWS SDK authentication methods.
secretRef object required
SecretRef references a Kubernetes Secret containing the AWS credentials.
The Secret must have keys "accessKey", "secretKey", and optionally "sessionToken".
name
string
Name of the referent.
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
key
string
key provides an inline key to use as the value of the Authorization header.
This option is the least secure; usage of a Secret is preferred.
maxLength:
2048
passthrough
object
passthrough passes through an existing token that has been sent by the client and validated. Other policies, like
JWT and API Key authentication, will strip the original client credentials. Passthrough backend authentication
causes the original token to be added back into the request. If there are no client authentication policies on the
request, the original token would be unchanged, so this would have no effect.
secretRef object
secretRef references a Kubernetes secret storing the key to use the authorization value. This must be stored in the
'Authorization' key.
name
string
Name of the referent.
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
http object
http defines settings for managing HTTP requests to the backend.
requestTimeout
string
requestTimeout specifies the deadline for receiving a response from the backend.
version
string
version specifies the HTTP protocol version to use when connecting to the backend.
If not specified, the version is automatically determined:
* Service types can specify it with 'appProtocol' on the Service port.
* If traffic is identified as gRPC, HTTP2 is used.
* If the incoming traffic was plaintext HTTP, the original protocol will be used.
* If the incoming traffic was HTTPS, HTTP1 will be used. This is because most clients will
transparently upgrade HTTPS traffic to HTTP2, even if the backend doesn't support it
enum:
HTTP1, HTTP2tcp object
tcp defines settings for managing TCP connections to the backend.
connectTimeout
string
connectTimeout defines the deadline for establishing a connection to the destination.
keepalive object
keepAlive defines settings for enabling TCP keepalives on the connection.
interval
string
interval specifies the number of seconds between keep-alive probes.
If unset, this defaults to 180s.
retries
integer
retries specifies the maximum number of keep-alive probes to send before dropping the connection.
If unset, this defaults to 9.
format:
int32minimum:
1maximum:
64
time
string
time specifies the number of seconds a connection needs to be idle before keep-alive probes start being sent.
If unset, this defaults to 180s.
tls object
tls defines settings for managing TLS connections to the backend.
If this field is set, TLS will be initiated to the backend; the system trusted CA certificates will be used to
validate the server, and the SNI will automatically be set based on the destination.
alpnProtocols
[]string
alpnProtocols sets the Application Level Protocol Negotiation (ALPN) value to use in the TLS handshake.
If not present, defaults to ["h2", "http/1.1"].
minItems:
1maxItems:
16caCertificateRefs []object
caCertificateRefs defines the CA certificate ConfigMap to use to verify the server certificate.
If unset, the system's trusted certificates are used.
maxItems:
1
name
string
Name of the referent.
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
insecureSkipVerify
string
insecureSkipVerify originates TLS but skips verification of the backend's certificate.
WARNING: This is an insecure option that should only be used if the risks are understood.
There are two modes:
* All disables all TLS verification
* Hostname verifies the CA certificate is trusted, but ignores any mismatch of hostname/SANs. Note that this method
is still insecure; prefer setting verifySubjectAltNames to customize the valid hostnames if possible.
enum:
All, HostnamemtlsCertificateRef []object
mtlsCertificateRef enables mutual TLS to the backend, using the specified key (tls.key) and cert (tls.crt) from the
refenced Secret.
An optional 'ca.cert' field, if present, will be used to verify the server certificate if present. If
caCertificateRefs is also specified, the caCertificateRefs field takes priority.
If unspecified, no client certificate will be used.
maxItems:
1
name
string
Name of the referent.
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
sni
string
sni specifies the Server Name Indicator (SNI) to be used in the TLS handshake. If unset, the SNI is automatically
set based on the destination hostname.
pattern:
^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$minLength:
1maxLength:
253
verifySubjectAltNames
[]string
verifySubjectAltNames specifies the Subject Alternative Names (SAN) to verify in the server certificate.
If not present, the destination hostname is automatically used.
minItems:
1maxItems:
16
port
integer
Port specifies the port to send the requests to.
format:
int32minimum:
1maximum:
65535vertexai object
Vertex AI provider
model
string
Optional: Override the model name, such as `gpt-4o-mini`.
If unset, the model name is taken from the request.
minLength:
1maxLength:
256
projectId
string required
The ID of the Google Cloud Project that you use for the Vertex AI.
minLength:
1maxLength:
64
region
string required
The location of the Google Cloud Project that you use for the Vertex AI.
minLength:
1maxLength:
64provider object
provider specifies configuration for how to reach the configured LLM provider.
anthropic object
Anthropic provider
model
string
Optional: Override the model name, such as `gpt-4o-mini`.
If unset, the model name is taken from the request.
minLength:
1maxLength:
256azureopenai object
Azure OpenAI provider
apiVersion
string
The version of the Azure OpenAI API to use.
For more information, see the [Azure OpenAI API version reference](https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#api-specs).
If unset, defaults to "v1"
minLength:
1maxLength:
64
deploymentName
string
The name of the Azure OpenAI model deployment to use.
For more information, see the [Azure OpenAI model docs](https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/models).
This is required if ApiVersion is not 'v1'. For v1, the model can be set in the request.
minLength:
1maxLength:
256
endpoint
string required
The endpoint for the Azure OpenAI API to use, such as `my-endpoint.openai.azure.com`.
If the scheme is included, it is stripped.
minLength:
1maxLength:
256bedrock object
Bedrock provider
guardrail object
Guardrail configures the Guardrail policy to use for the backend. See <https://docs.aws.amazon.com/bedrock/latest/userguide/guardrails.html>
If not specified, the AWS Guardrail policy will not be used.
identifier
string required
GuardrailIdentifier is the identifier of the Guardrail policy to use for the backend.
minLength:
1maxLength:
256
version
string required
GuardrailVersion is the version of the Guardrail policy to use for the backend.
minLength:
1maxLength:
256
model
string
Optional: Override the model name, such as `gpt-4o-mini`.
If unset, the model name is taken from the request.
minLength:
1maxLength:
256
region
string
Region is the AWS region to use for the backend.
Defaults to us-east-1 if not specified.
pattern:
^[a-z0-9-]+$minLength:
1maxLength:
63gemini object
Gemini provider
model
string
Optional: Override the model name, such as `gemini-2.5-pro`.
If unset, the model name is taken from the request.
minLength:
1maxLength:
256
host
string
Host specifies the hostname to send the requests to.
If not specified, the default hostname for the provider is used.
minLength:
1maxLength:
256openai object
OpenAI provider
model
string
Optional: Override the model name, such as `gpt-4o-mini`.
If unset, the model name is taken from the request.
minLength:
1maxLength:
256
path
string
Path specifies the URL path to use for the LLM provider API requests.
This is useful when you need to route requests to a different API endpoint while maintaining
compatibility with the original provider's API structure.
If not specified, the default path for the provider is used.
minLength:
1maxLength:
1024
port
integer
Port specifies the port to send the requests to.
format:
int32minimum:
1maximum:
65535vertexai object
Vertex AI provider
model
string
Optional: Override the model name, such as `gpt-4o-mini`.
If unset, the model name is taken from the request.
minLength:
1maxLength:
256
projectId
string required
The ID of the Google Cloud Project that you use for the Vertex AI.
minLength:
1maxLength:
64
region
string required
The location of the Google Cloud Project that you use for the Vertex AI.
minLength:
1maxLength:
64
dynamicForwardProxy
object
dynamicForwardProxy configures the proxy to dynamically send requests to the destination based on the incoming
request HTTP host header, or TLS SNI for TLS traffic.
Note: this Backend type enables users to send trigger the proxy to send requests to arbitrary destinations. Proper
access controls must be put in place when using this backend type.
mcp object
mcp represents an MCP backend
sessionRouting
string
SessionRouting configures MCP session behavior for requests.
Defaults to Stateful if not set.
enum:
Stateful, Statelesstargets []object required
Targets is a list of MCPBackend targets to use for this backend.
Policies targeting MCPBackend targets must use targetRefs[].sectionName
to select the target by name.
minItems:
1maxItems:
32
name
string required
Name of the MCPBackend target.
pattern:
^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$minLength:
1maxLength:
253selector object
selector is a label selector is the selector to use to select Services.
If policies are needed on a per-service basis, AgentgatewayPolicy can target the desired Service.
namespaces object
namespace is the label selector in which namespaces Services should be selected from.
If unset, only the namespace of the AgentgatewayBackend is searched.
matchExpressions []object
matchExpressions is a list of label selector requirements. The requirements are ANDed.
key
string required
key is the label key that the selector applies to.
operator
string required
operator represents a key's relationship to a set of values.
Valid operators are In, NotIn, Exists and DoesNotExist.
values
[]string
values is an array of string values. If the operator is In or NotIn,
the values array must be non-empty. If the operator is Exists or DoesNotExist,
the values array must be empty. This array is replaced during a strategic
merge patch.
matchLabels
object
matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
map is equivalent to an element of matchExpressions, whose key field is "key", the
operator is "In", and the values array contains only "value". The requirements are ANDed.
services object
services is the label selector for which Services should be selected.
matchExpressions []object
matchExpressions is a list of label selector requirements. The requirements are ANDed.
key
string required
key is the label key that the selector applies to.
operator
string required
operator represents a key's relationship to a set of values.
Valid operators are In, NotIn, Exists and DoesNotExist.
values
[]string
values is an array of string values. If the operator is In or NotIn,
the values array must be non-empty. If the operator is Exists or DoesNotExist,
the values array must be empty. This array is replaced during a strategic
merge patch.
matchLabels
object
matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels
map is equivalent to an element of matchExpressions, whose key field is "key", the
operator is "In", and the values array contains only "value". The requirements are ANDed.
static object
static configures a static MCP destination. When connecting to in-cluster Services, it is recommended to use
'selector' instead.
host
string required
Host is the hostname or IP address of the MCPBackend target.
minLength:
1maxLength:
256
path
string
Path is the URL path of the MCPBackend target endpoint.
Defaults to "/sse" for SSE protocol or "/mcp" for StreamableHTTP protocol if not specified.
minLength:
1maxLength:
1024policies object
policies controls policies for communicating with this backend. Policies may also be set in AgentgatewayPolicy, or
in the top level AgentgatewayBackend. Policies are merged on a field-level basis, with order: AgentgatewayPolicy <
AgentgatewayBackend < AgentgatewayBackend MCP (this field).
auth object
auth defines settings for managing authentication to the backend
aws object
Auth specifies an explicit AWS authentication method for the backend.
When omitted, we will try to use the default AWS SDK authentication methods.
secretRef object required
SecretRef references a Kubernetes Secret containing the AWS credentials.
The Secret must have keys "accessKey", "secretKey", and optionally "sessionToken".
name
string
Name of the referent.
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
key
string
key provides an inline key to use as the value of the Authorization header.
This option is the least secure; usage of a Secret is preferred.
maxLength:
2048
passthrough
object
passthrough passes through an existing token that has been sent by the client and validated. Other policies, like
JWT and API Key authentication, will strip the original client credentials. Passthrough backend authentication
causes the original token to be added back into the request. If there are no client authentication policies on the
request, the original token would be unchanged, so this would have no effect.
secretRef object
secretRef references a Kubernetes secret storing the key to use the authorization value. This must be stored in the
'Authorization' key.
name
string
Name of the referent.
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
http object
http defines settings for managing HTTP requests to the backend.
requestTimeout
string
requestTimeout specifies the deadline for receiving a response from the backend.
version
string
version specifies the HTTP protocol version to use when connecting to the backend.
If not specified, the version is automatically determined:
* Service types can specify it with 'appProtocol' on the Service port.
* If traffic is identified as gRPC, HTTP2 is used.
* If the incoming traffic was plaintext HTTP, the original protocol will be used.
* If the incoming traffic was HTTPS, HTTP1 will be used. This is because most clients will
transparently upgrade HTTPS traffic to HTTP2, even if the backend doesn't support it
enum:
HTTP1, HTTP2mcp object
mcp specifies settings for MCP workloads. This is only applicable when connecting to a Backend of type 'mcp'.
authentication object
authentication defines MCPBackend specific authentication rules.
audiences
[]string
audiences specify the list of allowed audiences that are allowed access. This corresponds to the 'aud' claim (https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.3).
If unset, any audience is allowed.
minItems:
1maxItems:
64
issuer
string
Issuer identifies the IdP that issued the JWT. This corresponds to the 'iss' claim (https://tools.ietf.org/html/rfc7519#section-4.1.1).
minLength:
1maxLength:
256jwks object required
jwks defines the remote JSON Web Key used to validate the signature of the JWT.
backendRef object required
backendRef references the remote JWKS server to reach.
Supported types are Service and (static) Backend. An AgentgatewayPolicy containing backend tls config
can then be attached to the service/backend in order to set tls options for a connection to the remote jwks source.
group
string
Group is the group of the referent. For example, "gateway.networking.k8s.io".
When unspecified or empty string, core API group is inferred.
pattern:
^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$maxLength:
253
kind
string
Kind is the Kubernetes resource kind of the referent. For example
"Service".
Defaults to "Service" when not specified.
ExternalName services can refer to CNAME DNS records that may live
outside of the cluster and as such are difficult to reason about in
terms of conformance. They also may not be safe to forward to (see
CVE-2021-25740 for more information). Implementations SHOULD NOT
support ExternalName Services.
Support: Core (Services with a type other than ExternalName)
Support: Implementation-specific (Services with type ExternalName)
pattern:
^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$minLength:
1maxLength:
63
name
string required
Name is the name of the referent.
minLength:
1maxLength:
253
namespace
string
Namespace is the namespace of the backend. When unspecified, the local
namespace is inferred.
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.
Support: Core
pattern:
^[a-z0-9]([-a-z0-9]*[a-z0-9])?$minLength:
1maxLength:
63
port
integer
Port specifies the destination port number to use for this resource.
Port is required when the referent is a Kubernetes Service. In this
case, the port number is the service port number, not the target port.
For other resources, destination port might be derived from the referent
resource or this field.
format:
int32minimum:
1maximum:
65535
cacheDuration
string
jwksPath
string required
Path to IdP jwks endpoint, relative to the root, commonly ".well-known/jwks.json".
minLength:
1maxLength:
2000
mode
string
validation mode for JWT authentication.
enum:
Strict, Optional, Permissive
provider
string
McpIDP specifies the identity provider to use for authentication
enum:
Auth0, Keycloak
resourceMetadata
object
ResourceMetadata defines the metadata to use for MCP resources.
authorization object
authorization defines MCPBackend level authorization. Unlike authorization at the HTTP level, which will reject
unauthorized requests with a 403 error, this policy works at the MCPBackend level.
List operations, such as list_tools, will have each item evaluated. Items that do not meet the rule will be filtered.
Get or call operations, such as call_tool, will evaluate the specific item and reject requests that do not meet the rule.
action
string
Action defines whether the rule allows or denies the request if matched.
If unspecified, the default is "Allow".
enum:
Allow, Denypolicy object required
Policy specifies the Authorization rule to evaluate.
A policy matches when **any** of the conditions evaluates to true.
matchExpressions
[]string required
MatchExpressions defines a set of conditions that must be satisfied for the rule to match.
These expression should be in the form of a Common Expression Language (CEL) expression.
minItems:
1maxItems:
256tcp object
tcp defines settings for managing TCP connections to the backend.
connectTimeout
string
connectTimeout defines the deadline for establishing a connection to the destination.
keepalive object
keepAlive defines settings for enabling TCP keepalives on the connection.
interval
string
interval specifies the number of seconds between keep-alive probes.
If unset, this defaults to 180s.
retries
integer
retries specifies the maximum number of keep-alive probes to send before dropping the connection.
If unset, this defaults to 9.
format:
int32minimum:
1maximum:
64
time
string
time specifies the number of seconds a connection needs to be idle before keep-alive probes start being sent.
If unset, this defaults to 180s.
tls object
tls defines settings for managing TLS connections to the backend.
If this field is set, TLS will be initiated to the backend; the system trusted CA certificates will be used to
validate the server, and the SNI will automatically be set based on the destination.
alpnProtocols
[]string
alpnProtocols sets the Application Level Protocol Negotiation (ALPN) value to use in the TLS handshake.
If not present, defaults to ["h2", "http/1.1"].
minItems:
1maxItems:
16caCertificateRefs []object
caCertificateRefs defines the CA certificate ConfigMap to use to verify the server certificate.
If unset, the system's trusted certificates are used.
maxItems:
1
name
string
Name of the referent.
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
insecureSkipVerify
string
insecureSkipVerify originates TLS but skips verification of the backend's certificate.
WARNING: This is an insecure option that should only be used if the risks are understood.
There are two modes:
* All disables all TLS verification
* Hostname verifies the CA certificate is trusted, but ignores any mismatch of hostname/SANs. Note that this method
is still insecure; prefer setting verifySubjectAltNames to customize the valid hostnames if possible.
enum:
All, HostnamemtlsCertificateRef []object
mtlsCertificateRef enables mutual TLS to the backend, using the specified key (tls.key) and cert (tls.crt) from the
refenced Secret.
An optional 'ca.cert' field, if present, will be used to verify the server certificate if present. If
caCertificateRefs is also specified, the caCertificateRefs field takes priority.
If unspecified, no client certificate will be used.
maxItems:
1
name
string
Name of the referent.
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
sni
string
sni specifies the Server Name Indicator (SNI) to be used in the TLS handshake. If unset, the SNI is automatically
set based on the destination hostname.
pattern:
^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$minLength:
1maxLength:
253
verifySubjectAltNames
[]string
verifySubjectAltNames specifies the Subject Alternative Names (SAN) to verify in the server certificate.
If not present, the destination hostname is automatically used.
minItems:
1maxItems:
16
port
integer required
Port is the port number of the MCPBackend target.
format:
int32minimum:
1maximum:
65535
protocol
string
Protocol is the protocol to use for the connection to the MCPBackend target.
enum:
StreamableHTTP, SSEpolicies object
policies controls policies for communicating with this backend. Policies may also be set in AgentgatewayPolicy;
policies are merged on a field-level basis, with policies on the Backend (this field) taking precedence.
ai object
ai specifies settings for AI workloads. This is only applicable when connecting to a Backend of type 'ai'.
defaults []object
Provide defaults to merge with user input fields. If the field is already set, the field in the request is used.
minItems:
1maxItems:
64
field
string required
The name of the field.
minLength:
1maxLength:
256
value
object required
The field default value, which can be any JSON Data Type.
modelAliases
object
ModelAliases maps friendly model names to actual provider model names.
Example: {"fast": "gpt-3.5-turbo", "smart": "gpt-4-turbo"}
Note: This field is only applicable when using the agentgateway data plane.
overrides []object
Provide overrides to merge with user input fields. If the field is already set, the field will be overwritten.
minItems:
1maxItems:
64
field
string required
The name of the field.
minLength:
1maxLength:
256
value
object required
The field default value, which can be any JSON Data Type.
prompt object
Enrich requests sent to the LLM provider by appending and prepending system prompts. This can be configured only for
LLM providers that use the `CHAT` or `CHAT_STREAMING` API route type.
append []object
A list of messages to be appended to the prompt sent by the client.
content
string required
String content of the message.
role
string required
Role of the message. The available roles depend on the backend
LLM provider model, such as `SYSTEM` or `USER` in the OpenAI API.
prepend []object
A list of messages to be prepended to the prompt sent by the client.
content
string required
String content of the message.
role
string required
Role of the message. The available roles depend on the backend
LLM provider model, such as `SYSTEM` or `USER` in the OpenAI API.
promptCaching object
promptCaching enables automatic prompt caching for supported providers (AWS Bedrock).
Reduces API costs by caching static content like system prompts and tool definitions.
Only applicable for Bedrock Claude 3+ and Nova models.
cacheMessages
boolean
CacheMessages enables caching for conversation messages.
Caches all messages in the conversation for cost savings.
cacheSystem
boolean
CacheSystem enables caching for system prompts.
Inserts a cache point after all system messages.
cacheTools
boolean
CacheTools enables caching for tool definitions.
Inserts a cache point after all tool specifications.
minTokens
integer
MinTokens specifies the minimum estimated token count
before caching is enabled. Uses rough heuristic (word count × 1.3) to estimate tokens.
Bedrock requires at least 1,024 tokens for caching to be effective.
minimum:
0promptGuard object
promptGuard enables adding guardrails to LLM requests and responses.
request []object
Prompt guards to apply to requests sent by the client.
minItems:
1maxItems:
8openAIModeration object
openAIModeration passes prompt data through the OpenAI Moderations endpoint.
See https://platform.openai.com/docs/api-reference/moderations for more information.
model
string
model specifies the moderation model to use. For example, `omni-moderation`.
policies object
policies controls policies for communicating with OpenAI.
auth object
auth defines settings for managing authentication to the backend
aws object
Auth specifies an explicit AWS authentication method for the backend.
When omitted, we will try to use the default AWS SDK authentication methods.
secretRef object required
SecretRef references a Kubernetes Secret containing the AWS credentials.
The Secret must have keys "accessKey", "secretKey", and optionally "sessionToken".
name
string
Name of the referent.
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
key
string
key provides an inline key to use as the value of the Authorization header.
This option is the least secure; usage of a Secret is preferred.
maxLength:
2048
passthrough
object
passthrough passes through an existing token that has been sent by the client and validated. Other policies, like
JWT and API Key authentication, will strip the original client credentials. Passthrough backend authentication
causes the original token to be added back into the request. If there are no client authentication policies on the
request, the original token would be unchanged, so this would have no effect.
secretRef object
secretRef references a Kubernetes secret storing the key to use the authorization value. This must be stored in the
'Authorization' key.
name
string
Name of the referent.
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
http object
http defines settings for managing HTTP requests to the backend.
requestTimeout
string
requestTimeout specifies the deadline for receiving a response from the backend.
version
string
version specifies the HTTP protocol version to use when connecting to the backend.
If not specified, the version is automatically determined:
* Service types can specify it with 'appProtocol' on the Service port.
* If traffic is identified as gRPC, HTTP2 is used.
* If the incoming traffic was plaintext HTTP, the original protocol will be used.
* If the incoming traffic was HTTPS, HTTP1 will be used. This is because most clients will
transparently upgrade HTTPS traffic to HTTP2, even if the backend doesn't support it
enum:
HTTP1, HTTP2tcp object
tcp defines settings for managing TCP connections to the backend.
connectTimeout
string
connectTimeout defines the deadline for establishing a connection to the destination.
keepalive object
keepAlive defines settings for enabling TCP keepalives on the connection.
interval
string
interval specifies the number of seconds between keep-alive probes.
If unset, this defaults to 180s.
retries
integer
retries specifies the maximum number of keep-alive probes to send before dropping the connection.
If unset, this defaults to 9.
format:
int32minimum:
1maximum:
64
time
string
time specifies the number of seconds a connection needs to be idle before keep-alive probes start being sent.
If unset, this defaults to 180s.
tls object
tls defines settings for managing TLS connections to the backend.
If this field is set, TLS will be initiated to the backend; the system trusted CA certificates will be used to
validate the server, and the SNI will automatically be set based on the destination.
alpnProtocols
[]string
alpnProtocols sets the Application Level Protocol Negotiation (ALPN) value to use in the TLS handshake.
If not present, defaults to ["h2", "http/1.1"].
minItems:
1maxItems:
16caCertificateRefs []object
caCertificateRefs defines the CA certificate ConfigMap to use to verify the server certificate.
If unset, the system's trusted certificates are used.
maxItems:
1
name
string
Name of the referent.
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
insecureSkipVerify
string
insecureSkipVerify originates TLS but skips verification of the backend's certificate.
WARNING: This is an insecure option that should only be used if the risks are understood.
There are two modes:
* All disables all TLS verification
* Hostname verifies the CA certificate is trusted, but ignores any mismatch of hostname/SANs. Note that this method
is still insecure; prefer setting verifySubjectAltNames to customize the valid hostnames if possible.
enum:
All, HostnamemtlsCertificateRef []object
mtlsCertificateRef enables mutual TLS to the backend, using the specified key (tls.key) and cert (tls.crt) from the
refenced Secret.
An optional 'ca.cert' field, if present, will be used to verify the server certificate if present. If
caCertificateRefs is also specified, the caCertificateRefs field takes priority.
If unspecified, no client certificate will be used.
maxItems:
1
name
string
Name of the referent.
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
sni
string
sni specifies the Server Name Indicator (SNI) to be used in the TLS handshake. If unset, the SNI is automatically
set based on the destination hostname.
pattern:
^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$minLength:
1maxLength:
253
verifySubjectAltNames
[]string
verifySubjectAltNames specifies the Subject Alternative Names (SAN) to verify in the server certificate.
If not present, the destination hostname is automatically used.
minItems:
1maxItems:
16regex object
Regular expression (regex) matching for prompt guards and data masking.
action
string
The action to take if a regex pattern is matched in a request or response.
This setting applies only to request matches. PromptguardResponse matches are always masked by default.
Defaults to `Mask`.
enum:
Mask, Reject
builtins
[]string
A list of built-in regex patterns to match against the request or response.
Matches and built-ins are additive.
matches
[]string
A list of regex patterns to match against the request or response.
Matches and built-ins are additive.
response object
A custom response message to return to the client. If not specified, defaults to
"The request was rejected due to inappropriate content".
message
string
A custom response message to return to the client. If not specified, defaults to
"The request was rejected due to inappropriate content".
statusCode
integer
The status code to return to the client. Defaults to 403.
format:
int32minimum:
200maximum:
599webhook object
Configure a webhook to forward requests to for prompt guarding.
backendRef object required
backendRef references the webhook server to reach.
Supported types: Service and Backend.
group
string
Group is the group of the referent. For example, "gateway.networking.k8s.io".
When unspecified or empty string, core API group is inferred.
pattern:
^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$maxLength:
253
kind
string
Kind is the Kubernetes resource kind of the referent. For example
"Service".
Defaults to "Service" when not specified.
ExternalName services can refer to CNAME DNS records that may live
outside of the cluster and as such are difficult to reason about in
terms of conformance. They also may not be safe to forward to (see
CVE-2021-25740 for more information). Implementations SHOULD NOT
support ExternalName Services.
Support: Core (Services with a type other than ExternalName)
Support: Implementation-specific (Services with type ExternalName)
pattern:
^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$minLength:
1maxLength:
63
name
string required
Name is the name of the referent.
minLength:
1maxLength:
253
namespace
string
Namespace is the namespace of the backend. When unspecified, the local
namespace is inferred.
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.
Support: Core
pattern:
^[a-z0-9]([-a-z0-9]*[a-z0-9])?$minLength:
1maxLength:
63
port
integer
Port specifies the destination port number to use for this resource.
Port is required when the referent is a Kubernetes Service. In this
case, the port number is the service port number, not the target port.
For other resources, destination port might be derived from the referent
resource or this field.
format:
int32minimum:
1maximum:
65535forwardHeaderMatches []object
ForwardHeaderMatches defines a list of HTTP header matches that will be
used to select the headers to forward to the webhook.
Request headers are used when forwarding requests and response headers
are used when forwarding responses.
By default, no headers are forwarded.
name
string required
Name is the name of the HTTP Header to be matched. Name matching MUST be
case-insensitive. (See https://tools.ietf.org/html/rfc7230#section-3.2).
If multiple entries specify equivalent header names, only the first
entry with an equivalent name MUST be considered for a match. Subsequent
entries with an equivalent header name MUST be ignored. Due to the
case-insensitivity of header names, "foo" and "Foo" are considered
equivalent.
When a header is repeated in an HTTP request, it is
implementation-specific behavior as to how this is represented.
Generally, proxies should follow the guidance from the RFC:
https://www.rfc-editor.org/rfc/rfc7230.html#section-3.2.2 regarding
processing a repeated header, with special handling for "Set-Cookie".
pattern:
^[A-Za-z0-9!#$%&'*+\-.^_\x60|~]+$minLength:
1maxLength:
256
type
string
Type specifies how to match against the value of the header.
Support: Core (Exact)
Support: Implementation-specific (RegularExpression)
Since RegularExpression HeaderMatchType has implementation-specific
conformance, implementations can support POSIX, PCRE or any other dialects
of regular expressions. Please read the implementation's documentation to
determine the supported dialect.
enum:
Exact, RegularExpression
value
string required
Value is the value of HTTP Header to be matched.
minLength:
1maxLength:
4096response []object
Prompt guards to apply to responses returned by the LLM provider.
minItems:
1maxItems:
8regex object
Regular expression (regex) matching for prompt guards and data masking.
action
string
The action to take if a regex pattern is matched in a request or response.
This setting applies only to request matches. PromptguardResponse matches are always masked by default.
Defaults to `Mask`.
enum:
Mask, Reject
builtins
[]string
A list of built-in regex patterns to match against the request or response.
Matches and built-ins are additive.
matches
[]string
A list of regex patterns to match against the request or response.
Matches and built-ins are additive.
response object
A custom response message to return to the client. If not specified, defaults to
"The response was rejected due to inappropriate content".
message
string
A custom response message to return to the client. If not specified, defaults to
"The request was rejected due to inappropriate content".
statusCode
integer
The status code to return to the client. Defaults to 403.
format:
int32minimum:
200maximum:
599webhook object
Configure a webhook to forward responses to for prompt guarding.
backendRef object required
backendRef references the webhook server to reach.
Supported types: Service and Backend.
group
string
Group is the group of the referent. For example, "gateway.networking.k8s.io".
When unspecified or empty string, core API group is inferred.
pattern:
^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$maxLength:
253
kind
string
Kind is the Kubernetes resource kind of the referent. For example
"Service".
Defaults to "Service" when not specified.
ExternalName services can refer to CNAME DNS records that may live
outside of the cluster and as such are difficult to reason about in
terms of conformance. They also may not be safe to forward to (see
CVE-2021-25740 for more information). Implementations SHOULD NOT
support ExternalName Services.
Support: Core (Services with a type other than ExternalName)
Support: Implementation-specific (Services with type ExternalName)
pattern:
^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$minLength:
1maxLength:
63
name
string required
Name is the name of the referent.
minLength:
1maxLength:
253
namespace
string
Namespace is the namespace of the backend. When unspecified, the local
namespace is inferred.
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.
Support: Core
pattern:
^[a-z0-9]([-a-z0-9]*[a-z0-9])?$minLength:
1maxLength:
63
port
integer
Port specifies the destination port number to use for this resource.
Port is required when the referent is a Kubernetes Service. In this
case, the port number is the service port number, not the target port.
For other resources, destination port might be derived from the referent
resource or this field.
format:
int32minimum:
1maximum:
65535forwardHeaderMatches []object
ForwardHeaderMatches defines a list of HTTP header matches that will be
used to select the headers to forward to the webhook.
Request headers are used when forwarding requests and response headers
are used when forwarding responses.
By default, no headers are forwarded.
name
string required
Name is the name of the HTTP Header to be matched. Name matching MUST be
case-insensitive. (See https://tools.ietf.org/html/rfc7230#section-3.2).
If multiple entries specify equivalent header names, only the first
entry with an equivalent name MUST be considered for a match. Subsequent
entries with an equivalent header name MUST be ignored. Due to the
case-insensitivity of header names, "foo" and "Foo" are considered
equivalent.
When a header is repeated in an HTTP request, it is
implementation-specific behavior as to how this is represented.
Generally, proxies should follow the guidance from the RFC:
https://www.rfc-editor.org/rfc/rfc7230.html#section-3.2.2 regarding
processing a repeated header, with special handling for "Set-Cookie".
pattern:
^[A-Za-z0-9!#$%&'*+\-.^_\x60|~]+$minLength:
1maxLength:
256
type
string
Type specifies how to match against the value of the header.
Support: Core (Exact)
Support: Implementation-specific (RegularExpression)
Since RegularExpression HeaderMatchType has implementation-specific
conformance, implementations can support POSIX, PCRE or any other dialects
of regular expressions. Please read the implementation's documentation to
determine the supported dialect.
enum:
Exact, RegularExpression
value
string required
Value is the value of HTTP Header to be matched.
minLength:
1maxLength:
4096
routes
object
routes defines how to identify the type of traffic to handle.
The keys are URL path suffixes matched using ends-with comparison (e.g., "/v1/chat/completions").
The special "*" wildcard matches any path.
If not specified, all traffic defaults to "completions" type.
auth object
auth defines settings for managing authentication to the backend
aws object
Auth specifies an explicit AWS authentication method for the backend.
When omitted, we will try to use the default AWS SDK authentication methods.
secretRef object required
SecretRef references a Kubernetes Secret containing the AWS credentials.
The Secret must have keys "accessKey", "secretKey", and optionally "sessionToken".
name
string
Name of the referent.
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
key
string
key provides an inline key to use as the value of the Authorization header.
This option is the least secure; usage of a Secret is preferred.
maxLength:
2048
passthrough
object
passthrough passes through an existing token that has been sent by the client and validated. Other policies, like
JWT and API Key authentication, will strip the original client credentials. Passthrough backend authentication
causes the original token to be added back into the request. If there are no client authentication policies on the
request, the original token would be unchanged, so this would have no effect.
secretRef object
secretRef references a Kubernetes secret storing the key to use the authorization value. This must be stored in the
'Authorization' key.
name
string
Name of the referent.
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
http object
http defines settings for managing HTTP requests to the backend.
requestTimeout
string
requestTimeout specifies the deadline for receiving a response from the backend.
version
string
version specifies the HTTP protocol version to use when connecting to the backend.
If not specified, the version is automatically determined:
* Service types can specify it with 'appProtocol' on the Service port.
* If traffic is identified as gRPC, HTTP2 is used.
* If the incoming traffic was plaintext HTTP, the original protocol will be used.
* If the incoming traffic was HTTPS, HTTP1 will be used. This is because most clients will
transparently upgrade HTTPS traffic to HTTP2, even if the backend doesn't support it
enum:
HTTP1, HTTP2mcp object
mcp specifies settings for MCP workloads. This is only applicable when connecting to a Backend of type 'mcp'.
authentication object
authentication defines MCPBackend specific authentication rules.
audiences
[]string
audiences specify the list of allowed audiences that are allowed access. This corresponds to the 'aud' claim (https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.3).
If unset, any audience is allowed.
minItems:
1maxItems:
64
issuer
string
Issuer identifies the IdP that issued the JWT. This corresponds to the 'iss' claim (https://tools.ietf.org/html/rfc7519#section-4.1.1).
minLength:
1maxLength:
256jwks object required
jwks defines the remote JSON Web Key used to validate the signature of the JWT.
backendRef object required
backendRef references the remote JWKS server to reach.
Supported types are Service and (static) Backend. An AgentgatewayPolicy containing backend tls config
can then be attached to the service/backend in order to set tls options for a connection to the remote jwks source.
group
string
Group is the group of the referent. For example, "gateway.networking.k8s.io".
When unspecified or empty string, core API group is inferred.
pattern:
^$|^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$maxLength:
253
kind
string
Kind is the Kubernetes resource kind of the referent. For example
"Service".
Defaults to "Service" when not specified.
ExternalName services can refer to CNAME DNS records that may live
outside of the cluster and as such are difficult to reason about in
terms of conformance. They also may not be safe to forward to (see
CVE-2021-25740 for more information). Implementations SHOULD NOT
support ExternalName Services.
Support: Core (Services with a type other than ExternalName)
Support: Implementation-specific (Services with type ExternalName)
pattern:
^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$minLength:
1maxLength:
63
name
string required
Name is the name of the referent.
minLength:
1maxLength:
253
namespace
string
Namespace is the namespace of the backend. When unspecified, the local
namespace is inferred.
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.
Support: Core
pattern:
^[a-z0-9]([-a-z0-9]*[a-z0-9])?$minLength:
1maxLength:
63
port
integer
Port specifies the destination port number to use for this resource.
Port is required when the referent is a Kubernetes Service. In this
case, the port number is the service port number, not the target port.
For other resources, destination port might be derived from the referent
resource or this field.
format:
int32minimum:
1maximum:
65535
cacheDuration
string
jwksPath
string required
Path to IdP jwks endpoint, relative to the root, commonly ".well-known/jwks.json".
minLength:
1maxLength:
2000
mode
string
validation mode for JWT authentication.
enum:
Strict, Optional, Permissive
provider
string
McpIDP specifies the identity provider to use for authentication
enum:
Auth0, Keycloak
resourceMetadata
object
ResourceMetadata defines the metadata to use for MCP resources.
authorization object
authorization defines MCPBackend level authorization. Unlike authorization at the HTTP level, which will reject
unauthorized requests with a 403 error, this policy works at the MCPBackend level.
List operations, such as list_tools, will have each item evaluated. Items that do not meet the rule will be filtered.
Get or call operations, such as call_tool, will evaluate the specific item and reject requests that do not meet the rule.
action
string
Action defines whether the rule allows or denies the request if matched.
If unspecified, the default is "Allow".
enum:
Allow, Denypolicy object required
Policy specifies the Authorization rule to evaluate.
A policy matches when **any** of the conditions evaluates to true.
matchExpressions
[]string required
MatchExpressions defines a set of conditions that must be satisfied for the rule to match.
These expression should be in the form of a Common Expression Language (CEL) expression.
minItems:
1maxItems:
256tcp object
tcp defines settings for managing TCP connections to the backend.
connectTimeout
string
connectTimeout defines the deadline for establishing a connection to the destination.
keepalive object
keepAlive defines settings for enabling TCP keepalives on the connection.
interval
string
interval specifies the number of seconds between keep-alive probes.
If unset, this defaults to 180s.
retries
integer
retries specifies the maximum number of keep-alive probes to send before dropping the connection.
If unset, this defaults to 9.
format:
int32minimum:
1maximum:
64
time
string
time specifies the number of seconds a connection needs to be idle before keep-alive probes start being sent.
If unset, this defaults to 180s.
tls object
tls defines settings for managing TLS connections to the backend.
If this field is set, TLS will be initiated to the backend; the system trusted CA certificates will be used to
validate the server, and the SNI will automatically be set based on the destination.
alpnProtocols
[]string
alpnProtocols sets the Application Level Protocol Negotiation (ALPN) value to use in the TLS handshake.
If not present, defaults to ["h2", "http/1.1"].
minItems:
1maxItems:
16caCertificateRefs []object
caCertificateRefs defines the CA certificate ConfigMap to use to verify the server certificate.
If unset, the system's trusted certificates are used.
maxItems:
1
name
string
Name of the referent.
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
insecureSkipVerify
string
insecureSkipVerify originates TLS but skips verification of the backend's certificate.
WARNING: This is an insecure option that should only be used if the risks are understood.
There are two modes:
* All disables all TLS verification
* Hostname verifies the CA certificate is trusted, but ignores any mismatch of hostname/SANs. Note that this method
is still insecure; prefer setting verifySubjectAltNames to customize the valid hostnames if possible.
enum:
All, HostnamemtlsCertificateRef []object
mtlsCertificateRef enables mutual TLS to the backend, using the specified key (tls.key) and cert (tls.crt) from the
refenced Secret.
An optional 'ca.cert' field, if present, will be used to verify the server certificate if present. If
caCertificateRefs is also specified, the caCertificateRefs field takes priority.
If unspecified, no client certificate will be used.
maxItems:
1
name
string
Name of the referent.
This field is effectively required, but due to backwards compatibility is
allowed to be empty. Instances of this type with an empty value here are
almost certainly wrong.
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
sni
string
sni specifies the Server Name Indicator (SNI) to be used in the TLS handshake. If unset, the SNI is automatically
set based on the destination hostname.
pattern:
^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$minLength:
1maxLength:
253
verifySubjectAltNames
[]string
verifySubjectAltNames specifies the Subject Alternative Names (SAN) to verify in the server certificate.
If not present, the destination hostname is automatically used.
minItems:
1maxItems:
16static object
static represents a static hostname.
host
string required
host to connect to.
minLength:
1maxLength:
256
port
integer required
port to connect to.
format:
int32minimum:
1maximum:
65535status object
status defines the current state of AgentgatewayBackend.
conditions []object
Conditions is the list of conditions for the backend.
maxItems:
8
lastTransitionTime
string required
lastTransitionTime is the last time the condition transitioned from one status to another.
This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable.
format:
date-time
message
string required
message is a human readable message indicating details about the transition.
This may be an empty string.
maxLength:
32768
observedGeneration
integer
observedGeneration represents the .metadata.generation that the condition was set based upon.
For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
with respect to the current state of the instance.
format:
int64minimum:
0
reason
string required
reason contains a programmatic identifier indicating the reason for the condition's last transition.
Producers of specific condition types may define expected values and meanings for this field,
and whether the values are considered a guaranteed API.
The value should be a CamelCase string.
This field may not be empty.
pattern:
^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$minLength:
1maxLength:
1024
status
string required
status of the condition, one of True, False, Unknown.
enum:
True, False, Unknown
type
string required
type of condition in CamelCase or in foo.example.com/CamelCase.
pattern:
^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$maxLength:
316No matches. Try .spec.ai for an exact path