Updated on 2025-04-25 GMT+08:00

Traffic Distribution Based on Combined Rules

In some complex grayscale release scenarios, you need to combine condition- and weight-based routing rules.

Updating Traffic Distribution Based on Combined Rules on the Console

  1. Log in to the UCS console. In the navigation pane, choose Service Meshes.
  2. Click the name of the target service mesh to go to its details page.
  3. In the navigation pane, choose Service Center > Mesh Services.
  4. Click the service name to go to the details page. Click the tab for displaying grayscale releases and select the grayscale release update option.
  5. Reset matching conditions and target service parameters for traffic distribution based on combined rules.

Editing Parameters for Traffic Distribution Based on Combined Rules Using YAML

Select YAML for Current Data and edit the parameters in the editing area. The following are the parameters in the YAML file. (Configure the parameters based on site requirements.)

apiVersion: v1
kind: VirtualService
metadata:
  name: reviews-route
spec:
  hosts:
  - reviews.prod.svc.cluster.local
  http:
  - route:
    - destination:
        host: reviews.prod.svc.cluster.local
        subset: v2
      weight: 25
    - destination:
        host: reviews.prod.svc.cluster.local
        subset: v1
      weight: 75
  - match:
    - headers:
        end-user:
          exact: jason
      uri:
        prefix: "/ratings/v2/"
    route:
    - destination:
        host: ratings.prod.svc.cluster.local