| # Self-contained local test for weighted routes |
| # TODO: start services/template for the 2 ports. |
| apiVersion: networking.istio.io/v1alpha3 |
| kind: ServiceEntry |
| metadata: |
| name: weighted-extsvc |
| namespace: testns |
| spec: |
| hosts: |
| - c-weighted.extsvc.com |
| ports: |
| - number: 80 |
| name: http |
| protocol: HTTP |
| resolution: STATIC |
| endpoints: |
| - address: 127.0.0.2 |
| ports: |
| http: 7072 |
| labels: |
| version: v1 |
| - address: 127.0.0.3 |
| ports: |
| http: 7074 |
| labels: |
| version: v2 |
| --- |
| apiVersion: networking.istio.io/v1alpha3 |
| kind: DestinationRule |
| metadata: |
| name: c-weighted |
| namespace: testns |
| spec: |
| host: c-weighted.extsvc.com |
| subsets: |
| - name: v1 |
| labels: |
| version: v1 |
| - name: v2 |
| labels: |
| version: v2 |
| --- |
| apiVersion: networking.istio.io/v1alpha3 |
| kind: VirtualService |
| metadata: |
| name: c-weighted |
| namespace: testns |
| spec: |
| hosts: |
| - c-weighted.extsvc.com |
| http: |
| - route: |
| - destination: |
| host: c-weighted.extsvc.com |
| subset: v1 |
| weight: 75 |
| - destination: |
| host: c-weighted.extsvc.com |
| subset: v2 |
| weight: 25 |