test: fix envoy integration tests to explicitly create config entries (#15269)

This is instead of the current behavior where we feed the config entries in using the config_entries.bootstrap configuration which oddly races against other setup code in some circumstances.

I converted ALL tests to explicitly create config entries.
This commit is contained in:
R.B. Boyer 2022-11-07 10:02:04 -06:00 committed by GitHub
parent d6b614110a
commit 37771ad847
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
86 changed files with 1553 additions and 1838 deletions

View File

@ -1,19 +0,0 @@
config_entries {
bootstrap {
kind = "proxy-defaults"
name = "global"
config {
envoy_prometheus_bind_addr = "0.0.0.0:1234"
}
}
bootstrap {
kind = "service-defaults"
name = "s1"
protocol = "http"
}
bootstrap {
kind = "service-defaults"
name = "s2"
protocol = "http"
}
}

View File

@ -2,12 +2,28 @@
set -eEuo pipefail
# wait for bootstrap to apply config entries
wait_for_config_entry proxy-defaults global
wait_for_config_entry service-defaults s1
wait_for_config_entry service-defaults s2
upsert_config_entry primary '
kind = "proxy-defaults"
name = "global"
config {
envoy_prometheus_bind_addr = "0.0.0.0:1234"
}
'
upsert_config_entry primary '
kind = "service-defaults"
name = "s1"
protocol = "http"
'
upsert_config_entry primary '
kind = "service-defaults"
name = "s2"
protocol = "http"
'
register_services primary
gen_envoy_bootstrap s1 19000 primary
gen_envoy_bootstrap s2 19001 primary

View File

@ -1,26 +0,0 @@
config_entries {
bootstrap = [
{
kind = "proxy-defaults"
name = "global"
config {
protocol = "tcp"
}
},
{
kind = "exported-services"
name = "default"
services = [
{
name = "s2"
consumers = [
{
peer = "alpha-to-primary"
}
]
}
]
}
]
}

View File

@ -2,10 +2,29 @@
set -euo pipefail
upsert_config_entry alpha '
kind = "proxy-defaults"
name = "global"
config {
protocol = "tcp"
}
'
upsert_config_entry alpha '
kind = "exported-services"
name = "default"
services = [
{
name = "s2"
consumers = [
{
peer = "alpha-to-primary"
}
]
}
]
'
register_services alpha
gen_envoy_bootstrap s2 19002 alpha
gen_envoy_bootstrap mesh-gateway 19003 alpha true
wait_for_config_entry proxy-defaults global alpha
wait_for_config_entry exported-services default alpha

View File

@ -1,31 +0,0 @@
config_entries {
bootstrap {
kind = "proxy-defaults"
name = "global"
config {
protocol = "tcp"
}
}
bootstrap {
kind = "service-resolver"
name = "s2"
failover = {
"*" = {
targets = [{peer = "primary-to-alpha"}]
}
}
}
bootstrap {
kind = "service-resolver"
name = "virtual-s2"
redirect = {
service = "s2"
peer = "primary-to-alpha"
}
}
}

View File

@ -2,9 +2,34 @@
set -euo pipefail
upsert_config_entry primary '
kind = "proxy-defaults"
name = "global"
config {
protocol = "tcp"
}
'
upsert_config_entry primary '
kind = "service-resolver"
name = "s2"
failover = {
"*" = {
targets = [{ peer = "primary-to-alpha" }]
}
}
'
upsert_config_entry primary '
kind = "service-resolver"
name = "virtual-s2"
redirect = {
service = "s2"
peer = "primary-to-alpha"
}
'
register_services primary
gen_envoy_bootstrap s1 19000 primary
gen_envoy_bootstrap s2 19001 primary
wait_for_config_entry proxy-defaults global

View File

@ -1,23 +0,0 @@
config_entries {
bootstrap {
kind = "service-defaults"
name = "s2"
protocol = "http"
mesh_gateway {
mode = "none"
}
}
bootstrap {
kind = "service-resolver"
name = "s2"
failover = {
"*" = {
datacenters = ["secondary"]
}
}
}
}

View File

@ -2,9 +2,24 @@
set -eEuo pipefail
# wait for bootstrap to apply config entries
wait_for_config_entry service-defaults s2
wait_for_config_entry service-resolver s2
upsert_config_entry primary '
kind = "service-defaults"
name = "s2"
protocol = "http"
mesh_gateway {
mode = "none"
}
'
upsert_config_entry primary '
kind = "service-resolver"
name = "s2"
failover = {
"*" = {
datacenters = ["secondary"]
}
}
'
# also wait for replication to make it to the remote dc
wait_for_config_entry service-defaults s2 secondary

View File

@ -1,23 +0,0 @@
config_entries {
bootstrap {
kind = "service-defaults"
name = "s2"
protocol = "http"
mesh_gateway {
mode = "remote"
}
}
bootstrap {
kind = "service-resolver"
name = "s2"
failover = {
"*" = {
datacenters = ["secondary"]
}
}
}
}

View File

@ -2,9 +2,24 @@
set -eEuo pipefail
# wait for bootstrap to apply config entries
wait_for_config_entry service-defaults s2
wait_for_config_entry service-resolver s2
upsert_config_entry primary '
kind = "service-defaults"
name = "s2"
protocol = "http"
mesh_gateway {
mode = "remote"
}
'
upsert_config_entry primary '
kind = "service-resolver"
name = "s2"
failover = {
"*" = {
datacenters = ["secondary"]
}
}
'
# also wait for replication to make it to the remote dc
wait_for_config_entry service-defaults s2 secondary

View File

@ -1,26 +0,0 @@
config_entries {
bootstrap {
kind = "proxy-defaults"
name = "global"
config {
protocol = "http"
}
}
bootstrap {
kind = "service-resolver"
name = "s2"
default_subset = "v2"
subsets = {
"v1" = {
filter = "Service.Meta.version == v1"
}
"v2" = {
filter = "Service.Meta.version == v2"
}
}
}
}

View File

@ -2,9 +2,27 @@
set -euo pipefail
# wait for bootstrap to apply config entries
wait_for_config_entry proxy-defaults global
wait_for_config_entry service-resolver s2
upsert_config_entry primary '
kind = "proxy-defaults"
name = "global"
config {
protocol = "http"
}
'
upsert_config_entry primary '
kind = "service-resolver"
name = "s2"
default_subset = "v2"
subsets = {
"v1" = {
filter = "Service.Meta.version == v1"
}
"v2" = {
filter = "Service.Meta.version == v2"
}
}
'
register_services primary

View File

@ -1,27 +0,0 @@
config_entries {
bootstrap {
kind = "proxy-defaults"
name = "global"
config {
protocol = "http"
}
}
bootstrap {
kind = "service-resolver"
name = "s2"
default_subset = "v2"
connect_timeout = "30s"
subsets = {
"v1" = {
filter = "Service.Meta.version == v1"
}
"v2" = {
filter = "Service.Meta.version == v2"
}
}
}
}

View File

@ -2,9 +2,28 @@
set -euo pipefail
# wait for bootstrap to apply config entries
wait_for_config_entry proxy-defaults global
wait_for_config_entry service-resolver s2
upsert_config_entry primary '
kind = "proxy-defaults"
name = "global"
config {
protocol = "http"
}
'
upsert_config_entry primary '
kind = "service-resolver"
name = "s2"
default_subset = "v2"
connect_timeout = "30s"
subsets = {
"v1" = {
filter = "Service.Meta.version == v1"
}
"v2" = {
filter = "Service.Meta.version == v2"
}
}
'
register_services primary

View File

@ -1,23 +0,0 @@
config_entries {
bootstrap {
kind = "proxy-defaults"
name = "global"
config {
protocol = "http"
}
}
bootstrap {
kind = "service-resolver"
name = "s2"
default_subset = "test"
subsets = {
"test" = {
only_passing = true
}
}
}
}

View File

@ -2,6 +2,25 @@
set -euo pipefail
upsert_config_entry primary '
kind = "proxy-defaults"
name = "global"
config {
protocol = "http"
}
'
upsert_config_entry primary '
kind = "service-resolver"
name = "s2"
default_subset = "test"
subsets = {
"test" = {
only_passing = true
}
}
'
register_services primary
# wait for service registration
@ -12,10 +31,6 @@ wait_for_agent_service_register s2-v1
# force s2-v1 into a warning state
set_ttl_check_state service:s2-v1 warn
# wait for bootstrap to apply config entries
wait_for_config_entry proxy-defaults global
wait_for_config_entry service-resolver s2
gen_envoy_bootstrap s1 19000
gen_envoy_bootstrap s2 19001
gen_envoy_bootstrap s2-v1 19002

View File

@ -1,35 +0,0 @@
config_entries {
bootstrap {
kind = "proxy-defaults"
name = "global"
config {
protocol = "http"
}
}
bootstrap {
kind = "service-resolver"
name = "s3"
subsets = {
"v1" = {
filter = "Service.Meta.version == v1"
}
"v2" = {
filter = "Service.Meta.version == v2"
}
}
}
bootstrap {
kind = "service-resolver"
name = "s2"
redirect {
service = "s3"
service_subset = "v2"
}
}
}

View File

@ -2,10 +2,35 @@
set -euo pipefail
# wait for bootstrap to apply config entries
wait_for_config_entry proxy-defaults global
wait_for_config_entry service-resolver s2
wait_for_config_entry service-resolver s3
upsert_config_entry primary '
kind = "proxy-defaults"
name = "global"
config {
protocol = "http"
}
'
upsert_config_entry primary '
kind = "service-resolver"
name = "s3"
subsets = {
"v1" = {
filter = "Service.Meta.version == v1"
}
"v2" = {
filter = "Service.Meta.version == v2"
}
}
'
upsert_config_entry primary '
kind = "service-resolver"
name = "s2"
redirect {
service = "s3"
service_subset = "v2"
}
'
register_services primary

View File

@ -1,37 +0,0 @@
config_entries {
bootstrap {
kind = "proxy-defaults"
name = "global"
config {
protocol = "http"
}
}
bootstrap {
kind = "service-resolver"
name = "s3"
subsets = {
"v1" = {
filter = "Service.Meta.version == v1"
}
"v2" = {
filter = "Service.Meta.version == v2"
}
}
}
bootstrap {
kind = "service-resolver"
name = "s2"
failover = {
"*" = {
service = "s3"
service_subset = "v1"
}
}
}
}

View File

@ -2,10 +2,37 @@
set -euo pipefail
# wait for bootstrap to apply config entries
wait_for_config_entry proxy-defaults global
wait_for_config_entry service-resolver s2
wait_for_config_entry service-resolver s3
upsert_config_entry primary '
kind = "proxy-defaults"
name = "global"
config {
protocol = "http"
}
'
upsert_config_entry primary '
kind = "service-resolver"
name = "s3"
subsets = {
"v1" = {
filter = "Service.Meta.version == v1"
}
"v2" = {
filter = "Service.Meta.version == v2"
}
}
'
upsert_config_entry primary '
kind = "service-resolver"
name = "s2"
failover = {
"*" = {
service = "s3"
service_subset = "v1"
}
}
'
register_services primary

View File

@ -1,19 +0,0 @@
config_entries {
bootstrap {
kind = "proxy-defaults"
name = "global"
config {
protocol = "http"
}
}
bootstrap {
kind = "service-resolver"
name = "s2"
redirect {
service = "s3"
}
}
}

View File

@ -2,9 +2,21 @@
set -eEuo pipefail
# wait for bootstrap to apply config entries
wait_for_config_entry proxy-defaults global
wait_for_config_entry service-resolver s2
upsert_config_entry primary '
kind = "proxy-defaults"
name = "global"
config {
protocol = "http"
}
'
upsert_config_entry primary '
kind = "service-resolver"
name = "s2"
redirect {
service = "s3"
}
'
register_services primary

View File

@ -1,19 +0,0 @@
config_entries {
bootstrap {
kind = "proxy-defaults"
name = "global"
config {
protocol = "tcp"
}
}
bootstrap {
kind = "service-resolver"
name = "s2"
redirect {
service = "s3"
}
}
}

View File

@ -2,9 +2,21 @@
set -eEuo pipefail
# wait for bootstrap to apply config entries
wait_for_config_entry proxy-defaults global
wait_for_config_entry service-resolver s2
upsert_config_entry primary '
kind = "proxy-defaults"
name = "global"
config {
protocol = "tcp"
}
'
upsert_config_entry primary '
kind = "service-resolver"
name = "s2"
redirect {
service = "s3"
}
'
register_services primary

View File

@ -1,327 +0,0 @@
config_entries {
bootstrap {
kind = "proxy-defaults"
name = "global"
config {
protocol = "http"
}
}
bootstrap {
kind = "service-resolver"
name = "s2"
default_subset = "v1"
subsets = {
"v1" = {
filter = "Service.Meta.version == v1"
}
"v2" = {
filter = "Service.Meta.version == v2"
}
}
}
bootstrap {
kind = "service-router"
name = "s2"
routes = [
{
match { http { path_exact = "/exact/debug" } }
destination {
service_subset = "v2"
prefix_rewrite = "/debug"
}
},
{
match { http { path_exact = "/exact-alt/debug" } }
destination {
service_subset = "v1"
prefix_rewrite = "/debug"
}
},
{
match { http { path_prefix = "/prefix/" } }
destination {
service_subset = "v2"
prefix_rewrite = "/"
}
},
{
match { http { path_prefix = "/prefix-alt/" } }
destination {
service_subset = "v1"
prefix_rewrite = "/"
}
},
{
match { http {
path_regex = "/deb[ug]{2}"
header = [{
name = "x-test-debug"
exact = "regex-path"
}]
} }
destination {
service_subset = "v2"
retry_on_connect_failure = true # TODO: test
retry_on = ["reset"] # TODO: test
retry_on_status_codes = [500, 512] # TODO: test
}
},
{
match { http {
path_exact = "/hdr-present/debug"
header = [
{
name = "x-test-debug"
present = true
},
]
} },
destination {
service_subset = "v2"
prefix_rewrite = "/debug"
}
},
{
match { http {
path_exact = "/hdr-present/debug"
header = [
{
name = "x-test-debug"
present = true
invert = true
},
]
} },
destination {
service_subset = "v1"
prefix_rewrite = "/debug"
}
},
{
match { http {
path_exact = "/hdr-exact/debug"
header = [
{
name = "x-test-debug"
exact = "exact"
},
]
} },
destination {
service_subset = "v2"
prefix_rewrite = "/debug"
}
},
{
match { http {
path_exact = "/hdr-exact/debug"
header = [
{
name = "x-test-debug"
exact = "exact-alt"
},
]
} },
destination {
service_subset = "v1"
prefix_rewrite = "/debug"
}
},
{
match { http {
path_exact = "/hdr-prefix/debug"
header = [
{
name = "x-test-debug"
prefix = "prefi"
},
] } },
destination {
service_subset = "v2"
prefix_rewrite = "/debug"
}
},
{
match { http {
path_exact = "/hdr-prefix/debug"
header = [
{
name = "x-test-debug"
prefix = "alt-prefi"
},
] } },
destination {
service_subset = "v1"
prefix_rewrite = "/debug"
}
},
{
match { http {
path_exact = "/hdr-suffix/debug"
header = [
{
name = "x-test-debug"
suffix = "uffix"
},
]
} },
destination {
service_subset = "v2"
prefix_rewrite = "/debug"
}
},
{
match { http {
path_exact = "/hdr-suffix/debug"
header = [
{
name = "x-test-debug"
suffix = "uffix-alt"
},
]
} },
destination {
service_subset = "v1"
prefix_rewrite = "/debug"
}
},
{
match { http {
path_exact = "/hdr-regex/debug"
header = [
{
name = "x-test-debug"
regex = "reg[ex]{2}"
},
]
} },
destination {
service_subset = "v2"
prefix_rewrite = "/debug"
}
},
{
match { http {
path_exact = "/hdr-regex/debug"
header = [
{
name = "x-test-debug"
regex = "reg[ex]{3}"
},
]
} },
destination {
service_subset = "v1"
prefix_rewrite = "/debug"
}
},
{
match { http {
path_exact = "/hdr-invert/debug"
header = [
{
name = "x-test-debug"
exact = "not-this"
invert = true
},
],
} },
destination {
service_subset = "v2"
prefix_rewrite = "/debug"
}
},
{
match { http {
path_exact = "/qp-present/debug"
query_param = [
{
name = "env"
present = true
},
],
} },
destination {
service_subset = "v2"
prefix_rewrite = "/debug"
}
},
{
match { http {
path_exact = "/qp-exact/debug"
query_param = [
{
name = "env"
exact = "dump"
},
],
} },
destination {
service_subset = "v2"
prefix_rewrite = "/debug"
}
},
{
match { http {
path_exact = "/qp-regex/debug"
query_param = [
{
name = "env"
regex = "du[mp]{2}"
},
],
} },
destination {
service_subset = "v2"
prefix_rewrite = "/debug"
}
},
{
match { http {
path_exact = "/method-match/debug"
methods = ["GET", "PUT"]
} },
destination {
service_subset = "v2"
prefix_rewrite = "/debug"
}
},
{
match { http {
path_exact = "/header-manip/debug"
} },
destination {
service_subset = "v2"
prefix_rewrite = "/debug"
request_headers {
set {
x-foo = "request-bar"
}
remove = ["x-bad-req"]
}
}
},
{
match { http {
path_exact = "/header-manip/echo"
} },
destination {
service_subset = "v2"
prefix_rewrite = "/"
response_headers {
add {
x-foo = "response-bar"
}
remove = ["x-bad-resp"]
}
}
},
]
}
}

View File

@ -2,10 +2,327 @@
set -euo pipefail
# wait for bootstrap to apply config entries
wait_for_config_entry proxy-defaults global
wait_for_config_entry service-resolver s2
wait_for_config_entry service-router s2
upsert_config_entry primary '
kind = "proxy-defaults"
name = "global"
config {
protocol = "http"
}
'
upsert_config_entry primary '
kind = "service-resolver"
name = "s2"
default_subset = "v1"
subsets = {
"v1" = {
filter = "Service.Meta.version == v1"
}
"v2" = {
filter = "Service.Meta.version == v2"
}
}
'
upsert_config_entry primary '
kind = "service-router"
name = "s2"
routes = [
{
match { http { path_exact = "/exact/debug" } }
destination {
service_subset = "v2"
prefix_rewrite = "/debug"
}
},
{
match { http { path_exact = "/exact-alt/debug" } }
destination {
service_subset = "v1"
prefix_rewrite = "/debug"
}
},
{
match { http { path_prefix = "/prefix/" } }
destination {
service_subset = "v2"
prefix_rewrite = "/"
}
},
{
match { http { path_prefix = "/prefix-alt/" } }
destination {
service_subset = "v1"
prefix_rewrite = "/"
}
},
{
match { http {
path_regex = "/deb[ug]{2}"
header = [{
name = "x-test-debug"
exact = "regex-path"
}]
} }
destination {
service_subset = "v2"
retry_on_connect_failure = true # TODO: test
retry_on = ["reset"] # TODO: test
retry_on_status_codes = [500, 512] # TODO: test
}
},
{
match { http {
path_exact = "/hdr-present/debug"
header = [
{
name = "x-test-debug"
present = true
},
]
} },
destination {
service_subset = "v2"
prefix_rewrite = "/debug"
}
},
{
match { http {
path_exact = "/hdr-present/debug"
header = [
{
name = "x-test-debug"
present = true
invert = true
},
]
} },
destination {
service_subset = "v1"
prefix_rewrite = "/debug"
}
},
{
match { http {
path_exact = "/hdr-exact/debug"
header = [
{
name = "x-test-debug"
exact = "exact"
},
]
} },
destination {
service_subset = "v2"
prefix_rewrite = "/debug"
}
},
{
match { http {
path_exact = "/hdr-exact/debug"
header = [
{
name = "x-test-debug"
exact = "exact-alt"
},
]
} },
destination {
service_subset = "v1"
prefix_rewrite = "/debug"
}
},
{
match { http {
path_exact = "/hdr-prefix/debug"
header = [
{
name = "x-test-debug"
prefix = "prefi"
},
] } },
destination {
service_subset = "v2"
prefix_rewrite = "/debug"
}
},
{
match { http {
path_exact = "/hdr-prefix/debug"
header = [
{
name = "x-test-debug"
prefix = "alt-prefi"
},
] } },
destination {
service_subset = "v1"
prefix_rewrite = "/debug"
}
},
{
match { http {
path_exact = "/hdr-suffix/debug"
header = [
{
name = "x-test-debug"
suffix = "uffix"
},
]
} },
destination {
service_subset = "v2"
prefix_rewrite = "/debug"
}
},
{
match { http {
path_exact = "/hdr-suffix/debug"
header = [
{
name = "x-test-debug"
suffix = "uffix-alt"
},
]
} },
destination {
service_subset = "v1"
prefix_rewrite = "/debug"
}
},
{
match { http {
path_exact = "/hdr-regex/debug"
header = [
{
name = "x-test-debug"
regex = "reg[ex]{2}"
},
]
} },
destination {
service_subset = "v2"
prefix_rewrite = "/debug"
}
},
{
match { http {
path_exact = "/hdr-regex/debug"
header = [
{
name = "x-test-debug"
regex = "reg[ex]{3}"
},
]
} },
destination {
service_subset = "v1"
prefix_rewrite = "/debug"
}
},
{
match { http {
path_exact = "/hdr-invert/debug"
header = [
{
name = "x-test-debug"
exact = "not-this"
invert = true
},
],
} },
destination {
service_subset = "v2"
prefix_rewrite = "/debug"
}
},
{
match { http {
path_exact = "/qp-present/debug"
query_param = [
{
name = "env"
present = true
},
],
} },
destination {
service_subset = "v2"
prefix_rewrite = "/debug"
}
},
{
match { http {
path_exact = "/qp-exact/debug"
query_param = [
{
name = "env"
exact = "dump"
},
],
} },
destination {
service_subset = "v2"
prefix_rewrite = "/debug"
}
},
{
match { http {
path_exact = "/qp-regex/debug"
query_param = [
{
name = "env"
regex = "du[mp]{2}"
},
],
} },
destination {
service_subset = "v2"
prefix_rewrite = "/debug"
}
},
{
match { http {
path_exact = "/method-match/debug"
methods = ["GET", "PUT"]
} },
destination {
service_subset = "v2"
prefix_rewrite = "/debug"
}
},
{
match { http {
path_exact = "/header-manip/debug"
} },
destination {
service_subset = "v2"
prefix_rewrite = "/debug"
request_headers {
set {
x-foo = "request-bar"
}
remove = ["x-bad-req"]
}
}
},
{
match { http {
path_exact = "/header-manip/echo"
} },
destination {
service_subset = "v2"
prefix_rewrite = "/"
response_headers {
add {
x-foo = "response-bar"
}
remove = ["x-bad-resp"]
}
}
},
]
'
register_services primary

View File

@ -1,26 +0,0 @@
config_entries {
bootstrap = [
{
kind = "proxy-defaults"
name = "global"
config {
protocol = "tcp"
}
},
{
kind = "exported-services"
name = "default"
services = [
{
name = "s2"
consumers = [
{
peer_name = "alpha-to-primary"
}
]
}
]
}
]
}

View File

@ -2,10 +2,30 @@
set -euo pipefail
upsert_config_entry alpha '
kind = "proxy-defaults"
name = "global"
config {
protocol = "tcp"
}
'
upsert_config_entry alpha '
kind = "exported-services"
name = "default"
services = [
{
name = "s2"
consumers = [
{
peer_name = "alpha-to-primary"
}
]
}
]
'
register_services alpha
gen_envoy_bootstrap s2 19002 alpha
gen_envoy_bootstrap mesh-gateway 19003 alpha true
wait_for_config_entry proxy-defaults global alpha
wait_for_config_entry exported-services default alpha

View File

@ -1,53 +0,0 @@
config_entries {
bootstrap {
kind = "proxy-defaults"
name = "global"
config {
protocol = "http"
}
}
bootstrap {
kind = "service-splitter"
name = "split-s2"
splits = [
{
Weight = 50
Service = "local-s2"
ResponseHeaders {
Set {
"x-test-split" = "primary"
}
}
},
{
Weight = 50
Service = "peer-s2"
ResponseHeaders {
Set {
"x-test-split" = "alpha"
}
}
},
]
}
bootstrap {
kind = "service-resolver"
name = "local-s2"
redirect = {
service = "s2"
}
}
bootstrap {
kind = "service-resolver"
name = "peer-s2"
redirect = {
service = "s2"
peer = "primary-to-alpha"
}
}
}

View File

@ -2,9 +2,57 @@
set -euo pipefail
upsert_config_entry primary '
kind = "proxy-defaults"
name = "global"
config {
protocol = "http"
}
'
upsert_config_entry primary '
kind = "service-splitter"
name = "split-s2"
splits = [
{
Weight = 50
Service = "local-s2"
ResponseHeaders {
Set {
"x-test-split" = "primary"
}
}
},
{
Weight = 50
Service = "peer-s2"
ResponseHeaders {
Set {
"x-test-split" = "alpha"
}
}
},
]
'
upsert_config_entry primary '
kind = "service-resolver"
name = "local-s2"
redirect = {
service = "s2"
}
'
upsert_config_entry primary '
kind = "service-resolver"
name = "peer-s2"
redirect = {
service = "s2"
peer = "primary-to-alpha"
}
'
register_services primary
gen_envoy_bootstrap s1 19000 primary
gen_envoy_bootstrap s2 19001 primary
wait_for_config_entry proxy-defaults global

View File

@ -1,65 +0,0 @@
config_entries {
bootstrap {
kind = "proxy-defaults"
name = "global"
config {
protocol = "http"
}
}
bootstrap {
kind = "service-resolver"
name = "s2"
subsets = {
"v1" = {
filter = "Service.Meta.version == v1"
}
"v2" = {
filter = "Service.Meta.version == v2"
}
}
}
bootstrap {
kind = "service-splitter"
name = "s2"
splits = [
{
weight = 50,
service_subset = "v2"
request_headers {
set {
x-split-leg = "v2"
}
remove = ["x-bad-req"]
}
response_headers {
add {
x-svc-version = "v2"
}
remove = ["x-bad-resp"]
}
},
{
weight = 50,
service_subset = "v1"
request_headers {
set {
x-split-leg = "v1"
}
remove = ["x-bad-req"]
}
response_headers {
add {
x-svc-version = "v1"
}
remove = ["x-bad-resp"]
}
},
]
}
}

View File

@ -2,10 +2,65 @@
set -euo pipefail
# wait for bootstrap to apply config entries
wait_for_config_entry proxy-defaults global
wait_for_config_entry service-resolver s2
wait_for_config_entry service-splitter s2
upsert_config_entry primary '
kind = "proxy-defaults"
name = "global"
config {
protocol = "http"
}
'
upsert_config_entry primary '
kind = "service-resolver"
name = "s2"
subsets = {
"v1" = {
filter = "Service.Meta.version == v1"
}
"v2" = {
filter = "Service.Meta.version == v2"
}
}
'
upsert_config_entry primary '
kind = "service-splitter"
name = "s2"
splits = [
{
weight = 50,
service_subset = "v2"
request_headers {
set {
x-split-leg = "v2"
}
remove = ["x-bad-req"]
}
response_headers {
add {
x-svc-version = "v2"
}
remove = ["x-bad-resp"]
}
},
{
weight = 50,
service_subset = "v1"
request_headers {
set {
x-split-leg = "v1"
}
remove = ["x-bad-req"]
}
response_headers {
add {
x-svc-version = "v1"
}
remove = ["x-bad-resp"]
}
},
]
'
register_services primary

View File

@ -1,34 +0,0 @@
config_entries {
bootstrap = [
{
kind = "proxy-defaults"
name = "global"
config {
protocol = "tcp"
}
},
{
kind = "exported-services"
name = "default"
services = [
{
name = "s1"
consumers = [
{
peer_name = "alpha-to-primary"
}
]
},
{
name = "s2"
consumers = [
{
peer_name = "alpha-to-primary"
}
]
}
]
}
]
}

View File

@ -2,8 +2,36 @@
set -euo pipefail
wait_for_config_entry proxy-defaults global alpha
wait_for_config_entry exported-services default alpha
upsert_config_entry alpha '
kind = "proxy-defaults"
name = "global"
config {
protocol = "tcp"
}
'
upsert_config_entry alpha '
kind = "exported-services"
name = "default"
services = [
{
name = "s1"
consumers = [
{
peer_name = "alpha-to-primary"
}
]
},
{
name = "s2"
consumers = [
{
peer_name = "alpha-to-primary"
}
]
}
]
'
register_services alpha

View File

@ -1,88 +0,0 @@
config_entries {
bootstrap {
kind = "proxy-defaults"
name = "global"
config {
protocol = "http"
}
}
bootstrap {
kind = "ingress-gateway"
name = "ingress-gateway"
listeners = [
{
protocol = "http"
port = 9999
services = [
{
name = "peer-s2"
}
]
},
{
protocol = "http"
port = 10000
services = [
{
name = "peer-s1"
}
]
},
{
protocol = "http"
port = 10001
services = [
{
name = "s1"
}
]
},
{
protocol = "http"
port = 10002
services = [
{
name = "split"
}
]
}
]
}
bootstrap {
kind = "service-resolver"
name = "peer-s1"
redirect = {
service = "s1"
peer = "primary-to-alpha"
}
}
bootstrap {
kind = "service-resolver"
name = "peer-s2"
redirect = {
service = "s2"
peer = "primary-to-alpha"
}
}
bootstrap {
kind = "service-splitter"
name = "split"
splits = [
{
Weight = 50
Service = "peer-s1"
},
{
Weight = 50
Service = "peer-s2"
},
]
}
}

View File

@ -2,13 +2,91 @@
set -eEuo pipefail
# wait for bootstrap to apply config entries
wait_for_config_entry ingress-gateway ingress-gateway
wait_for_config_entry proxy-defaults global
wait_for_config_entry service-resolver peer-s1
wait_for_config_entry service-resolver peer-s2
upsert_config_entry primary '
kind = "proxy-defaults"
name = "global"
config {
protocol = "http"
}
'
upsert_config_entry primary '
kind = "ingress-gateway"
name = "ingress-gateway"
listeners = [
{
protocol = "http"
port = 9999
services = [
{
name = "peer-s2"
}
]
},
{
protocol = "http"
port = 10000
services = [
{
name = "peer-s1"
}
]
},
{
protocol = "http"
port = 10001
services = [
{
name = "s1"
}
]
},
{
protocol = "http"
port = 10002
services = [
{
name = "split"
}
]
}
]
'
upsert_config_entry primary '
kind = "service-resolver"
name = "peer-s1"
redirect = {
service = "s1"
peer = "primary-to-alpha"
}
'
upsert_config_entry primary '
kind = "service-resolver"
name = "peer-s2"
redirect = {
service = "s2"
peer = "primary-to-alpha"
}
'
upsert_config_entry primary '
kind = "service-splitter"
name = "split"
splits = [
{
Weight = 50
Service = "peer-s1"
},
{
Weight = 50
Service = "peer-s2"
},
]
'
register_services primary
gen_envoy_bootstrap ingress-gateway 20000 primary true
gen_envoy_bootstrap s1 19000 primary
gen_envoy_bootstrap s1 19000 primary

View File

@ -1,32 +0,0 @@
config_entries {
bootstrap = [
{
kind = "proxy-defaults"
name = "global"
config {
protocol = "tcp"
}
},
{
kind = "mesh"
peering {
peer_through_mesh_gateways = true
}
},
{
kind = "exported-services"
name = "default"
services = [
{
name = "s2"
consumers = [
{
peer = "alpha-to-primary"
}
]
}
]
}
]
}

View File

@ -2,11 +2,37 @@
set -euo pipefail
upsert_config_entry alpha '
kind = "proxy-defaults"
name = "global"
config {
protocol = "tcp"
}
'
upsert_config_entry alpha '
kind = "mesh"
peering {
peer_through_mesh_gateways = true
}
'
upsert_config_entry alpha '
kind = "exported-services"
name = "default"
services = [
{
name = "s2"
consumers = [
{
peer = "alpha-to-primary"
}
]
}
]
'
register_services alpha
gen_envoy_bootstrap s2 19002 alpha
gen_envoy_bootstrap mesh-gateway 19003 alpha true
wait_for_config_entry proxy-defaults global alpha
wait_for_config_entry exported-services default alpha
wait_for_config_entry mesh mesh alpha

View File

@ -1,18 +0,0 @@
config_entries {
bootstrap = [
{
kind = "proxy-defaults"
name = "global"
config {
protocol = "tcp"
}
},
{
kind = "mesh"
peering {
peer_through_mesh_gateways = true
}
}
]
}

View File

@ -2,10 +2,21 @@
set -euo pipefail
upsert_config_entry primary '
kind = "proxy-defaults"
name = "global"
config {
protocol = "tcp"
}
'
upsert_config_entry primary '
kind = "mesh"
peering {
peer_through_mesh_gateways = true
}
'
register_services primary
gen_envoy_bootstrap s1 19000 primary
gen_envoy_bootstrap mesh-gateway 19001 primary true
wait_for_config_entry proxy-defaults global
wait_for_config_entry mesh mesh alpha

View File

@ -1,39 +0,0 @@
config_entries {
bootstrap = [
{
kind = "proxy-defaults"
name = "global"
config {
protocol = "http"
}
},
{
kind = "service-router"
name = "s2"
routes = [
{
match { http { path_prefix = "/s3/" } }
destination {
service = "s3"
prefix_rewrite = "/"
}
},
]
},
{
kind = "exported-services"
name = "default"
services = [
{
name = "s2"
consumers = [
{
peer = "alpha-to-primary"
}
]
}
]
}
]
}

View File

@ -2,12 +2,45 @@
set -euo pipefail
upsert_config_entry alpha '
kind = "proxy-defaults"
name = "global"
config {
protocol = "http"
}
'
upsert_config_entry alpha '
kind = "service-router"
name = "s2"
routes = [
{
match { http { path_prefix = "/s3/" } }
destination {
service = "s3"
prefix_rewrite = "/"
}
},
]
'
upsert_config_entry alpha '
kind = "exported-services"
name = "default"
services = [
{
name = "s2"
consumers = [
{
peer = "alpha-to-primary"
}
]
}
]
'
register_services alpha
gen_envoy_bootstrap s2 19002 alpha
gen_envoy_bootstrap mesh-gateway 19003 alpha true
gen_envoy_bootstrap s3 19004 alpha
wait_for_config_entry proxy-defaults global alpha
wait_for_config_entry service-router s2 alpha
wait_for_config_entry exported-services default alpha

View File

@ -1,12 +0,0 @@
config_entries {
bootstrap = [
{
kind = "proxy-defaults"
name = "global"
config {
protocol = "http"
}
}
]
}

View File

@ -2,9 +2,15 @@
set -euo pipefail
upsert_config_entry primary '
kind = "proxy-defaults"
name = "global"
config {
protocol = "http"
}
'
register_services primary
gen_envoy_bootstrap s1 19000 primary
gen_envoy_bootstrap mesh-gateway 19001 primary true
wait_for_config_entry proxy-defaults global

View File

@ -1,26 +0,0 @@
config_entries {
bootstrap = [
{
kind = "proxy-defaults"
name = "global"
config {
protocol = "http"
}
},
{
kind = "exported-services"
name = "default"
services = [
{
name = "s2"
consumers = [
{
peer = "alpha-to-primary"
}
]
}
]
}
]
}

View File

@ -2,10 +2,30 @@
set -euo pipefail
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"
}
]
}
]
'
register_services alpha
gen_envoy_bootstrap s2 19002 alpha
gen_envoy_bootstrap mesh-gateway 19003 alpha true
wait_for_config_entry proxy-defaults global alpha
wait_for_config_entry exported-services default alpha

View File

@ -1,13 +0,0 @@
config_entries {
bootstrap = [
{
kind = "proxy-defaults"
name = "global"
config {
# This shouldn't affect the imported listener's protocol, which should be http.
protocol = "tcp"
}
}
]
}

View File

@ -2,9 +2,16 @@
set -euo pipefail
upsert_config_entry primary '
kind = "proxy-defaults"
name = "global"
config {
# This should not affect the imported listener protocol, which should be http.
protocol = "tcp"
}
'
register_services primary
gen_envoy_bootstrap s1 19000 primary
gen_envoy_bootstrap mesh-gateway 19001 primary true
wait_for_config_entry proxy-defaults global

View File

@ -1,33 +0,0 @@
config_entries {
bootstrap = [
{
kind = "proxy-defaults"
name = "global"
config {
protocol = "tcp"
}
},
{
kind = "service-resolver"
name = "s2"
redirect {
service = "s3"
}
},
{
kind = "exported-services"
name = "default"
services = [
{
name = "s2"
consumers = [
{
peer = "alpha-to-primary"
}
]
}
]
}
]
}

View File

@ -2,12 +2,39 @@
set -euo pipefail
upsert_config_entry alpha '
kind = "proxy-defaults"
name = "global"
config {
protocol = "tcp"
}
'
upsert_config_entry alpha '
kind = "service-resolver"
name = "s2"
redirect {
service = "s3"
}
'
upsert_config_entry alpha '
kind = "exported-services"
name = "default"
services = [
{
name = "s2"
consumers = [
{
peer = "alpha-to-primary"
}
]
}
]
'
register_services alpha
gen_envoy_bootstrap s2 19002 alpha
gen_envoy_bootstrap mesh-gateway 19003 alpha true
gen_envoy_bootstrap s3 19004 alpha
wait_for_config_entry proxy-defaults global alpha
wait_for_config_entry service-resolver s2 alpha
wait_for_config_entry exported-services default alpha

View File

@ -1,12 +0,0 @@
config_entries {
bootstrap = [
{
kind = "proxy-defaults"
name = "global"
config {
protocol = "tcp"
}
}
]
}

View File

@ -2,9 +2,15 @@
set -euo pipefail
upsert_config_entry primary '
kind = "proxy-defaults"
name = "global"
config {
protocol = "tcp"
}
'
register_services primary
gen_envoy_bootstrap s1 19000 primary
gen_envoy_bootstrap mesh-gateway 19001 primary true
wait_for_config_entry proxy-defaults global

View File

@ -1,26 +0,0 @@
config_entries {
bootstrap = [
{
kind = "proxy-defaults"
name = "global"
config {
protocol = "tcp"
}
},
{
kind = "exported-services"
name = "default"
services = [
{
name = "s2"
consumers = [
{
peer = "alpha-to-primary"
}
]
}
]
}
]
}

View File

@ -2,10 +2,30 @@
set -euo pipefail
upsert_config_entry alpha '
kind = "proxy-defaults"
name = "global"
config {
protocol = "tcp"
}
'
upsert_config_entry alpha '
kind = "exported-services"
name = "default"
services = [
{
name = "s2"
consumers = [
{
peer = "alpha-to-primary"
}
]
}
]
'
register_services alpha
gen_envoy_bootstrap s2 19002 alpha
gen_envoy_bootstrap mesh-gateway 19003 alpha true
wait_for_config_entry proxy-defaults global alpha
wait_for_config_entry exported-services default alpha

