Skip to main content

AIPolicy

AIPolicy binds a set of principal matchers (the access list) and a forward-compatible MCP policy on a target AIGateway. Intended to be edited frequently by help-desk admins through the management API; RBAC is scoped separately from AIGateway so the admin API need not touch gateway infrastructure.

API: ai-gateway.stacklok.dev/v1alpha1 · Scope: Namespaced · Short names: aipol

Example

aipolicy.yaml
apiVersion: ai-gateway.stacklok.dev/v1alpha1
kind: AIPolicy
metadata:
name: my-aipolicy
namespace: default
spec:
gatewayRef:
name: <string>
principalMatchers:
- claims: {}

Schema

spec

AIPolicySpec defines the desired state of an AIPolicy.

FieldTypeDescription
descriptionstring

Description is a free-form human-readable description of this policy.


maxLength 2048
gatewayRefrequiredobject

GatewayRef is the AIGateway in the same namespace this policy targets.

mcpPolicyobject

MCPPolicy binds matched principals to a set of MCP servers. Present for forward compatibility; the Phase 8 operator does not enforce MCP access. The field is named mcpPolicy (not allowedMCPServers) so the schema can expand to tool- and resource-level bindings without churn when MCP enforcement lands.

principalMatchersrequiredobject[]

PrincipalMatchers identifies the principals this policy applies to. Matchers combine as OR; claims within a matcher combine as AND.

spec.gatewayRef

GatewayRef is the AIGateway in the same namespace this policy targets.

FieldTypeDescription
namerequiredstring

Name of the referenced resource.

spec.mcpPolicy

MCPPolicy binds matched principals to a set of MCP servers. Present for forward compatibility; the Phase 8 operator does not enforce MCP access. The field is named mcpPolicy (not allowedMCPServers) so the schema can expand to tool- and resource-level bindings without churn when MCP enforcement lands.

FieldTypeDescription
serversstring[]

Servers is the list of MCP server names matched principals may use.

spec.principalMatchers[]

PrincipalMatchers identifies the principals this policy applies to. Matchers combine as OR; claims within a matcher combine as AND.

FieldTypeDescription
claimsrequiredmap<string, string>

Claims maps claim name to the expected value. At least one claim is required.

status

AIPolicyStatus defines the observed state of an AIPolicy.

FieldTypeDescription
appliedToSecurityPolicystring

AppliedToSecurityPolicy is the name of the SecurityPolicy into which this policy's authorization rules were fanned out.

conditionsobject[]

Conditions represent the latest available observations of the AIPolicy's state.

observedGenerationinteger

ObservedGeneration is the most recent generation observed by the controller.


format int64

status.conditions[]

Conditions represent the latest available observations of the AIPolicy's state.

FieldTypeDescription
lastTransitionTimerequiredstring

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
messagerequiredstring

message is a human readable message indicating details about the transition. This may be an empty string.


maxLength 32768
observedGenerationinteger

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 int64 · min 0
reasonrequiredstring

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 1 · maxLength 1024
statusrequiredstring

status of the condition, one of True, False, Unknown.


enum: True | False | Unknown
typerequiredstring

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 316

References: