# istio_virtualservice_destinationrules.yaml
apiVersion: networking.istio.io/v1
kind: DestinationRule
metadata:
  name: reviews
  namespace: default
spec:
  host: reviews
  subsets:
  - labels:
      version: v1
    name: v1
---
apiVersion: networking.istio.io/v1
kind: VirtualService
metadata:
  name: reviews
  namespace: default
spec:
  http:
  - route:
    - destination:  # This virtualservice has no validation errors (base case)
        host: reviews
        subset: v1
---
apiVersion: networking.istio.io/v1
kind: VirtualService
metadata:
  name: reviews-bogussubset
  namespace: default
spec:
  http:
  - route:
    - destination:
        host: reviews
        subset: bogus # This subset does not exist, should result in a validation error
---
apiVersion: networking.istio.io/v1
kind: VirtualService
metadata:
  name: reviews-fqdn
  namespace: default
spec:
  http:
  - route:
    - destination:
        host: reviews.default.svc.cluster.local # FQDN representation is valid and should not generate an error
        subset: v1
---
apiVersion: networking.istio.io/v1
kind: VirtualService
metadata:
  name: reviews-mirror
  namespace: default
spec:
  http:
  - route:
    - destination:
        host: reviews
        subset: v1
    mirror: # Includes mirroring, but should not generate any errors
      host: reviews
      subset: v1
---
apiVersion: networking.istio.io/v1
kind: VirtualService
metadata:
  name: reviews-mirror-bogussubset
  namespace: default
spec:
  http:
  - route:
    - destination:
        host: reviews
        subset: v1
    mirror:
      host: reviews
      subset: bogus # This subset does not exist, should result in a validation error