This is going to be a short one since the Documentation is quite good. OpenShift Routes allow for rewriting paths to subfolders. Here's an example using the whoogle applicaiton with a dark and light theme:Feel free to comment and / or suggest a topic.
One option to solve this without going the ingress route is using the built-in route capabilities of rewriting the url. Here are the three route-definitions I used:
[ 22:43:10 ] - archy ~/git/openshift/search> cat openshift/dark-route.yml
---
apiVersion: route.openshift.io/v1
kind: Route
metadata:
name: search
namespace: search
labels:
app: search
spec:
host: search.example.com
path: /
port:
targetPort: 8080
to:
kind: Service
name: search
...
[ 22:43:20 ] - archy ~/git/openshift/search> cat openshift/dark-route.yml
---
apiVersion: route.openshift.io/v1
kind: Route
metadata:
name: search
namespace: search
labels:
app: search-dark
annotations:
haproxy.router.openshift.io/rewrite-target: /
spec:
host: search.example.com
path: /dark
port:
targetPort: 8080
to:
kind: Service
name: search
...
[ 22:43:30 ] - archy ~/git/openshift/search> cat openshift/light-route.yml
---
apiVersion: route.openshift.io/v1
kind: Route
metadata:
name: search
namespace: search
labels:
app: search-light
annotations:
haproxy.router.openshift.io/rewrite-target: /
spec:
host: search.example.com
path: /light
port:
targetPort: 8080
to:
kind: Service
name: search-light
...
Comments
Post a Comment