NGINX Ingress Controller for multiple service for branch wise deployment
Nginx ingress don't work in this way, is not possible to have regex in serviceName
neither host
.
From NGINX docs:
Regular expressions and wild cards are not supported in the
spec.rules.host
field. Full hostnames must be used.
You can use regex only in path
field:
The ingress controller supports case insensitive regular expressions in the
spec.rules.http.paths.path
field. This can be enabled by setting thenginx.ingress.kubernetes.io/use-regex
annotation totrue
(the default is false).
If you need to control your serviceName
and host
dinamically I strong recommend use some kind of automation (could be jenkins, bash script etc...) or templates by HELM which will modify at deployment time.
References:
https://kubernetes.github.io/ingress-nginx/user-guide/ingress-path-matching/