View File

@ -1,12 +0,0 @@
config_entries {
bootstrap = [
{
kind = "proxy-defaults"
name = "global"
config {
protocol = "tcp"
}
}
]
}

View File

@ -2,9 +2,15 @@
set -euo pipefail
upsert_config_entry primary '
kind = "proxy-defaults"
name = "global"
config {
protocol = "tcp"
}
'
register_services primary
gen_envoy_bootstrap s1 19000 primary
gen_envoy_bootstrap mesh-gateway 19001 primary true
wait_for_config_entry proxy-defaults global

View File

@ -1,24 +0,0 @@
config_entries {
bootstrap {
kind = "service-defaults"
name = "s1"
protocol = "grpc"
}
bootstrap {
kind = "ingress-gateway"
name = "ingress-gateway"
listeners = [
{
port = 9999
protocol = "grpc"
services = [
{
name = "s1"
hosts = ["localhost:9999"]
}
]
}
]
}
}

View File

@ -2,8 +2,28 @@
set -euo pipefail
# wait for bootstrap to apply config entries
wait_for_config_entry ingress-gateway ingress-gateway
upsert_config_entry primary '
kind = "service-defaults"
name = "s1"
protocol = "grpc"
'
upsert_config_entry primary '
kind = "ingress-gateway"
name = "ingress-gateway"
listeners = [
{
port = 9999
protocol = "grpc"
services = [
{
name = "s1"
hosts = ["localhost:9999"]
}
]
}
]
'
register_services primary

View File

@ -1,81 +0,0 @@
config_entries {
bootstrap = [
{
kind = "proxy-defaults"
name = "global"
config {
protocol = "http"
}
},
{
kind = "ingress-gateway"
name = "ingress-gateway"
listeners = [
{
port = 9999
protocol = "http"
services = [
{
name = "router"
request_headers {
add {
x-foo = "bar-req"
x-existing-1 = "appended-req"
}
set {
x-existing-2 = "replaced-req"
x-client-ip = "%DOWNSTREAM_REMOTE_ADDRESS_WITHOUT_PORT%"
}
remove = ["x-bad-req"]
}
response_headers {
add {
x-foo = "bar-resp"
x-existing-1 = "appended-resp"
}
set {
x-existing-2 = "replaced-resp"
}
remove = ["x-bad-resp"]
}
}
]
}
]
},
{
kind = "service-router"
// This is a "virtual" service name and will not have a backing
// service definition. It must match the name defined in the ingress
// configuration.
name = "router"
routes = [
{
match {
http {
path_prefix = "/s1/"
}
}
destination {
service = "s1"
prefix_rewrite = "/"
}
},
{
match {
http {
path_prefix = "/s2/"
}
}
destination {
service = "s2"
prefix_rewrite = "/"
}
}
]
}
]
}

