From 86d13b4f401ec50dc7f224316cbb0e5b926c9c69 Mon Sep 17 00:00:00 2001 From: Magic_RB Date: Thu, 15 Jun 2023 23:09:56 +0200 Subject: [PATCH] Add terranix config for gateway-mesh Signed-off-by: Magic_RB --- terranix/containers/gateway-mesh/default.nix | 16 +++++++++++ terranix/containers/gateway-mesh/job.hcl | 30 ++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 terranix/containers/gateway-mesh/default.nix create mode 100644 terranix/containers/gateway-mesh/job.hcl diff --git a/terranix/containers/gateway-mesh/default.nix b/terranix/containers/gateway-mesh/default.nix new file mode 100644 index 0000000..e4fa385 --- /dev/null +++ b/terranix/containers/gateway-mesh/default.nix @@ -0,0 +1,16 @@ +{ elib, ... }: +let + inherit (elib) + nomadJob; +in +{ + resource."nomad_job"."mesh" = nomadJob { + jobspec = ./job.hcl; + vars = { + "datacenters" = builtins.toJSON [ + "do-1" + "homelab-1" + ]; + }; + }; +} diff --git a/terranix/containers/gateway-mesh/job.hcl b/terranix/containers/gateway-mesh/job.hcl new file mode 100644 index 0000000..1c75102 --- /dev/null +++ b/terranix/containers/gateway-mesh/job.hcl @@ -0,0 +1,30 @@ +variable "datacenters" { + type = list(string) +} + +job "gateway-mesh" { + datacenters = var.datacenters + + group "envoy" { + network { + mode = "bridge" + + port "mesh_wan" { + host_network = "mesh" + } + } + + service { + name = "mesh-gateway" + + port = "mesh_wan" + + connect { + gateway { + mesh {} + proxy {} + } + } + } + } +}