cosmo-workspace / cosmo

WebIDE and DevEnvironment controller on Kubernetes.
MIT License
24 stars 4 forks source link

Traefik IngressRoute Priority #768

Closed jlandowner closed 1 year ago

jlandowner commented 1 year ago

For example, When IngressRoute rules are like this, https://proxy1-ws1-tom-k3d-code-server.example.com/dev is routed to 7701 port

It seems required to set priority for routing https://proxy1-ws1-tom-k3d-code-server.example.com/dev -> 7702

  - kind: Rule
    match: Host(`proxy1-ws1-tom-k3d-code-server.example.com`) && PathPrefix(`/dev`)
    middlewares:
    - name: cosmo-username-headers
    - name: cosmo-auth
      namespace: cosmo-system
    priority: 100 <-- it works when 101
    services:
    - kind: Service
      name: ws1-workspace
      port: 7702
      scheme: http
  - kind: Rule
    match: Host(`proxy1-ws1-tom-k3d-code-server.example.com`)
    middlewares:
    - name: cosmo-username-headers
    - name: cosmo-auth
      namespace: cosmo-system
    priority: 100
    services:
    - kind: Service
      name: ws1-workspace
      port: 7701
      scheme: http
oruharo commented 1 year ago

The longer the length of the string specified in "Match", the higher the priority. In the above case, 7702 is routed.

https://doc.traefik.io/traefik/routing/routers/#priority