<p>I have 3 projects: A,B,C.<br>
Each project have 2 versions: v1,v2.<br>
How to config istio to limit A(v1) only send request to B(v1) and C(v1)?</p>

<p>This is Istio's Request Routing, as described in this tutorial: <a href="https://istio.io/latest/docs/tasks/traffic-management/request-routing/" rel="nofollow noreferrer">https://istio.io/latest/docs/tasks/traffic-management/request-routing/</a></p>
<p>Basically, you need first to define some <code>DestinationRules</code> to create some subsets based on your versions, e.g.:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
  name: productpage
spec:
  host: productpage
  subsets:
  - name: v1
    labels:
      version: v1
---
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
  name: reviews
spec:
  host: reviews
  subsets:
  - name: v1
    labels:
      version: v1
  - name: v2
    labels:
      version: v2
---
</code></pre>
<p>Then, you create some <code>VirtualServices</code> to define the routing rules. Here, you want to use sourceLabels matching, so it's going to be like:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: networking.istio.io/v1beta1
kind: VirtualService
...
spec:
  hosts:
  - reviews
  http:
  - match:
    - sourceLabels:
        version: v2
    route:
    - destination:
        host: reviews
        subset: v2
  - route:
    - destination:
        host: reviews
        subset: v1
</code></pre>
<p>It reads as: if any incoming traffic to service <code>reviews</code> comes from a service that has a label <code>version: v2</code>, it is routed to <code>reviews</code> v2; else as a default rule, it is routed to v1. You can add any number of route rules in that <code>VirtualService</code>, and can repeat the operation for all your services.</p>
