istio.io/istio@v0.0.0-20240520182934-d79c90f27776/tests/testdata/config/rule-weighted-route.yaml (about)

     1  # Self-contained local test for weighted routes
     2  # TODO: start services/template for the 2 ports.
     3  apiVersion: networking.istio.io/v1alpha3
     4  kind: ServiceEntry
     5  metadata:
     6    name: weighted-extsvc
     7    namespace: testns
     8  spec:
     9     hosts:
    10     - c-weighted.extsvc.com
    11     ports:
    12     - number: 80
    13       name: http
    14       protocol: HTTP
    15     resolution: STATIC
    16     endpoints:
    17      - address: 127.0.0.2
    18        ports:
    19          http: 7072
    20        labels:
    21          version: v1
    22      - address: 127.0.0.3
    23        ports:
    24          http: 7074
    25        labels:
    26          version: v2
    27  ---
    28  apiVersion: networking.istio.io/v1alpha3
    29  kind: DestinationRule
    30  metadata:
    31    name: c-weighted
    32    namespace: testns
    33  spec:
    34    host: c-weighted.extsvc.com
    35    subsets:
    36      - name: v1
    37        labels:
    38          version: v1
    39      - name: v2
    40        labels:
    41          version: v2
    42  ---
    43  apiVersion: networking.istio.io/v1alpha3
    44  kind: VirtualService
    45  metadata:
    46    name: c-weighted
    47    namespace: testns
    48  spec:
    49    hosts:
    50      - c-weighted.extsvc.com
    51    http:
    52      - route:
    53        - destination:
    54            host: c-weighted.extsvc.com
    55            subset: v1
    56          weight: 75
    57        - destination:
    58            host: c-weighted.extsvc.com
    59            subset: v2
    60          weight: 25