I'm trying to implement an ingress helm template encoding the current application version into the url. This shall allow users to do soft migration by providing them different versions of the application.
Example:
mydomain.org/1.0/applicationpath
mydomain.org/1.1/applicationpath
mydomain.org/2.0/applicationpath
To prevent configuring this manually in the ingress on each update, I would prefer a regex determining the major.minor version automatically. The application is revised according to Semver 2.0.0, so a pattern like \d+.\d+ should do the work.
I tried something like this:
apiVersion: extensions/v1beta1
kind: Ingress
spec:
backend:
serviceName: {{ .Release.Name }}-my-srv
servicePort: 80
rules:
- host: {{ .Values.app.ingress.host }}
http:
paths:
- path: /{{ .Chart.AppVersion | regex \d+.\d+ }}
Unfortunately I couldn't find a function for regular expressions. Is there an option to achieve this with a helm template?