Skip to content

Virtual Server validation does not reject regex subroute paths that do not match virtual server path  #4727

@haywoodsh

Description

@haywoodsh

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

Metadata

Metadata

Labels

backlogPull requests/issues that are backlog itemsbugAn issue reporting a potential bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions