{{- if .Values.global.meshExpansion }}

apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: meshexpansion-pilot
spec:
  hosts:
  - "pilot.istio-system"
  gateways:
  - meshexpansion-gateway
  tcp:
  - match:
    - port: 15011
    route:
    - destination:
        host: istio-pilot.istio-system.svc.cluster.local
        port:
          number: 15011


{{- end }}


{{- if .Values.global.meshExpansionILB }}
---
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: ilb-meshexpansion-pilot
spec:
  hosts:
  - "meshexpansionilb.istio-system"
  gateways:
  - meshexpansion-ilb-gateway
  tcp:
  - match:
    - port: 15011
    route:
    - destination:
        host: istio-pilot.istio-system.svc.cluster.local
        port:
          number: 15011
  - match:
    - port: 15010
    route:
    - destination:
        host: istio-pilot.istio-system.svc.cluster.local
        port:
          number: 15010
  - match:
    - port: 5353
    route:
    - destination:
        host: kube-dns.kube-system.svc.cluster.local
        port:
          number: 53

{{- end }}
