{{- range $name, $service := .Values.istio }}

{{- if $service.enabled }}
apiVersion: networking.istio.io/v1alpha3
kind: VirtualService
metadata:
  name: {{ $name }}
  namespace: {{ $.Release.Namespace }}
  labels:
{{ include "kubezero-lib.labels" $ | indent 4 }}
spec:
  hosts:
  - {{ $service.url }}
  gateways:
  - {{ $service.gateway }}
  http:
  - route:
    - destination:
        host: {{ $service.destination }}
---
{{- end }}

{{- end }}