apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: test-crossnamespace.route
  namespace: default

spec:
  entryPoints:
    - foo

  routes:
  - match: Host(`foo.com`) && PathPrefix(`/bar`)
    kind: Rule
    priority: 12
    services:
    - name: whoami
      namespace: default
      port: 80
    middlewares:
    - name: stripprefix
      namespace: cross-ns
  - match: Host(`foo.com`) && PathPrefix(`/bir`)
    kind: Rule
    priority: 12
    services:
    - name: whoami
      namespace: default
      port: 80
    middlewares:
    - name: test-errorpage
  - match: Host(`foo.com`) && PathPrefix(`/bur`)
    kind: Rule
    priority: 12
    services:
    - name: whoami
      namespace: default
      port: 80
    middlewares:
    - name: cross-ns-stripprefix@kubernetescrd

---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
  name: stripprefix
  namespace: cross-ns

spec:
  stripPrefix:
    prefixes:
      - /stripit

---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
  name: test-errorpage
  namespace: default
spec:
  errors:
    status:
      - 500-599
    query: /{status}.html
    service:
      name: whoami-svc
      namespace: cross-ns
      port: 80