View File

@ -2,10 +2,82 @@
set -euo pipefail
# wait for bootstrap to apply config entries
wait_for_config_entry ingress-gateway ingress-gateway
wait_for_config_entry proxy-defaults global
wait_for_config_entry service-router router
upsert_config_entry primary '
kind = "proxy-defaults"
name = "global"
config {
protocol = "http"
}
'
upsert_config_entry primary '
kind = "ingress-gateway"
name = "ingress-gateway"
listeners = [
{
port = 9999
protocol = "http"
services = [
{
name = "router"
request_headers {
add {
x-foo = "bar-req"
x-existing-1 = "appended-req"
}
set {
x-existing-2 = "replaced-req"
x-client-ip = "%DOWNSTREAM_REMOTE_ADDRESS_WITHOUT_PORT%"
}
remove = ["x-bad-req"]
}
response_headers {
add {
x-foo = "bar-resp"
x-existing-1 = "appended-resp"
}
set {
x-existing-2 = "replaced-resp"
}
remove = ["x-bad-resp"]
}
}
]
}
]
'
upsert_config_entry primary '
kind = "service-router"
// This is a "virtual" service name and will not have a backing
// service definition. It must match the name defined in the ingress
// configuration.
name = "router"
routes = [
{
match {
http {
path_prefix = "/s1/"
}
}
destination {
service = "s1"
prefix_rewrite = "/"
}
},
{
match {
http {
path_prefix = "/s2/"
}
}
destination {
service = "s2"
prefix_rewrite = "/"
}
}
]
'
register_services primary

View File

@ -1,45 +0,0 @@
config_entries {
bootstrap = [
{
kind = "proxy-defaults"
name = "global"
config {
protocol = "http"
}
},
{
kind = "ingress-gateway"
name = "ingress-gateway"
Defaults {
MaxConnections = 10
MaxPendingRequests = 20
MaxConcurrentRequests = 30
}
listeners = [
{
port = 9999
protocol = "http"
services = [
{
name = "*"
}
]
},
{
port = 9998
protocol = "http"
services = [
{
name = "s1"
hosts = ["test.example.com"]
MaxConnections = 100
MaxPendingRequests = 200
MaxConcurrentRequests = 300
}
]
}
]
}
]
}

View File

@ -2,9 +2,47 @@
set -euo pipefail
# wait for bootstrap to apply config entries
wait_for_config_entry ingress-gateway ingress-gateway
wait_for_config_entry proxy-defaults global
upsert_config_entry primary '
kind = "proxy-defaults"
name = "global"
config {
protocol = "http"
}
'
upsert_config_entry primary '
kind = "ingress-gateway"
name = "ingress-gateway"
Defaults {
MaxConnections = 10
MaxPendingRequests = 20
MaxConcurrentRequests = 30
}
listeners = [
{
port = 9999
protocol = "http"
services = [
{
name = "*"
}
]
},
{
port = 9998
protocol = "http"
services = [
{
name = "s1"
hosts = ["test.example.com"]
MaxConnections = 100
MaxPendingRequests = 200
MaxConcurrentRequests = 300
}
]
}
]
'
register_services primary

View File

@ -1,26 +0,0 @@
config_entries {
bootstrap = [
{
kind = "proxy-defaults"
name = "global"
config {
protocol = "tcp"
}
},
{
kind = "exported-services"
name = "default"
services = [
{
name = "s2"
consumers = [
{
peer_name = "alpha-to-primary"
}
]
}
]
}
]
}

View File

@ -2,10 +2,30 @@
set -euo pipefail
upsert_config_entry alpha '
kind = "proxy-defaults"
name = "global"
config {
protocol = "tcp"
}
'
upsert_config_entry alpha '
kind = "exported-services"
name = "default"
services = [
{
name = "s2"
consumers = [
{
peer_name = "alpha-to-primary"
}
]
}
]
'
register_services alpha
gen_envoy_bootstrap s2 19002 alpha
gen_envoy_bootstrap mesh-gateway 19003 alpha true
wait_for_config_entry proxy-defaults global alpha
wait_for_config_entry exported-services default alpha

View File

@ -1,47 +0,0 @@
config_entries {
bootstrap {
kind = "proxy-defaults"
name = "global"
config {
protocol = "tcp"
}
}
bootstrap {
kind = "ingress-gateway"
name = "ingress-gateway"
listeners = [
{
protocol = "tcp"
port = 10000
services = [
{
name = "s2"
}
]
}
]
}
bootstrap {
kind = "service-resolver"
name = "s2"
failover = {
"*" = {
targets = [{peer = "primary-to-alpha"}]
}
}
}
bootstrap {
kind = "service-resolver"
name = "virtual-s2"
redirect = {
service = "s2"
peer = "primary-to-alpha"
}
}
}

View File

@ -2,12 +2,50 @@
set -euo pipefail
wait_for_config_entry ingress-gateway ingress-gateway
wait_for_config_entry proxy-defaults global
wait_for_config_entry service-resolver s2
wait_for_config_entry service-resolver virtual-s2
upsert_config_entry primary '
kind = "proxy-defaults"
name = "global"
config {
protocol = "tcp"
}
'
upsert_config_entry primary '
kind = "ingress-gateway"
name = "ingress-gateway"
listeners = [
{
protocol = "tcp"
port = 10000
services = [
{
name = "s2"
}
]
}
]
'
upsert_config_entry primary '
kind = "service-resolver"
name = "s2"
failover = {
"*" = {
targets = [{ peer = "primary-to-alpha" }]
}
}
'
upsert_config_entry primary '
kind = "service-resolver"
name = "virtual-s2"
redirect = {
service = "s2"
peer = "primary-to-alpha"
}
'
register_services primary
gen_envoy_bootstrap ingress-gateway 20000 primary true
gen_envoy_bootstrap s2 19001 primary
gen_envoy_bootstrap s2 19001 primary

View File

@ -1,60 +0,0 @@
config_entries {
bootstrap = [
{
kind = "proxy-defaults"
name = "global"
config {
protocol = "http"
}
},
{
kind = "ingress-gateway"
name = "ingress-gateway"
listeners = [
{
port = 9999
protocol = "http"
services = [
{
name = "*"
}
]
tls {
sds {
cluster_name = "sds-cluster"
cert_resource = "wildcard.ingress.consul"
}
}
},
{
port = 9998
protocol = "http"
services = [
{
name = "s1"
hosts = ["foo.example.com"]
tls {
sds {
cluster_name = "sds-cluster"
cert_resource = "foo.example.com"
}
}
},
{
# Route to s2 on a differet domain with different cert
name = "s2"
hosts = ["www.example.com"]
tls {
sds {
cluster_name = "sds-cluster"
cert_resource = "www.example.com"
}
}
}
]
}
]
}
]
}

View File

@ -2,9 +2,62 @@
set -euo pipefail
# wait for bootstrap to apply config entries
wait_for_config_entry ingress-gateway ingress-gateway
wait_for_config_entry proxy-defaults global
upsert_config_entry primary '
kind = "proxy-defaults"
name = "global"
config {
protocol = "http"
}
'
upsert_config_entry primary '
kind = "ingress-gateway"
name = "ingress-gateway"
listeners = [
{
port = 9999
protocol = "http"
services = [
{
name = "*"
}
]
tls {
sds {
cluster_name = "sds-cluster"
cert_resource = "wildcard.ingress.consul"
}
}
},
{
port = 9998
protocol = "http"
services = [
{
name = "s1"
hosts = ["foo.example.com"]
tls {
sds {
cluster_name = "sds-cluster"
cert_resource = "foo.example.com"
}
}
},
{
# Route to s2 on a differet domain with different cert
name = "s2"
hosts = ["www.example.com"]
tls {
sds {
cluster_name = "sds-cluster"
cert_resource = "www.example.com"
}
}
}
]
}
]
'
register_services primary

View File

@ -1,24 +0,0 @@
config_entries {
bootstrap {
kind = "ingress-gateway"
name = "ingress-gateway"
Defaults {
MaxConnections = 10
MaxPendingRequests = 20
MaxConcurrentRequests = 30
}
listeners = [
{
port = 9999
protocol = "tcp"
services = [
{
name = "s1"
MaxConnections = 100
MaxPendingRequests = 200
}
]
}
]
}
}

View File

@ -2,8 +2,28 @@
set -euo pipefail
# wait for bootstrap to apply config entries
wait_for_config_entry ingress-gateway ingress-gateway
upsert_config_entry primary '
kind = "ingress-gateway"
name = "ingress-gateway"
Defaults {
MaxConnections = 10
MaxPendingRequests = 20
MaxConcurrentRequests = 30
}
listeners = [
{
port = 9999
protocol = "tcp"
services = [
{
name = "s1"
MaxConnections = 100
MaxPendingRequests = 200
}
]
}
]
'
register_services primary

View File

@ -1,41 +0,0 @@
config_entries {
bootstrap = [
{
kind = "proxy-defaults"
name = "global"
config {
protocol = "http"
}
},
{
kind = "ingress-gateway"
name = "ingress-gateway"
tls {
enabled = true
}
listeners = [
{
port = 9998
protocol = "http"
services = [
{
name = "s1"
}
]
},
{
port = 9999
protocol = "http"
services = [
{
name = "s1"
hosts = ["test.example.com"]
}
]
}
]
}
]
}

View File

@ -2,8 +2,42 @@
set -euo pipefail
# wait for bootstrap to apply config entries
wait_for_config_entry ingress-gateway ingress-gateway
upsert_config_entry primary '
kind = "proxy-defaults"
name = "global"
config {
protocol = "http"
}
'
upsert_config_entry primary '
kind = "ingress-gateway"
name = "ingress-gateway"
tls {
enabled = true
}
listeners = [
{
port = 9998
protocol = "http"
services = [
{
name = "s1"
}
]
},
{
port = 9999
protocol = "http"
services = [
{
name = "s1"
hosts = ["test.example.com"]
}
]
}
]
'
register_services primary

View File

@ -1,61 +0,0 @@
config_entries {
bootstrap {
kind = "ingress-gateway"
name = "ingress-gateway"
listeners = [
{
protocol = "tcp"
port = 9999
services = [
{
name = "s2"
}
]
},
{
protocol = "tcp"
port = 10000
services = [
{
name = "s1"
}
]
}
]
}
bootstrap {
kind = "proxy-defaults"
name = "global"
mesh_gateway {
mode = "local"
}
}
bootstrap {
kind = "service-resolver"
name = "s2"
redirect {
service = "s2"
datacenter = "secondary"
}
}
bootstrap {
kind = "service-defaults"
name = "s1"
mesh_gateway {
mode = "remote"
}
}
bootstrap {
kind = "service-resolver"
name = "s1"
redirect {
service = "s1"
datacenter = "secondary"
}
}
}

View File

