2022-06-28 19:52:25 +00:00
|
|
|
#!/bin/bash
|
2023-03-28 22:48:58 +00:00
|
|
|
# Copyright (c) HashiCorp, Inc.
|
2023-08-11 13:12:13 +00:00
|
|
|
# SPDX-License-Identifier: BUSL-1.1
|
2023-03-28 22:48:58 +00:00
|
|
|
|
2022-06-28 19:52:25 +00:00
|
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
2022-11-07 16:02:04 +00:00
|
|
|
upsert_config_entry alpha '
|
|
|
|
kind = "proxy-defaults"
|
|
|
|
name = "global"
|
|
|
|
config {
|
|
|
|
protocol = "http"
|
|
|
|
}
|
|
|
|
'
|
|
|
|
|
|
|
|
upsert_config_entry alpha '
|
|
|
|
kind = "exported-services"
|
|
|
|
name = "default"
|
|
|
|
services = [
|
|
|
|
{
|
|
|
|
name = "s2"
|
|
|
|
consumers = [
|
|
|
|
{
|
|
|
|
peer = "alpha-to-primary"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
'
|
|
|
|
|
2023-01-06 17:13:40 +00:00
|
|
|
upsert_config_entry alpha '
|
|
|
|
Kind = "service-defaults"
|
|
|
|
Name = "s2"
|
|
|
|
Protocol = "http"
|
|
|
|
EnvoyExtensions = [
|
|
|
|
{
|
|
|
|
Name = "builtin/lua",
|
|
|
|
Arguments = {
|
|
|
|
ProxyType = "connect-proxy"
|
|
|
|
Listener = "inbound"
|
|
|
|
Script = <<-EOF
|
|
|
|
function envoy_on_request(request_handle)
|
|
|
|
meta = request_handle:streamInfo():dynamicMetadata()
|
|
|
|
m = meta:get("consul")
|
|
|
|
request_handle:headers():add("x-consul-service", m["service"])
|
|
|
|
request_handle:headers():add("x-consul-namespace", m["namespace"])
|
|
|
|
request_handle:headers():add("x-consul-datacenter", m["datacenter"])
|
|
|
|
request_handle:headers():add("x-consul-trust-domain", m["trust-domain"])
|
|
|
|
end
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
}
|
|
|
|
]
|
|
|
|
'
|
|
|
|
|
2022-06-28 19:52:25 +00:00
|
|
|
register_services alpha
|
|
|
|
|
|
|
|
gen_envoy_bootstrap s2 19002 alpha
|
|
|
|
gen_envoy_bootstrap mesh-gateway 19003 alpha true
|