{{- if index .Values.ocWorkflow.enabled }}
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
  name: oc-workflow-ingress
spec:
  entryPoints:
    - web
  routes:                           
    - kind: Rule
      match:   Host(`{{ .Values.host }}`) && PathPrefix(`/workflow`)
      priority: 10                    
      services:
      - kind: Service
        name: oc-workflow-svc
        port: 8080
      middlewares:
      - name: strip-workflow-prefix
      {{- if index .Values.ocAuth.enableTraefikProxyIntegration }}
      - name: forward-auth
      {{- end }}


---
apiVersion:  traefik.io/v1alpha1
kind: Middleware
metadata:
  name: strip-workflow-prefix
spec:
  replacePathRegex:
    regex: ^/workflow(.*)
    replacement: /oc$1
{{- end }}