Help with MeshNetworks config

Hi,

I need help to use the meshNetworks configuration and ServiceEntries.

I would like to route every request from a specific CIDR block via a specific gateway. For example:

  • requests to cidr 10.0.0.0/16 to a gateway A 172.1.2.4:443
  • requests to cidr 10.1.0.0/16 to a gateway B 172.5.6.7:443

I have 2 DNS records:

I would like requests to foo.example.io to be automatically routed via gateway A and requests to bar.example.io to be automatically routed via gateway B.

I tried the following setup with istio 1.2.2. It does not work so I am most likely doing something wrong.

---
# values.yaml
global:
  meshNetworks:
    remoteA:
      endpoints:
      - fromCidr: "10.0.0.0/16"
      gateways:
      - address: 172.1.2.4
        port: 443
   remoteB:
      endpoints:
      - fromCidr: "10.1.0.0/16"
      gateways:
      - address: 172.5.5.6
        port: 443

# my service entry
---
apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
  name: foo
  namespace: default
spec:
  hosts:
  - foo.example.io
  location: MESH_INTERNAL
  resolution: DNS
  ports:
  - number: 80
    name: http
    protocol: HTTP
---
apiVersion: networking.istio.io/v1alpha3
kind: ServiceEntry
metadata:
  name: bar
  namespace: default
spec:
  hosts:
  - bar.example.io
  location: MESH_INTERNAL
  resolution: DNS
  ports:
  - number: 80
    name: http
    protocol: HTTP

When I send a request to foo.example.io or bar.example.io, they go straight to the destination IP without being routed via the gateways.

Can anyone with experience with MeshNetworks assist? Is what I am trying to achieve even possible?
Thank you for your help.