solo-io / workshops

Apache License 2.0
127 stars 72 forks source link

Get started with Istio - add comment to CRs to easily show the changes #169

Open find-arka opened 1 year ago

find-arka commented 1 year ago

istio-workshops> istio-basics/labs/05/purchase-history-vs-all-v1-header-v2.yaml

kind: VirtualService
metadata:
  name: purchase-history-vs
spec:
  hosts:
  - purchase-history.istioinaction.svc.cluster.local
  http:
#--- If user: Tom is present in incoming request header, go to purchase-history-v2 ---
  - match:
    - headers:
        user:
          exact: Tom
    route:
    - destination:
        host: purchase-history.istioinaction.svc.cluster.local
        subset: v2
        port:
          number: 8080
#--- Else, go to purchase-history-v1 ---
  - route:
    - destination:
        host: purchase-history.istioinaction.svc.cluster.local
        subset: v1
        port:
          number: 8080
      weight: 100
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
  name: purchase-history-vs
spec:
  hosts:
  - purchase-history.istioinaction.svc.cluster.local
  http:
  - match:
    - headers:
        user:
          exact: Tom
    route:
    - destination:
        host: purchase-history.istioinaction.svc.cluster.local
        subset: v3
        port:
          number: 8080
# ---- adding timeout per retry ----
      retries:
        attempts: 3
        perTryTimeout: 3s
# ---- adding an overall timeout ----
      timeout: 6s
  - route:
    - destination:
        host: purchase-history.istioinaction.svc.cluster.local
        subset: v2
        port:
          number: 8080
      weight: 100