Skip to content

Conversation

@npolshakova
Copy link
Contributor

Description

Fixes #13173

Change Type

/kind fix

Changelog

Fixed the AI prompt guard api to align with other enums `MASK` is now `Mask` and `REJECT` is now `Reject`. These are enforced by CEL in the API.  

Copilot AI review requested due to automatic review settings December 18, 2025 18:24
@npolshakova npolshakova requested a review from a team as a code owner December 18, 2025 18:24
@gateway-bot gateway-bot added kind/fix Categorizes issue or PR as related to a bug. release-note labels Dec 18, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the AI prompt guard enum values to align with the project's naming conventions for enums. The constants MASK and REJECT are updated to use Pascal case (Mask and Reject), and corresponding enum validation is added to enforce these values in the Kubernetes API.

  • Updated Action enum constants from MASK/REJECT to Mask/Reject in the Go API
  • Added kubebuilder validation annotation to enforce the new enum values
  • Added explicit enum constraints to CRD templates for AgentgatewayPolicy and AgentgatewayBackend

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
api/v1alpha1/agentgateway/ai_policy.go Updated Action enum constant values from uppercase to Pascal case and added kubebuilder validation annotation
install/helm/agentgateway-crds/templates/agentgateway.dev_agentgatewaypolicies.yaml Added enum validation constraints for Action field in request and response prompt guard configurations
install/helm/agentgateway-crds/templates/agentgateway.dev_agentgatewaybackends.yaml Added enum validation constraints for Action field across multiple prompt guard configuration locations in the backend CRD

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: npolshakova <[email protected]>

fix tests

Signed-off-by: npolshakova <[email protected]>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the only test that uses the enum names?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep!

@npolshakova npolshakova added this pull request to the merge queue Dec 18, 2025
Merged via the queue into kgateway-dev:main with commit b93836f Dec 18, 2025
30 checks passed
@npolshakova npolshakova deleted the fix-ai-policy-enums branch December 18, 2025 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/fix Categorizes issue or PR as related to a bug. release-note

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AgentgatewayPolicy backend.ai.promptGuard.request.regex.action should be an Enum

5 participants