--- apiVersion: networking.istio.io/v1alpha3 kind: VirtualService metadata: name: {{k8s_deploy.name}}-{{k8s_deploy.namespace}} namespace: istio-system spec: hosts: {%- for host in k8s_deploy.prxyVirtualService.hosts %} - "{{host}}" {%- endfor %} gateways: - "{{k8s_deploy.namespace}}-gwy" {%- if k8s_deploy.prxyVirtualService.matches %} {%- for item in k8s_deploy.prxyVirtualService.matches %} {{item.typ}}: - match: {%- for loc in item.location %} - port: {{loc.port}} {%- if loc.sniHosts %} sniHosts: {%- for sni_host in loc.sniHosts %} - "{{sni_host}}" {%- endfor %} {%- endif %} {%- endfor %} {%- if item.route_destination %} route: - destination: {%- for dest in item.route_destination %} port: number: {{dest.port_number}} host: "{{dest.host}}" {%- endfor %} {%- endif %} {%- endfor %} {%- endif %}