---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: server-demo
  namespace: dubbo-demo
spec:
  hosts:
    - server-demo.dubbo-demo.svc.cluster.local
  http:
    - route:
        - destination:
            host: server-demo.dubbo-demo.svc.cluster.local
            subset: v1
            port:
              # Specifies the port on the host being addressed. If the service exposes only one port, you don't need to choose the port explicitly
              number: 50052
          weight: 80
        - destination:
            host: server-demo.dubbo-demo.svc.cluster.local
            subset: v2
            port:
              # Specifies the port on the host being addressed. If the service exposes only one port, you don't need to choose the port explicitly
              number: 50052
          weight: 20

---
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
  name: server-demo
  namespace: dubbo-demo
spec:
  host: server-demo.dubbo-demo.svc.cluster.local
  trafficPolicy:
    loadBalancer:
      # Envoy load balancing strategy
      simple: ROUND_ROBIN
  subsets:
    - name: v1
      labels:
        version: v1
    - name: v2
      labels:
        version: v2