-
Notifications
You must be signed in to change notification settings - Fork 668
Open
Description
kgateway version
v2.1.2
Kubernetes Version
v1.33
Describe the bug
Environment
- kgateway Version: v2.1.2
- Kubernetes Version: 1.33
- Platform: AWS EKS
- Installation Method: Helm
Description
The kgateway documentation shows TrafficPolicy with a urlRewrite.pathRegex field for regex-based URL path rewriting, but this field does not exist in the actual v2.1.2 CRD and is rejected by the API server.
Attempting to create this TrafficPolicy results in an API error:
Error from server (BadRequest): error when creating "STDIN": TrafficPolicy in version "v1alpha1" cannot be handled as a TrafficPolicy: strict decoding error: unknown field "spec.urlRewrite"
CRD Investigation
Available fields in TrafficPolicy v2.1.2:
$ kubectl explain trafficpolicy.spec --api-version=gateway.kgateway.dev/v1alpha1Output:
aiautoHostRewritebuffercorscsrfextAuthextProcheaderModifiersrateLimitrbacretrytargetRefstargetSelectorstimeoutstransformation
The urlRewrite field is NOT present.
Questions
- Is
urlRewrite.pathRegexplanned for a future version? If so, which version? - Is the documentation incorrect or ahead of the actual release?
- What is the recommended approach for regex-based URL rewriting in v2.1.2?
- Is there a migration path from ingress-nginx annotations like
rewrite-target: /$2with regex patterns?
Expected Behavior
Expected Behavior (According to Documentation)
Documentation source: https://kgateway.dev/docs/envoy/latest/traffic-management/rewrite/path/#regex-rewrite
The TrafficPolicy CRD should support regex-based URL rewriting with capture groups:
apiVersion: gateway.kgateway.dev/v1alpha1
kind: TrafficPolicy
metadata:
name: url-rewrite-policy
namespace: default
spec:
targetRefs:
- group: gateway.networking.k8s.io
kind: HTTPRoute
name: api-route
urlRewrite:
pathRegex:
pattern: "^/api/v1/users/([0-9]+)/posts/([0-9]+)$"
substitution: "/internal/user/\\1/post/\\2"Steps to reproduce the bug
Reproduction Steps
- Install kgateway v2.1.2
- Create an HTTPRoute
- Attempt to create a TrafficPolicy with
urlRewrite.pathRegex:
apiVersion: gateway.kgateway.dev/v1alpha1
kind: TrafficPolicy
metadata:
name: test-rewrite
namespace: gateway-poc-test
spec:
targetRefs:
- group: gateway.networking.k8s.io
kind: HTTPRoute
name: test-route
urlRewrite:
pathRegex:
pattern: "^/old/(.*)$"
substitution: "/new/\\1"- Observe API rejection error
Additional Environment Detail
No response
Additional Context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels