Skip to content

Support regex path for Ingress resource #4089

@brianehlert

Description

@brianehlert

The VirtualServer / VirtualServerRoute resources properly support regular expressions for path.
Folks that rely on the Ingress resource would also like the benefit of being able to use regular expressions in paths.

This is complicated by the fact that the Ingress resource definition says that a path must being with a "/" and thus the regular expression pattern of beginning with a "~" is tossed away by the K8s API if anyone attempts to place a regular expression directly in the path field of an Ingress.
Since the VirtualServer/VirtualServerRoute are owned by the NGINX Ingress Controller project, they support the possibility of containing a leading "~" which makes the object usage very intuitive.

The K8s community ingress controller works around the limitation of the K8s Ingress object by using a special annotation which inserts "~*" and prepends "^" in front of the path in the nginx.conf. While this is effective, it is a bit of magic that is the result of Ingress itself not supporting regex paths directly. More about this can be reviewed here: https://kubernetes.github.io/ingress-nginx/user-guide/ingress-path-matching/

The proposal is to implement support for regular expression paths with the Ingress object.
This would include:

  • introduce an annotation
  • add unit tests

This project primarily supports nginx.org/nginx.com annotations, except for one.
That is primarily based on history and to reinforce that the implementations are unique, and some capabilities may not be implemented in the exact same way.
I suggest that we stick with nginx.org annotations for this to reduce confusion between the two projects and that this project would be supporting annotations from multiple namespaces.
Even then; nginx.org is used for annotations that are supported with NGINX OSS as well as NGINX Plus, and nginx.com is for capabilities that are exclusive to NGINX Plus.

Metadata

Metadata

Assignees

Labels

backlogPull requests/issues that are backlog itemsproposalAn issue that proposes a feature request

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions