open-nomad/command/agent/consul
Seth Hoenig d026ff1f66 consul/connect: add support for connect mesh gateways
This PR implements first-class support for Nomad running Consul
Connect Mesh Gateways. Mesh gateways enable services in the Connect
mesh to make cross-DC connections via gateways, where each datacenter
may not have full node interconnectivity.

Consul docs with more information:
https://www.consul.io/docs/connect/gateways/mesh-gateway

The following group level service block can be used to establish
a Connect mesh gateway.

service {
  connect {
    gateway {
      mesh {
        // no configuration
      }
    }
  }
}

Services can make use of a mesh gateway by configuring so in their
upstream blocks, e.g.

service {
  connect {
    sidecar_service {
      proxy {
        upstreams {
          destination_name = "<service>"
          local_bind_port  = <port>
          datacenter       = "<datacenter>"
          mesh_gateway {
            mode = "<mode>"
          }
        }
      }
    }
  }
}

Typical use of a mesh gateway is to create a bridge between datacenters.
A mesh gateway should then be configured with a service port that is
mapped from a host_network configured on a WAN interface in Nomad agent
config, e.g.

client {
  host_network "public" {
    interface = "eth1"
  }
}

Create a port mapping in the group.network block for use by the mesh
gateway service from the public host_network, e.g.

network {
  mode = "bridge"
  port "mesh_wan" {
    host_network = "public"
  }
}

Use this port label for the service.port of the mesh gateway, e.g.

service {
  name = "mesh-gateway"
  port = "mesh_wan"
  connect {
    gateway {
      mesh {}
    }
  }
}

Currently Envoy is the only supported gateway implementation in Consul.
By default Nomad client will run the latest official Envoy docker image
supported by the local Consul agent. The Envoy task can be customized
by setting `meta.connect.gateway_image` in agent config or by setting
the `connect.sidecar_task` block.

Gateways require Consul 1.8.0+, enforced by the Nomad scheduler.

Closes #9446
2021-06-04 08:24:49 -05:00
..
acl_testing.go e2e: add e2e tests for consul namespaces on ent with acls 2021-04-27 14:45:54 -06:00
catalog_testing.go consul: plubming for specifying consul namespace in job/group 2021-04-05 10:03:19 -06:00
check_watcher.go consul: minor CR cleanup 2021-04-05 10:10:16 -06:00
check_watcher_test.go consul: plubming for specifying consul namespace in job/group 2021-04-05 10:03:19 -06:00
config_entries_testing.go
connect.go consul/connect: add support for connect mesh gateways 2021-06-04 08:24:49 -05:00
connect_proxies.go
connect_proxies_test.go
connect_proxies_testing.go
connect_test.go consul/connect: add support for connect mesh gateways 2021-06-04 08:24:49 -05:00
group_test.go consul: plubming for specifying consul namespace in job/group 2021-04-05 10:03:19 -06:00
int_test.go consul: plubming for specifying consul namespace in job/group 2021-04-05 10:03:19 -06:00
namespaces_client.go consul: plubming for specifying consul namespace in job/group 2021-04-05 10:03:19 -06:00
service_client.go consul/connect: add support for connect mesh gateways 2021-06-04 08:24:49 -05:00
service_client_test.go consul: plubming for specifying consul namespace in job/group 2021-04-05 10:03:19 -06:00
structs.go consul: plubming for specifying consul namespace in job/group 2021-04-05 10:03:19 -06:00
testing.go
unit_test.go consul: plubming for specifying consul namespace in job/group 2021-04-05 10:03:19 -06:00
version_checker.go
version_checker_test.go