ui: Amends to Routing visualization for partitions (#11747)

* Update disco fixtures now we have partitions

* Add virtual-admin-6 fixture with partition 'redirects' and failovers

* Properly cope with extra partition segment for splitters and resolvers

* Make 'redirects' and failovers look/act consistently

* Fixup some unit tests
This commit is contained in:
John Cowen 2021-12-09 10:47:58 +00:00 committed by GitHub
parent 27c85bcea0
commit 4ddc2b4481
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 823 additions and 21 deletions

4
.changelog/11747.txt Normal file
View File

@ -0,0 +1,4 @@
```release-note:feature
ui: Add basic partition tooltips to failovers and redirects in the routing
visualization
```

View File

@ -38,9 +38,9 @@
{{#if child.Redirect}}
<dl class="redirect">
<dt
{{tooltip "Redirect"}}
{{tooltip (concat child.Redirect ' redirect')}}
>
Redirect
{{child.Redirect}} redirect
</dt>
<dd>
{{child.Name}}
@ -51,7 +51,7 @@
<dt
{{tooltip (concat child.Failover.Type ' failover')}}
>
{{concat child.Failover.Type ' failover'}}
{{child.Failover.Type}} failover
</dt>
<dd>
<ol>

View File

@ -43,6 +43,7 @@ export const getSplitters = function(nodes) {
const temp = item.Name.split('.');
temp.reverse();
temp.shift();
temp.shift();
temp.reverse();
return {
...item,
@ -75,18 +76,18 @@ export const getResolvers = function(
.forEach(function(item) {
const parts = item.Name.split('.');
let subset;
// this will leave behind the service.name.nspace.dc even if the service name contains a dot
// this will leave behind the service.name.nspace.partition.dc even if the service name contains a dot
if (parts.length > 4) {
subset = parts.shift();
}
parts.reverse();
// slice off from dc.nspace onwards leaving the potentially dot containing service name
// slice off from dc.partition.nspace onwards leaving the potentially dot containing service name
// const nodeDc =
parts.shift();
// const nodeNspace =
parts.shift();
// const nodePartition =
parts.shift();
// const nodeNspace =
parts.shift();
// if it does contain a dot put it back to the correct order
parts.reverse();
const service = parts.join('.');
@ -124,7 +125,7 @@ export const getResolvers = function(
const resolver = findResolver(resolvers, target.Service, nspace, partition, dc);
// and add the redirect as a child, redirects are always children
const child = {
Redirect: true,
Redirect: alternate.Type,
ID: target.ID,
Name: target[alternate.Type],
};

View File

@ -1 +1,153 @@
{"Chain":{"ServiceName":"virtual-admin-1","Namespace":"default","Datacenter":"dc-gcp","Protocol":"http","StartNode":"router:virtual-admin-1","Nodes":{"resolver:virtual-admin-1.default.dc-gcp":{"Type":"resolver","Name":"virtual-admin-1.default.dc-gcp","Resolver":{"ConnectTimeout":"5s","Default":true,"Target":"virtual-admin-1.default.dc-gcp"}},"resolver:web.default.dc-aws":{"Type":"resolver","Name":"web.default.dc-aws","Resolver":{"ConnectTimeout":"15s","Target":"web.default.dc-aws","Failover":{"Targets":["web.default.dc-gcp"]}}},"resolver:web.default.dc-gcp":{"Type":"resolver","Name":"web.default.dc-gcp","Resolver":{"ConnectTimeout":"15s","Target":"web.default.dc-gcp","Failover":{"Targets":["web.default.dc-aws"]}}},"router:virtual-admin-1":{"Type":"router","Name":"virtual-admin-1","Routes":[{"Definition":{"Match":{"HTTP":{"PathPrefix":"/login"}},"Destination":{"Service":"login","PrefixRewrite":"/"}},"NextNode":"splitter:login.default"},{"Definition":{"Destination":{"Service":"global-admin"}},"NextNode":"splitter:global-admin.default"},{"Definition":{"Match":{"HTTP":{"PathPrefix":"/"}},"Destination":{"Service":"virtual-admin-1"}},"NextNode":"resolver:virtual-admin-1.default.dc-gcp"}]},"splitter:global-admin.default":{"Type":"splitter","Name":"global-admin.default","Splits":[{"Weight":50,"NextNode":"resolver:web.default.dc-aws"},{"Weight":50,"NextNode":"resolver:web.default.dc-gcp"}]},"splitter:login.default":{"Type":"splitter","Name":"login.default","Splits":[{"Weight":50,"NextNode":"resolver:web.default.dc-gcp"},{"Weight":50,"NextNode":"resolver:web.default.dc-aws"}]}},"Targets":{"virtual-admin-1.default.dc-gcp":{"ID":"virtual-admin-1.default.dc-gcp","Service":"virtual-admin-1","Namespace":"default","Datacenter":"dc-gcp","MeshGateway":{},"Subset":{},"SNI":"virtual-admin-1.default.dc-gcp.internal.ede9daf4-b641-3954-5a52-15f4fd666f6e.consul","Name":"virtual-admin-1.default.dc-gcp.internal.ede9daf4-b641-3954-5a52-15f4fd666f6e.consul"},"web.default.dc-aws":{"ID":"web.default.dc-aws","Service":"web","Namespace":"default","Datacenter":"dc-aws","MeshGateway":{"Mode":"local"},"Subset":{},"SNI":"web.default.dc-aws.internal.ede9daf4-b641-3954-5a52-15f4fd666f6e.consul","Name":"web.default.dc-aws.internal.ede9daf4-b641-3954-5a52-15f4fd666f6e.consul"},"web.default.dc-gcp":{"ID":"web.default.dc-gcp","Service":"web","Namespace":"default","Datacenter":"dc-gcp","MeshGateway":{},"Subset":{},"SNI":"web.default.dc-gcp.internal.ede9daf4-b641-3954-5a52-15f4fd666f6e.consul","Name":"web.default.dc-gcp.internal.ede9daf4-b641-3954-5a52-15f4fd666f6e.consul"}}}}
{
"Chain": {
"ServiceName": "virtual-admin-1",
"Partition": "default",
"Namespace": "default",
"Datacenter": "dc-gcp",
"Protocol": "http",
"StartNode": "router:virtual-admin-1",
"Nodes": {
"resolver:virtual-admin-1.default.default.dc-gcp": {
"Type": "resolver",
"Name": "virtual-admin-1.default.default.dc-gcp",
"Resolver": {
"ConnectTimeout": "5s",
"Default": true,
"Target": "virtual-admin-1.default.default.dc-gcp"
}
},
"resolver:web.default.default.dc-aws": {
"Type": "resolver",
"Name": "web.default.default.dc-aws",
"Resolver": {
"ConnectTimeout": "15s",
"Target": "web.default.default.dc-aws",
"Failover": {
"Targets": [
"web.default.default.dc-gcp"
]
}
}
},
"resolver:web.default.default.dc-gcp": {
"Type": "resolver",
"Name": "web.default.default.dc-gcp",
"Resolver": {
"ConnectTimeout": "15s",
"Target": "web.default.default.dc-gcp",
"Failover": {
"Targets": [
"web.default.default.dc-aws"
]
}
}
},
"router:virtual-admin-1": {
"Type": "router",
"Name": "virtual-admin-1",
"Routes": [
{
"Definition": {
"Match": {
"HTTP": {
"PathPrefix": "/login"
}
},
"Destination": {
"Service": "login",
"PrefixRewrite": "/"
}
},
"NextNode": "splitter:login.default.default"
},
{
"Definition": {
"Destination": {
"Service": "global-admin"
}
},
"NextNode": "splitter:global-admin.default.default"
},
{
"Definition": {
"Match": {
"HTTP": {
"PathPrefix": "/"
}
},
"Destination": {
"Service": "virtual-admin-1"
}
},
"NextNode": "resolver:virtual-admin-1.default.default.dc-gcp"
}
]
},
"splitter:global-admin.default.default": {
"Type": "splitter",
"Name": "global-admin.default.default",
"Splits": [
{
"Weight": 50,
"NextNode": "resolver:web.default.default.dc-aws"
},
{
"Weight": 50,
"NextNode": "resolver:web.default.default.dc-gcp"
}
]
},
"splitter:login.default.default": {
"Type": "splitter",
"Name": "login.default.default",
"Splits": [
{
"Weight": 50,
"NextNode": "resolver:web.default.default.dc-gcp"
},
{
"Weight": 50,
"NextNode": "resolver:web.default.default.dc-aws"
}
]
}
},
"Targets": {
"virtual-admin-1.default.default.dc-gcp": {
"ID": "virtual-admin-1.default.default.dc-gcp",
"Service": "virtual-admin-1",
"Partition": "default",
"Namespace": "default",
"Datacenter": "dc-gcp",
"MeshGateway": {},
"Subset": {},
"SNI": "virtual-admin-1.default.default.dc-gcp.internal.ede9daf4-b641-3954-5a52-15f4fd666f6e.consul",
"Name": "virtual-admin-1.default.default.dc-gcp.internal.ede9daf4-b641-3954-5a52-15f4fd666f6e.consul"
},
"web.default.default.dc-aws": {
"ID": "web.default.default.dc-aws",
"Service": "web",
"Partition": "default",
"Namespace": "default",
"Datacenter": "dc-aws",
"MeshGateway": {
"Mode": "local"
},
"Subset": {},
"SNI": "web.default.default.dc-aws.internal.ede9daf4-b641-3954-5a52-15f4fd666f6e.consul",
"Name": "web.default.default.dc-aws.internal.ede9daf4-b641-3954-5a52-15f4fd666f6e.consul"
},
"web.default.default.dc-gcp": {
"ID": "web.default.default.dc-gcp",
"Service": "web",
"Partition": "default",
"Namespace": "default",
"Datacenter": "dc-gcp",
"MeshGateway": {},
"Subset": {},
"SNI": "web.default.default.dc-gcp.internal.ede9daf4-b641-3954-5a52-15f4fd666f6e.consul",
"Name": "web.default.default.dc-gcp.internal.ede9daf4-b641-3954-5a52-15f4fd666f6e.consul"
}
}
}
}

View File

@ -1 +1,78 @@
{"Chain":{"ServiceName":"virtual-admin-2","Namespace":"default","Datacenter":"dc-gcp","Protocol":"http","StartNode":"splitter:virtual-admin-2.default","Nodes":{"resolver:web.default.dc-aws":{"Type":"resolver","Name":"web.default.dc-aws","Resolver":{"ConnectTimeout":"15s","Target":"web.default.dc-aws","Failover":{"Targets":["web.default.dc-gcp"]}}},"resolver:web.default.dc-gcp":{"Type":"resolver","Name":"web.default.dc-gcp","Resolver":{"ConnectTimeout":"15s","Target":"web.default.dc-gcp","Failover":{"Targets":["web.default.dc-aws"]}}},"splitter:virtual-admin-2.default":{"Type":"splitter","Name":"virtual-admin-2.default","Splits":[{"Weight":50,"NextNode":"resolver:web.default.dc-gcp"},{"Weight":50,"NextNode":"resolver:web.default.dc-aws"}]}},"Targets":{"web.default.dc-aws":{"ID":"web.default.dc-aws","Service":"web","Namespace":"default","Datacenter":"dc-aws","MeshGateway":{"Mode":"local"},"Subset":{},"SNI":"web.default.dc-aws.internal.ede9daf4-b641-3954-5a52-15f4fd666f6e.consul","Name":"web.default.dc-aws.internal.ede9daf4-b641-3954-5a52-15f4fd666f6e.consul"},"web.default.dc-gcp":{"ID":"web.default.dc-gcp","Service":"web","Namespace":"default","Datacenter":"dc-gcp","MeshGateway":{},"Subset":{},"SNI":"web.default.dc-gcp.internal.ede9daf4-b641-3954-5a52-15f4fd666f6e.consul","Name":"web.default.dc-gcp.internal.ede9daf4-b641-3954-5a52-15f4fd666f6e.consul"}}}}
{
"Chain": {
"ServiceName": "virtual-admin-2",
"Partition": "default",
"Namespace": "default",
"Datacenter": "dc-gcp",
"Protocol": "http",
"StartNode": "splitter:virtual-admin-2.default.default",
"Nodes": {
"resolver:web.default.default.dc-aws": {
"Type": "resolver",
"Name": "web.default.default.dc-aws",
"Resolver": {
"ConnectTimeout": "15s",
"Target": "web.default.default.dc-aws",
"Failover": {
"Targets": [
"web.default.default.dc-gcp"
]
}
}
},
"resolver:web.default.default.dc-gcp": {
"Type": "resolver",
"Name": "web.default.default.dc-gcp",
"Resolver": {
"ConnectTimeout": "15s",
"Target": "web.default.default.dc-gcp",
"Failover": {
"Targets": [
"web.default.default.dc-aws"
]
}
}
},
"splitter:virtual-admin-2.default.default": {
"Type": "splitter",
"Name": "virtual-admin-2.default.default",
"Splits": [
{
"Weight": 50,
"NextNode": "resolver:web.default.default.dc-gcp"
},
{
"Weight": 50,
"NextNode": "resolver:web.default.default.dc-aws"
}
]
}
},
"Targets": {
"web.default.default.dc-aws": {
"ID": "web.default.default.dc-aws",
"Service": "web",
"Partition": "default",
"Namespace": "default",
"Datacenter": "dc-aws",
"MeshGateway": {
"Mode": "local"
},
"Subset": {},
"SNI": "web.default.default.dc-aws.internal.ede9daf4-b641-3954-5a52-15f4fd666f6e.consul",
"Name": "web.default.default.dc-aws.internal.ede9daf4-b641-3954-5a52-15f4fd666f6e.consul"
},
"web.default.default.dc-gcp": {
"ID": "web.default.default.dc-gcp",
"Service": "web",
"Partition": "default",
"Namespace": "default",
"Datacenter": "dc-gcp",
"MeshGateway": {},
"Subset": {},
"SNI": "web.default.default.dc-gcp.internal.ede9daf4-b641-3954-5a52-15f4fd666f6e.consul",
"Name": "web.default.default.dc-gcp.internal.ede9daf4-b641-3954-5a52-15f4fd666f6e.consul"
}
}
}
}

View File

@ -1 +1,68 @@
{"Chain":{"ServiceName":"virtual-admin-3","Namespace":"default","Datacenter":"dc-gcp","Protocol":"http","StartNode":"splitter:virtual-admin-3.default","Nodes":{"resolver:web.default.dc-aws":{"Type":"resolver","Name":"web.default.dc-aws","Resolver":{"ConnectTimeout":"15s","Target":"web.default.dc-aws"}},"resolver:web.default.dc-gcp":{"Type":"resolver","Name":"web.default.dc-gcp","Resolver":{"ConnectTimeout":"15s","Target":"web.default.dc-gcp"}},"splitter:virtual-admin-3.default":{"Type":"splitter","Name":"virtual-admin-3.default","Splits":[{"Weight":50,"NextNode":"resolver:web.default.dc-gcp"},{"Weight":50,"NextNode":"resolver:web.default.dc-aws"}]}},"Targets":{"web.default.dc-aws":{"ID":"web.default.dc-aws","Service":"web","Namespace":"default","Datacenter":"dc-aws","MeshGateway":{"Mode":"local"},"Subset":{},"SNI":"web.default.dc-aws.internal.ede9daf4-b641-3954-5a52-15f4fd666f6e.consul","Name":"web.default.dc-aws.internal.ede9daf4-b641-3954-5a52-15f4fd666f6e.consul"},"web.default.dc-gcp":{"ID":"web.default.dc-gcp","Service":"web","Namespace":"default","Datacenter":"dc-gcp","MeshGateway":{},"Subset":{},"SNI":"web.default.dc-gcp.internal.ede9daf4-b641-3954-5a52-15f4fd666f6e.consul","Name":"web.default.dc-gcp.internal.ede9daf4-b641-3954-5a52-15f4fd666f6e.consul"}}}}
{
"Chain": {
"ServiceName": "virtual-admin-3",
"Partition": "default",
"Namespace": "default",
"Datacenter": "dc-gcp",
"Protocol": "http",
"StartNode": "splitter:virtual-admin-3.default.default",
"Nodes": {
"resolver:web.default.default.dc-aws": {
"Type": "resolver",
"Name": "web.default.default.dc-aws",
"Resolver": {
"ConnectTimeout": "15s",
"Target": "web.default.default.dc-aws"
}
},
"resolver:web.default.default.dc-gcp": {
"Type": "resolver",
"Name": "web.default.default.dc-gcp",
"Resolver": {
"ConnectTimeout": "15s",
"Target": "web.default.default.dc-gcp"
}
},
"splitter:virtual-admin-3.default.default": {
"Type": "splitter",
"Name": "virtual-admin-3.default.default",
"Splits": [
{
"Weight": 50,
"NextNode": "resolver:web.default.default.dc-gcp"
},
{
"Weight": 50,
"NextNode": "resolver:web.default.default.dc-aws"
}
]
}
},
"Targets": {
"web.default.default.dc-aws": {
"ID": "web.default.default.dc-aws",
"Service": "web",
"Partition": "default",
"Namespace": "default",
"Datacenter": "dc-aws",
"MeshGateway": {
"Mode": "local"
},
"Subset": {},
"SNI": "web.default.default.dc-aws.internal.ede9daf4-b641-3954-5a52-15f4fd666f6e.consul",
"Name": "web.default.default.dc-aws.internal.ede9daf4-b641-3954-5a52-15f4fd666f6e.consul"
},
"web.default.default.dc-gcp": {
"ID": "web.default.default.dc-gcp",
"Service": "web",
"Partition": "default",
"Namespace": "default",
"Datacenter": "dc-gcp",
"MeshGateway": {},
"Subset": {},
"SNI": "web.default.default.dc-gcp.internal.ede9daf4-b641-3954-5a52-15f4fd666f6e.consul",
"Name": "web.default.default.dc-gcp.internal.ede9daf4-b641-3954-5a52-15f4fd666f6e.consul"
}
}
}
}

View File

@ -1 +1,151 @@
{"Chain":{"ServiceName":"virtual-admin-4","Namespace":"default","Datacenter":"dc1","Protocol":"http","StartNode":"router:virtual-admin-4","Nodes":{"resolver:admin.default.dc1":{"Type":"resolver","Name":"admin.default.dc1","Resolver":{"ConnectTimeout":"5s","Default":true,"Target":"admin.default.dc1"}},"resolver:admin.default.dc2":{"Type":"resolver","Name":"admin.default.dc2","Resolver":{"ConnectTimeout":"5s","Default":true,"Target":"admin.default.dc2"}},"resolver:login.default.dc1":{"Type":"resolver","Name":"login.default.dc1","Resolver":{"ConnectTimeout":"5s","Default":true,"Target":"login.default.dc1"}},"resolver:virtual-admin-4.default.dc1":{"Type":"resolver","Name":"virtual-admin-4.default.dc1","Resolver":{"ConnectTimeout":"5s","Default":true,"Target":"virtual-admin-4.default.dc1"}},"router:virtual-admin-4":{"Type":"router","Name":"virtual-admin-4","Routes":[{"Definition":{"Match":{"HTTP":{"PathPrefix":"/login"}},"Destination":{"Service":"login","PrefixRewrite":"/"}},"NextNode":"resolver:login.default.dc1"},{"Definition":{"Destination":{"Service":"global-admin"}},"NextNode":"splitter:global-admin.default"},{"Definition":{"Match":{"HTTP":{"PathPrefix":"/"}},"Destination":{"Service":"virtual-admin-4"}},"NextNode":"resolver:virtual-admin-4.default.dc1"}]},"splitter:global-admin.default":{"Type":"splitter","Name":"global-admin.default","Splits":[{"Weight":50,"NextNode":"resolver:admin.default.dc1"},{"Weight":50,"NextNode":"resolver:admin.default.dc2"}]}},"Targets":{"admin.default.dc1":{"ID":"admin.default.dc1","Service":"admin","Namespace":"default","Datacenter":"dc1","MeshGateway":{},"Subset":{},"SNI":"admin.default.dc1.internal.6818c189-1048-8114-7d9f-ae248864b349.consul","Name":"admin.default.dc1.internal.6818c189-1048-8114-7d9f-ae248864b349.consul"},"admin.default.dc2":{"ID":"admin.default.dc2","Service":"admin","Namespace":"default","Datacenter":"dc2","MeshGateway":{"Mode":"local"},"Subset":{},"SNI":"admin.default.dc2.internal.6818c189-1048-8114-7d9f-ae248864b349.consul","Name":"admin.default.dc2.internal.6818c189-1048-8114-7d9f-ae248864b349.consul"},"login.default.dc1":{"ID":"login.default.dc1","Service":"login","Namespace":"default","Datacenter":"dc1","MeshGateway":{},"Subset":{},"SNI":"login.default.dc1.internal.6818c189-1048-8114-7d9f-ae248864b349.consul","Name":"login.default.dc1.internal.6818c189-1048-8114-7d9f-ae248864b349.consul"},"virtual-admin-4.default.dc1":{"ID":"virtual-admin-4.default.dc1","Service":"virtual-admin-4","Namespace":"default","Datacenter":"dc1","MeshGateway":{},"Subset":{},"SNI":"virtual-admin-4.default.dc1.internal.6818c189-1048-8114-7d9f-ae248864b349.consul","Name":"virtual-admin-4.default.dc1.internal.6818c189-1048-8114-7d9f-ae248864b349.consul"}}}}
{
"Chain": {
"ServiceName": "virtual-admin-4",
"Partition": "default",
"Namespace": "default",
"Datacenter": "dc1",
"Protocol": "http",
"StartNode": "router:virtual-admin-4",
"Nodes": {
"resolver:admin.default.default.dc1": {
"Type": "resolver",
"Name": "admin.default.default.dc1",
"Resolver": {
"ConnectTimeout": "5s",
"Default": true,
"Target": "admin.default.default.dc1"
}
},
"resolver:admin.default.default.dc2": {
"Type": "resolver",
"Name": "admin.default.default.dc2",
"Resolver": {
"ConnectTimeout": "5s",
"Default": true,
"Target": "admin.default.default.dc2"
}
},
"resolver:login.default.default.dc1": {
"Type": "resolver",
"Name": "login.default.default.dc1",
"Resolver": {
"ConnectTimeout": "5s",
"Default": true,
"Target": "login.default.default.dc1"
}
},
"resolver:virtual-admin-4.default.default.dc1": {
"Type": "resolver",
"Name": "virtual-admin-4.default.default.dc1",
"Resolver": {
"ConnectTimeout": "5s",
"Default": true,
"Target": "virtual-admin-4.default.default.dc1"
}
},
"router:virtual-admin-4": {
"Type": "router",
"Name": "virtual-admin-4",
"Routes": [
{
"Definition": {
"Match": {
"HTTP": {
"PathPrefix": "/login"
}
},
"Destination": {
"Service": "login",
"PrefixRewrite": "/"
}
},
"NextNode": "resolver:login.default.default.dc1"
},
{
"Definition": {
"Destination": {
"Service": "global-admin"
}
},
"NextNode": "splitter:global-admin.default.default"
},
{
"Definition": {
"Match": {
"HTTP": {
"PathPrefix": "/"
}
},
"Destination": {
"Service": "virtual-admin-4"
}
},
"NextNode": "resolver:virtual-admin-4.default.default.dc1"
}
]
},
"splitter:global-admin.default.default": {
"Type": "splitter",
"Name": "global-admin.default.default",
"Splits": [
{
"Weight": 50,
"NextNode": "resolver:admin.default.default.dc1"
},
{
"Weight": 50,
"NextNode": "resolver:admin.default.default.dc2"
}
]
}
},
"Targets": {
"admin.default.default.dc1": {
"ID": "admin.default.default.dc1",
"Service": "admin",
"Partition": "default",
"Namespace": "default",
"Datacenter": "dc1",
"MeshGateway": {},
"Subset": {},
"SNI": "admin.default.default.dc1.internal.6818c189-1048-8114-7d9f-ae248864b349.consul",
"Name": "admin.default.default.dc1.internal.6818c189-1048-8114-7d9f-ae248864b349.consul"
},
"admin.default.default.dc2": {
"ID": "admin.default.default.dc2",
"Service": "admin",
"Partition": "default",
"Namespace": "default",
"Datacenter": "dc2",
"MeshGateway": {
"Mode": "local"
},
"Subset": {},
"SNI": "admin.default.default.dc2.internal.6818c189-1048-8114-7d9f-ae248864b349.consul",
"Name": "admin.default.default.dc2.internal.6818c189-1048-8114-7d9f-ae248864b349.consul"
},
"login.default.default.dc1": {
"ID": "login.default.default.dc1",
"Service": "login",
"Partition": "default",
"Namespace": "default",
"Datacenter": "dc1",
"MeshGateway": {},
"Subset": {},
"SNI": "login.default.default.dc1.internal.6818c189-1048-8114-7d9f-ae248864b349.consul",
"Name": "login.default.default.dc1.internal.6818c189-1048-8114-7d9f-ae248864b349.consul"
},
"virtual-admin-4.default.default.dc1": {
"ID": "virtual-admin-4.default.default.dc1",
"Service": "virtual-admin-4",
"Partition": "default",
"Namespace": "default",
"Datacenter": "dc1",
"MeshGateway": {},
"Subset": {},
"SNI": "virtual-admin-4.default.default.dc1.internal.6818c189-1048-8114-7d9f-ae248864b349.consul",
"Name": "virtual-admin-4.default.default.dc1.internal.6818c189-1048-8114-7d9f-ae248864b349.consul"
}
}
}
}

View File

@ -1 +1,156 @@
{"Chain":{"ServiceName":"virtual-admin-5","Namespace":"default","Datacenter":"dc2","Protocol":"http","StartNode":"router:virtual-admin-5","Nodes":{"resolver:admin.default.dc1":{"Type":"resolver","Name":"admin.default.dc1","Resolver":{"ConnectTimeout":"5s","Default":true,"Target":"admin.default.dc1"}},"resolver:admin.default.dc2":{"Type":"resolver","Name":"admin.default.dc2","Resolver":{"ConnectTimeout":"5s","Default":true,"Target":"admin.default.dc2"}},"resolver:login.default.dc2":{"Type":"resolver","Name":"login.default.dc2","Resolver":{"ConnectTimeout":"5s","Default":true,"Target":"login.default.dc2"}},"resolver:virtual-admin-5.default.dc2":{"Type":"resolver","Name":"virtual-admin-5.default.dc2","Resolver":{"ConnectTimeout":"5s","Default":true,"Target":"virtual-admin-5.default.dc2"}},"router:virtual-admin-5":{"Type":"router","Name":"virtual-admin-5","Routes":[{"Definition":{"Match":{"HTTP":{"PathPrefix":"/login"}},"Destination":{"Service":"login","PrefixRewrite":"/"}},"NextNode":"resolver:login.default.dc2"},{"Definition":{"Match":{"HTTP":{"PathPrefix":"/"}},"Destination":{"Service":"global-admin"}},"NextNode":"splitter:global-admin.default"},{"Definition":{"Match":{"HTTP":{"PathPrefix":"/"}},"Destination":{"Service":"virtual-admin-5"}},"NextNode":"resolver:virtual-admin-5.default.dc2"}]},"splitter:global-admin.default":{"Type":"splitter","Name":"global-admin.default","Splits":[{"Weight":50,"NextNode":"resolver:admin.default.dc1"},{"Weight":50,"NextNode":"resolver:admin.default.dc2"}]}},"Targets":{"admin.default.dc1":{"ID":"admin.default.dc1","Service":"admin","Namespace":"default","Datacenter":"dc1","MeshGateway":{"Mode":"local"},"Subset":{},"SNI":"admin.default.dc1.internal.6818c189-1048-8114-7d9f-ae248864b349.consul","Name":"admin.default.dc1.internal.6818c189-1048-8114-7d9f-ae248864b349.consul"},"admin.default.dc2":{"ID":"admin.default.dc2","Service":"admin","Namespace":"default","Datacenter":"dc2","MeshGateway":{},"Subset":{},"SNI":"admin.default.dc2.internal.6818c189-1048-8114-7d9f-ae248864b349.consul","Name":"admin.default.dc2.internal.6818c189-1048-8114-7d9f-ae248864b349.consul"},"login.default.dc2":{"ID":"login.default.dc2","Service":"login","Namespace":"default","Datacenter":"dc2","MeshGateway":{},"Subset":{},"SNI":"login.default.dc2.internal.6818c189-1048-8114-7d9f-ae248864b349.consul","Name":"login.default.dc2.internal.6818c189-1048-8114-7d9f-ae248864b349.consul"},"virtual-admin-5.default.dc2":{"ID":"virtual-admin-5.default.dc2","Service":"virtual-admin-5","Namespace":"default","Datacenter":"dc2","MeshGateway":{},"Subset":{},"SNI":"virtual-admin-5.default.dc2.internal.6818c189-1048-8114-7d9f-ae248864b349.consul","Name":"virtual-admin-5.default.dc2.internal.6818c189-1048-8114-7d9f-ae248864b349.consul"}}}}
{
"Chain": {
"ServiceName": "virtual-admin-5",
"Partition": "default",
"Namespace": "default",
"Datacenter": "dc2",
"Protocol": "http",
"StartNode": "router:virtual-admin-5",
"Nodes": {
"resolver:admin.default.default.dc1": {
"Type": "resolver",
"Name": "admin.default.default.dc1",
"Resolver": {
"ConnectTimeout": "5s",
"Default": true,
"Target": "admin.default.default.dc1"
}
},
"resolver:admin.default.default.dc2": {
"Type": "resolver",
"Name": "admin.default.default.dc2",
"Resolver": {
"ConnectTimeout": "5s",
"Default": true,
"Target": "admin.default.default.dc2"
}
},
"resolver:login.default.default.dc2": {
"Type": "resolver",
"Name": "login.default.default.dc2",
"Resolver": {
"ConnectTimeout": "5s",
"Default": true,
"Target": "login.default.default.dc2"
}
},
"resolver:virtual-admin-5.default.default.dc2": {
"Type": "resolver",
"Name": "virtual-admin-5.default.default.dc2",
"Resolver": {
"ConnectTimeout": "5s",
"Default": true,
"Target": "virtual-admin-5.default.default.dc2"
}
},
"router:virtual-admin-5": {
"Type": "router",
"Name": "virtual-admin-5",
"Routes": [
{
"Definition": {
"Match": {
"HTTP": {
"PathPrefix": "/login"
}
},
"Destination": {
"Service": "login",
"PrefixRewrite": "/"
}
},
"NextNode": "resolver:login.default.default.dc2"
},
{
"Definition": {
"Match": {
"HTTP": {
"PathPrefix": "/"
}
},
"Destination": {
"Service": "global-admin"
}
},
"NextNode": "splitter:global-admin.default.default"
},
{
"Definition": {
"Match": {
"HTTP": {
"PathPrefix": "/"
}
},
"Destination": {
"Service": "virtual-admin-5"
}
},
"NextNode": "resolver:virtual-admin-5.default.default.dc2"
}
]
},
"splitter:global-admin.default.default": {
"Type": "splitter",
"Name": "global-admin.default.default",
"Splits": [
{
"Weight": 50,
"NextNode": "resolver:admin.default.default.dc1"
},
{
"Weight": 50,
"NextNode": "resolver:admin.default.default.dc2"
}
]
}
},
"Targets": {
"admin.default.default.dc1": {
"ID": "admin.default.default.dc1",
"Service": "admin",
"Partition": "default",
"Namespace": "default",
"Datacenter": "dc1",
"MeshGateway": {
"Mode": "local"
},
"Subset": {},
"SNI": "admin.default.default.dc1.internal.6818c189-1048-8114-7d9f-ae248864b349.consul",
"Name": "admin.default.default.dc1.internal.6818c189-1048-8114-7d9f-ae248864b349.consul"
},
"admin.default.default.dc2": {
"ID": "admin.default.default.dc2",
"Service": "admin",
"Partition": "default",
"Namespace": "default",
"Datacenter": "dc2",
"MeshGateway": {},
"Subset": {},
"SNI": "admin.default.default.dc2.internal.6818c189-1048-8114-7d9f-ae248864b349.consul",
"Name": "admin.default.default.dc2.internal.6818c189-1048-8114-7d9f-ae248864b349.consul"
},
"login.default.default.dc2": {
"ID": "login.default.default.dc2",
"Service": "login",
"Partition": "default",
"Namespace": "default",
"Datacenter": "dc2",
"MeshGateway": {},
"Subset": {},
"SNI": "login.default.default.dc2.internal.6818c189-1048-8114-7d9f-ae248864b349.consul",
"Name": "login.default.default.dc2.internal.6818c189-1048-8114-7d9f-ae248864b349.consul"
},
"virtual-admin-5.default.default.dc2": {
"ID": "virtual-admin-5.default.default.dc2",
"Service": "virtual-admin-5",
"Partition": "default",
"Namespace": "default",
"Datacenter": "dc2",
"MeshGateway": {},
"Subset": {},
"SNI": "virtual-admin-5.default.default.dc2.internal.6818c189-1048-8114-7d9f-ae248864b349.consul",
"Name": "virtual-admin-5.default.default.dc2.internal.6818c189-1048-8114-7d9f-ae248864b349.consul"
}
}
}
}

View File

@ -0,0 +1,196 @@
{
"Chain": {
"ServiceName": "virtual-admin-6",
"Partition": "default",
"Namespace": "default",
"Datacenter": "dc-gcp",
"Protocol": "http",
"StartNode": "router:virtual-admin-6",
"Nodes": {
"resolver:virtual-admin-6.default.default.dc-gcp": {
"Type": "resolver",
"Name": "virtual-admin-6.default.default.dc-gcp",
"Resolver": {
"ConnectTimeout": "5s",
"Default": true,
"Target": "virtual-admin-6.default.default.dc-gcp"
}
},
"resolver:web.default.default.dc-aws": {
"Type": "resolver",
"Name": "web.default.default.dc-aws",
"Resolver": {
"ConnectTimeout": "15s",
"Target": "web.default.default.dc-aws",
"Failover": {
"Targets": [
"web.default.default.dc-gcp"
]
}
}
},
"resolver:db.default.partition.dc-gcp": {
"Type": "resolver",
"Name": "db.default.partition.dc-gcp",
"Resolver": {
"ConnectTimeout": "15s",
"Target": "db.default.partition.dc-gcp",
"Failover": {
"Targets": [
"db.default.default.dc-gcp"
]
}
}
},
"resolver:web.default.default.dc-gcp": {
"Type": "resolver",
"Name": "web.default.default.dc-gcp",
"Resolver": {
"ConnectTimeout": "15s",
"Target": "web.default.default.dc-gcp",
"Failover": {
"Targets": [
"web.default.default.dc-aws"
]
}
}
},
"router:virtual-admin-6": {
"Type": "router",
"Name": "virtual-admin-6",
"Routes": [
{
"Definition": {
"Match": {
"HTTP": {
"PathPrefix": "/login"
}
},
"Destination": {
"Service": "login",
"PrefixRewrite": "/"
}
},
"NextNode": "splitter:login.default.default"
},
{
"Definition": {
"Destination": {
"Service": "global-admin"
}
},
"NextNode": "splitter:global-admin.default.default"
},
{
"Definition": {
"Match": {
"HTTP": {
"PathPrefix": "/"
}
},
"Destination": {
"Service": "virtual-admin-6"
}
},
"NextNode": "resolver:virtual-admin-6.default.default.dc-gcp"
}
]
},
"splitter:global-admin.default.default": {
"Type": "splitter",
"Name": "global-admin.default.default",
"Splits": [
{
"Weight": 50,
"NextNode": "resolver:web.default.default.dc-aws"
},
{
"Weight": 25,
"NextNode": "resolver:web.default.default.dc-gcp"
},
{
"Weight": 25,
"NextNode": "resolver:db.default.default.dc-gcp"
}
]
},
"splitter:login.default.default": {
"Type": "splitter",
"Name": "login.default.default",
"Splits": [
{
"Weight": 50,
"NextNode": "resolver:web.default.default.dc-gcp"
},
{
"Weight": 25,
"NextNode": "resolver:web.default.default.dc-aws"
},
{
"Weight": 25,
"NextNode": "resolver:db.default.partition.dc-gcp"
}
]
}
},
"Targets": {
"virtual-admin-6.default.default.dc-gcp": {
"ID": "virtual-admin-6.default.default.dc-gcp",
"Service": "virtual-admin-6",
"Partition": "default",
"Namespace": "default",
"Datacenter": "dc-gcp",
"MeshGateway": {},
"Subset": {},
"SNI": "virtual-admin-6.default.default.dc-gcp.internal.ede9daf4-b641-3954-5a52-15f4fd666f6e.consul",
"Name": "virtual-admin-6.default.default.dc-gcp.internal.ede9daf4-b641-3954-5a52-15f4fd666f6e.consul"
},
"web.default.default.dc-aws": {
"ID": "web.default.default.dc-aws",
"Service": "web",
"Partition": "default",
"Namespace": "default",
"Datacenter": "dc-aws",
"MeshGateway": {
"Mode": "local"
},
"Subset": {},
"SNI": "web.default.default.dc-aws.internal.ede9daf4-b641-3954-5a52-15f4fd666f6e.consul",
"Name": "web.default.default.dc-aws.internal.ede9daf4-b641-3954-5a52-15f4fd666f6e.consul"
},
"web.default.default.dc-gcp": {
"ID": "web.default.default.dc-gcp",
"Service": "web",
"Partition": "default",
"Namespace": "default",
"Datacenter": "dc-gcp",
"MeshGateway": {},
"Subset": {},
"SNI": "web.default.default.dc-gcp.internal.ede9daf4-b641-3954-5a52-15f4fd666f6e.consul",
"Name": "web.default.default.dc-gcp.internal.ede9daf4-b641-3954-5a52-15f4fd666f6e.consul"
},
"db.default.partition.dc-gcp": {
"ID": "db.default.partition.dc-gcp",
"Service": "db",
"Partition": "partition",
"Namespace": "default",
"Datacenter": "dc-gcp",
"MeshGateway": {},
"Subset": {},
"SNI": "db.default.partition.dc-gcp.internal.ede9daf4-b641-3954-5a52-15f4fd666f6e.consul",
"Name": "db.default.partition.dc-gcp.internal.ede9daf4-b641-3954-5a52-15f4fd666f6e.consul"
},
"db.default.default.dc-gcp": {
"ID": "db.default.default.dc-gcp",
"Service": "db",
"Partition": "default",
"Namespace": "default",
"Datacenter": "dc-gcp",
"MeshGateway": {},
"Subset": {},
"SNI": "db.default.default.dc-gcp.internal.ede9daf4-b641-3954-5a52-15f4fd666f6e.consul",
"Name": "db.default.default.dc-gcp.internal.ede9daf4-b641-3954-5a52-15f4fd666f6e.consul"
}
}
}
}

View File

@ -44,7 +44,7 @@ module('Unit | Component | consul/discovery-chain/get-resolvers', function() {
const childId = Object.keys(Chain.Targets)[1];
const target = Chain.Targets[`${childId}`];
const firstChild = actual[0].Children[0];
assert.equal(firstChild.Redirect, true);
assert.equal(firstChild.Redirect, 'Datacenter');
assert.equal(firstChild.ID, target.ID);
});
});
@ -228,7 +228,7 @@ module('Unit | Component | consul/discovery-chain/get-resolvers', function() {
},
},
Targets: {
'dc-failover.default.redirect-dc-1': {
'dc-failover.default.default.redirect-dc-1': {
ID: 'dc-failover.default.default.redirect-dc-1',
Service: 'dc-failover',
Namespace: 'default',
@ -257,7 +257,7 @@ module('Unit | Component | consul/discovery-chain/get-resolvers', function() {
},
ID: 'dc-failover.default.default.redirect-dc-1',
Name: 'redirect-dc-1',
Redirect: true,
Redirect: 'Datacenter',
},
],
};

View File

@ -4,9 +4,9 @@ import { module, test } from 'qunit';
module('Unit | Component | consul/discovery-chain/get-splitters', function() {
test('it collects and correctly parses splitter Names', function(assert) {
const actual = getSplitters({
'splitter:splitter-name.default': {
'splitter:splitter-name.default.default': {
Type: 'splitter',
Name: 'splitter-name.default',
Name: 'splitter-name.default.default',
Splits: [
{
Weight: 50,
@ -18,9 +18,9 @@ module('Unit | Component | consul/discovery-chain/get-splitters', function() {
},
],
},
'splitter:not-splitter-name.default': {
'splitter:not-splitter-name.default.default': {
Type: 'not-splitter',
Name: 'splitter-name.default',
Name: 'splitter-name.default.default',
Splits: [
{
Weight: 50,
@ -36,7 +36,7 @@ module('Unit | Component | consul/discovery-chain/get-splitters', function() {
const expected = {
Type: 'splitter',
Name: 'splitter-name',
ID: 'splitter:splitter-name.default',
ID: 'splitter:splitter-name.default.default',
Splits: [
{
Weight: 50,