---
apiVersion: networking.istio.io/v1
kind: Gateway
metadata:
  name: testing-gateway-01-test-01
  namespace: istio-system
spec:
  selector:
    istio: ingressgateway
  servers:
  - hosts:
    - testing-01.com
    port:
      name: http
      number: 80
      protocol: HTTP
---
apiVersion: networking.istio.io/v1
kind: VirtualService
metadata:
  name: testing-service-01-test-01
  namespace: default
spec:
  gateways:
  - istio-system/testing-gateway-01-test-01
  hosts:
  - testing-01.com
  http:
  - route:
    - destination:
        host: ratings # Expected: validation error since destination don't have subset
---
apiVersion: networking.istio.io/v1
kind: Gateway
metadata:
  name: testing-gateway-02-test-02
  namespace: istio-system
spec:
  selector:
    istio: ingressgateway
  servers:
  - hosts:
    - testing-02.com
    port:
      name: http
      number: 80
      protocol: HTTP
---
apiVersion: networking.istio.io/v1
kind: VirtualService
metadata:
  name: testing-service-02-test-02
  namespace: default
spec:
  gateways:
  - istio-system/testing-gateway-02-test-02
  hosts:
  - testing-02.com
  http:
  - route:
    - destination:
        host: ratings # Expected: no validation error
        subset: v1
---
apiVersion: v1
kind: Service
metadata:
  name: ratings
  namespace: default
spec:
  ports:
  - port: 80
    name: http-ratings
    protocol: HTTP
--- 
apiVersion: networking.istio.io/v1
kind: VirtualService
metadata:
  name: ratings-01
  namespace: default
spec:
  hosts:
  - ratings
  http:
  - route:
    - destination:
        host: ratings
        subset: v1
---
apiVersion: networking.istio.io/v1
kind: DestinationRule
metadata:
  name: ratings
  namespace: default
spec:
  host: ratings
  subsets:
  - name: v1
    labels:
      version: v1
