-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
Describe the bug
In virtual server validation, if a virtual server route does not have the virtual server path as prefix, it will be rejected. In the specific where the subroute is a regex path, however, the validation fails to reject an invalid virtual server route definition, where a subroute path does not have the virtual server path as prefix.
To Reproduce
Steps to reproduce the behavior:
deploy the following virtual server and virtual server route:
Virtual server path:
- path: /team1/map/
route: team1/map-ingress
virtual server route:
spec:
host: xyz-x.fqdn
upstreams:
- name: map-svc
service map-svc
port: 80
subroutes:
- path: ~*^/map(/|$)(.*)
action:
proxy:
upstream: map-svc
rewritePath: /$2
Expected behavior
The virtual server route with incorrect subroute path should be rejected during validation
Additional context
This could be the possible code snippet that should return an error message but does not.
https://github.com/nginxinc/kubernetes-ingress/blob/main/pkg/apis/configuration/validation/virtualserver.go#L1482-L1485