@ -2,13 +2,67 @@
set -eEuo pipefail
# wait for bootstrap to apply config entries
wait_for_config_entry ingress-gateway ingress-gateway
wait_for_config_entry proxy-defaults global
upsert_config_entry primary '
kind = "ingress-gateway"
name = "ingress-gateway"
listeners = [
{
protocol = "tcp"
port = 9999
services = [
{
name = "s2"
}
]
},
{
protocol = "tcp"
port = 10000
services = [
{
name = "s1"
}
]
}
]
'
upsert_config_entry primary '
kind = "proxy-defaults"
name = "global"
mesh_gateway {
mode = "local"
}
'
upsert_config_entry primary '
kind = "service-resolver"
name = "s2"
redirect {
service = "s2"
datacenter = "secondary"
}
'
upsert_config_entry primary '
kind = "service-defaults"
name = "s1"
mesh_gateway {
mode = "remote"
}
'
upsert_config_entry primary '
kind = "service-resolver"
name = "s1"
redirect {
service = "s1"
datacenter = "secondary"
}
'
register_services primary
gen_envoy_bootstrap mesh-gateway 19002 primary true
gen_envoy_bootstrap ingress-gateway 20000 primary true
retry_default docker_consul primary curl -s "http://localhost:8500/v1/catalog/service/consul?dc=secondary" >/dev/null

View File

@ -0,0 +1,3 @@
acl {
default_policy = "deny"
}

View File

@ -1,97 +0,0 @@
enable_central_service_config = true
acl {
default_policy = "deny"
}
config_entries {
bootstrap {
kind = "service-defaults"
name = "s2"
protocol = "http"
}
# TODO: test header invert
bootstrap {
kind = "service-intentions"
name = "s2"
sources {
name = "s1"
permissions = [
// paths
{
action = "allow"
http { path_exact = "/exact" }
},
{
action = "allow"
http { path_prefix = "/prefix" }
},
{
action = "allow"
http { path_regex = "/reg[ex]{2}" }
},
// headers
{
action = "allow"
http {
path_exact = "/hdr-present"
header = [{
name = "x-test-debug"
present = true
}]
}
},
{
action = "allow"
http {
path_exact = "/hdr-exact"
header = [{
name = "x-test-debug"
exact = "exact"
}]
}
},
{
action = "allow"
http {
path_exact = "/hdr-prefix"
header = [{
name = "x-test-debug"
prefix = "prefi"
}]
}
},
{
action = "allow"
http {
path_exact = "/hdr-suffix"
header = [{
name = "x-test-debug"
suffix = "uffix"
}]
}
},
{
action = "allow"
http {
path_exact = "/hdr-regex"
header = [{
name = "x-test-debug"
regex = "reg[ex]{2}"
}]
}
},
// methods
{
action = "allow"
http {
path_exact = "/method-match"
methods = ["GET", "PUT"]
}
}
]
}
}
}

View File

@ -2,9 +2,93 @@
set -euo pipefail
# wait for bootstrap to apply config entries
wait_for_config_entry service-defaults s2
wait_for_config_entry service-intentions s2
upsert_config_entry primary '
kind = "service-defaults"
name = "s2"
protocol = "http"
'
upsert_config_entry primary '
kind = "service-intentions"
name = "s2"
sources {
name = "s1"
permissions = [
// paths
{
action = "allow"
http { path_exact = "/exact" }
},
{
action = "allow"
http { path_prefix = "/prefix" }
},
{
action = "allow"
http { path_regex = "/reg[ex]{2}" }
},
// headers
{
action = "allow"
http {
path_exact = "/hdr-present"
header = [{
name = "x-test-debug"
present = true
}]
}
},
{
action = "allow"
http {
path_exact = "/hdr-exact"
header = [{
name = "x-test-debug"
exact = "exact"
}]
}
},
{
action = "allow"
http {
path_exact = "/hdr-prefix"
header = [{
name = "x-test-debug"
prefix = "prefi"
}]
}
},
{
action = "allow"
http {
path_exact = "/hdr-suffix"
header = [{
name = "x-test-debug"
suffix = "uffix"
}]
}
},
{
action = "allow"
http {
path_exact = "/hdr-regex"
header = [{
name = "x-test-debug"
regex = "reg[ex]{2}"
}]
}
},
// methods
{
action = "allow"
http {
path_exact = "/method-match"
methods = ["GET", "PUT"]
}
}
]
}
'
register_services primary

View File

@ -1,12 +0,0 @@
config_entries {
bootstrap {
kind = "terminating-gateway"
name = "terminating-gateway"
services = [
{
name = "l2"
}
]
}
}

View File

@ -5,8 +5,15 @@ set -eEuo pipefail
# Copy lambda config files into the register dir
find ${CASE_DIR} -maxdepth 1 -name '*_l*.json' -type f -exec cp -f {} workdir/${CLUSTER}/register \;
# wait for tgw config entry
wait_for_config_entry terminating-gateway terminating-gateway
upsert_config_entry primary '
kind = "terminating-gateway"
name = "terminating-gateway"
services = [
{
name = "l2"
}
]
'
register_services primary
register_lambdas primary

View File

@ -1,17 +0,0 @@
config_entries {
bootstrap {
kind = "terminating-gateway"
name = "terminating-gateway"
services = [
{
name = "s4"
}
]
}
bootstrap {
kind = "service-defaults"
name = "s4"
protocol = "http"
}
}

View File

@ -2,8 +2,21 @@
set -euo pipefail
# wait for bootstrap to apply config entries
wait_for_config_entry terminating-gateway terminating-gateway
upsert_config_entry primary '
kind = "terminating-gateway"
name = "terminating-gateway"
services = [
{
name = "s4"
}
]
'
upsert_config_entry primary '
kind = "service-defaults"
name = "s4"
protocol = "http"
'
register_services primary

View File

@ -1,12 +0,0 @@
config_entries {
bootstrap {
kind = "terminating-gateway"
name = "terminating-gateway"
services = [
{
name = "s2"
}
]
}
}

View File

@ -2,8 +2,15 @@
set -euo pipefail
# wait for bootstrap to apply config entries
wait_for_config_entry terminating-gateway terminating-gateway
upsert_config_entry primary '
kind = "terminating-gateway"
name = "terminating-gateway"
services = [
{
name = "s2"
}
]
'
register_services primary

View File

@ -1,37 +0,0 @@
config_entries {
bootstrap {
kind = "terminating-gateway"
name = "terminating-gateway"
services = [
{
name = "s2"
}
]
}
bootstrap {
kind = "proxy-defaults"
name = "global"
config {
protocol = "http"
}
}
bootstrap {
kind = "service-resolver"
name = "s2"
default_subset = "v1"
subsets = {
"v1" = {
filter = "Service.Meta.version == v1"
}
"v2" = {
filter = "Service.Meta.version == v2"
}
}
}
}

View File

@ -2,10 +2,37 @@
set -euo pipefail
# wait for bootstrap to apply config entries
wait_for_config_entry terminating-gateway terminating-gateway
wait_for_config_entry proxy-defaults global
wait_for_config_entry service-resolver s2
upsert_config_entry primary '
kind = "terminating-gateway"
name = "terminating-gateway"
services = [
{
name = "s2"
}
]
'
upsert_config_entry primary '
kind = "proxy-defaults"
name = "global"
config {
protocol = "http"
}
'
upsert_config_entry primary '
kind = "service-resolver"
name = "s2"
default_subset = "v1"
subsets = {
"v1" = {
filter = "Service.Meta.version == v1"
}
"v2" = {
filter = "Service.Meta.version == v2"
}
}
'
register_services primary

View File

@ -754,6 +754,13 @@ function wait_for_config_entry {
retry_default read_config_entry "$@" >/dev/null
}
function upsert_config_entry {
local DC="$1"
local BODY="$2"
echo "$BODY" | docker_consul "$DC" config write -
}
function delete_config_entry {
local KIND=$1
local NAME=$2