# Canary testing using Istio
# The DestinationRule defines the subsets by Deployment label
---
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
  name: canary-test
spec:
  host: payment.robot-shop.svc.cluster.local
  subsets:
  - name: production
    labels:
      stage: prod
  - name: canary
    labels:
      stage: test
---
# VirtualService subset references DestinationRule spec.subsets.name
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: robotshop-canary
spec:
  hosts:
  - payment.robot-shop.svc.cluster.local
  http:
  - route:
    - destination:
        host: payment.robot-shop.svc.cluster.local
        subset: production
      weight: 99
    - destination:
        host: payment.robot-shop.svc.cluster.local
        subset: canary
      weight: 1
