2023-02-09 16:32:10 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
upsert_config_entry primary '
|
|
|
|
kind = "api-gateway"
|
|
|
|
name = "api-gateway"
|
|
|
|
listeners = [
|
|
|
|
{
|
2023-02-10 21:13:44 +00:00
|
|
|
name = "listener-one"
|
2023-02-09 21:20:12 +00:00
|
|
|
port = 9999
|
2023-02-09 16:32:10 +00:00
|
|
|
protocol = "tcp"
|
2023-02-10 21:13:44 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
name = "listener-two"
|
|
|
|
port = 9998
|
|
|
|
protocol = "tcp"
|
2023-02-09 16:32:10 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
'
|
|
|
|
|
|
|
|
upsert_config_entry primary '
|
|
|
|
kind = "tcp-route"
|
2023-02-10 21:13:44 +00:00
|
|
|
name = "api-gateway-route-one"
|
2023-02-09 16:32:10 +00:00
|
|
|
services = [
|
|
|
|
{
|
2023-02-09 21:20:12 +00:00
|
|
|
name = "s1"
|
2023-02-09 16:32:10 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
parents = [
|
|
|
|
{
|
|
|
|
name = "api-gateway"
|
2023-02-10 21:13:44 +00:00
|
|
|
sectionName = "listener-one"
|
2023-02-09 16:32:10 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
'
|
|
|
|
|
2023-02-10 21:13:44 +00:00
|
|
|
upsert_config_entry primary '
|
|
|
|
kind = "tcp-route"
|
|
|
|
name = "api-gateway-route-two"
|
|
|
|
services = [
|
|
|
|
{
|
|
|
|
name = "s2"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
parents = [
|
|
|
|
{
|
|
|
|
name = "api-gateway"
|
|
|
|
sectionName = "listener-two"
|
2023-02-16 19:42:36 +00:00
|
|
|
kind = "api-gateway"
|
2023-02-10 21:13:44 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
'
|
|
|
|
|
|
|
|
upsert_config_entry primary '
|
|
|
|
kind = "service-intentions"
|
|
|
|
name = "s1"
|
|
|
|
sources {
|
|
|
|
name = "api-gateway"
|
|
|
|
action = "allow"
|
|
|
|
}
|
|
|
|
'
|
|
|
|
|
|
|
|
upsert_config_entry primary '
|
|
|
|
kind = "service-intentions"
|
|
|
|
name = "s2"
|
|
|
|
sources {
|
|
|
|
name = "api-gateway"
|
|
|
|
action = "deny"
|
|
|
|
}
|
|
|
|
'
|
|
|
|
|
2023-02-09 16:32:10 +00:00
|
|
|
register_services primary
|
|
|
|
|
|
|
|
gen_envoy_bootstrap api-gateway 20000 primary true
|
|
|
|
gen_envoy_bootstrap s1 19000
|
2023-02-16 19:42:36 +00:00
|
|
|
gen_envoy_bootstrap s2 19001
|