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

---
apiVersion:  traefik.io/v1alpha1
kind: Middleware
metadata:
  name: strip-aggregator-prefix
spec:
  stripPrefix:
    prefixes:
      - "/aggregator"
{{- end }}