istio regex / prefix / exact

Ericamoyed·2022년 5월 2일
1

개발한장

목록 보기
15/22

istio virtual service 설정하는데 너무 한계가 많은거 아니냐.. 진짜 이거 별 공수도 안들거같은데 왜 이 기능이 없는지 모르겠음..

  • prefix
    -> 가장 많이 쓰이는 옵션.
    -> '~~~'로 시작하는 애는 어떤 destination rule로 라우팅 하렴~
  http:
    - match:
        - uri:
            prefix: /static/css
      route:
        - destination:
            host: ~~
            subset: ~~
          weight: 100
  • regex
    -> 별 쓸모 없는 옵션. 진짜 이럴거면 왜만든지 모르겠는 옵션
spec:
  hosts:
    - ~~.com
  gateways:
    - ~~-gateway
  http:
    - match:
        - uri:
            regex: '\/static\/css\/[0-9]+\/.*'
      rewrite:
        uri: /css
      route:
        - destination:
            host: ~~
            subset: ~~
          weight: 100

내가 원하는건 /static/css/23802309/hello.css -> /css/hello.css 로 보내라는건데
이렇게 설정하면 바보같이 /static/css/23802309/hello.css -> /css
-> 아무것도 없어용 ㅜㅜ
이렇게 된다;

그래서
/static/css/23802309/hello.css -> /css/hello.css
/static/css/15674212/hello.css -> /css/hello.css
이거 할 수 있는 방법을 찾아봤더니 죽어도 없다. vs에서 prefix에서는 regex를 지원안해서 저 중간에 랜덤한 숫자 N개를 묶을 방법이 없다.
그치만 regex 에서는 뒤의 {{ hello.css }} 라는 거에 대한 regex capture group 도 지원안해서 결국 못한다는거.

진짜 어이없음. 어떻게든 해보려고 했는데 안됨 바이
https://docs.eupraxia.io/docs/how-to-guides/deploy-nginx-webserver-to-istio/
얘보고 희망 가졌는데.. 다시보니 얘는 rewrite이 아니라 그냥 라우팅하는 애라서 문제 없었겠네.. ㅋ

  http:
  - match:
    - uri:
        exact: /
    - uri:
        prefix: /docs
    - uri:
        regex: ^.*\.(ico|png|jpg|css|js|img|jpeg|map)$
    route:
    - destination:
        host: docs-service
        port:
          number: 8080
  • exact
    얘는 그냥 말그대로 uri 하위가 딱맞는 애들만 라우팅해주는거.
profile
꿈많은 개발자, 일상 기록을 곁들인

0개의 댓글