c0c0n3 / kitt4sme.live

On a mission to bring AI to the shop floor: https://kitt4sme.eu/
MIT License
1 stars 28 forks source link

SADS offline routing conflict #238

Closed c0c0n3 closed 1 year ago

c0c0n3 commented 1 year ago

Describe the bug

SADS offline's Istio route doesn't work.

To Reproduce

Steps to reproduce the behavior:

  1. Browse to https://kitt4sme.collab-cloud.eu/sads-offline/
  2. You should see a 404 error.

Expected behavior

External HTTP clients should be able to access the SADS offline service at https://kitt4sme.collab-cloud.eu/sads-offline/.

Additional context

It looks like this is a problem with our Istio routing rules. In fact, if you browse to both SADS and SADS offline, you should see entries similar to the following in the Istio gateway logs

[2023-04-21T10:30:33.803Z] "GET /sads-offline/ HTTP/2" 404 - via_upstream - "-" 0 69 8 7 "130.188.160.88" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36" "911539a5-3bad-9bdf-a3e0-f91129673a53" "kitt4sme.collab-cloud.eu" "10.1.124.202:8501" outbound|8501||sads.default.svc.cluster.local 10.1.124.222:52398 10.1.124.222:8443 130.188.160.88:10966 kitt4sme.collab-cloud.eu -
[2023-04-21T10:32:16.726Z] "GET /sads/ HTTP/2" 304 - via_upstream - "-" 0 0 15 13 "130.188.160.88" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36" "2353f394-56c3-918c-ad77-544682497b51" "kitt4sme.collab-cloud.eu" "10.1.124.202:8501" outbound|8501||sads.default.svc.cluster.local 10.1.124.222:52398 10.1.124.222:8443 130.188.160.88:10966 kitt4sme.collab-cloud.eu -

So both /sads and /sads-offline get routed to sads.default.svc.cluster.local. The most likely reason for that, in our routing rules, we match /sads and /sads-offline by prefix

  - match:  # NOTE (4)
    - uri:
        prefix: /sads
    route:
    - destination:
        host: sads.default.svc.cluster.local
        port:
          number: 8501
  - match: 
    - uri:
        prefix: /sads-offline
    route:
    - destination: 
        host: sads-offline.default.svc.cluster.local
        port: 
          number: 8501

So both /sads and /sads-offline match the first rule, which is why requests to SADS offline get routed to SADS.