diff --git a/.changelog/11747.txt b/.changelog/11747.txt new file mode 100644 index 0000000000..010eac4605 --- /dev/null +++ b/.changelog/11747.txt @@ -0,0 +1,4 @@ +```release-note:feature +ui: Add basic partition tooltips to failovers and redirects in the routing +visualization +``` diff --git a/ui/packages/consul-ui/app/components/consul/discovery-chain/resolver-card/index.hbs b/ui/packages/consul-ui/app/components/consul/discovery-chain/resolver-card/index.hbs index de17dc5cd7..8a52b533f7 100644 --- a/ui/packages/consul-ui/app/components/consul/discovery-chain/resolver-card/index.hbs +++ b/ui/packages/consul-ui/app/components/consul/discovery-chain/resolver-card/index.hbs @@ -38,9 +38,9 @@ {{#if child.Redirect}}
- Redirect + {{child.Redirect}} redirect
{{child.Name}} @@ -51,7 +51,7 @@
- {{concat child.Failover.Type ' failover'}} + {{child.Failover.Type}} failover
    diff --git a/ui/packages/consul-ui/app/components/consul/discovery-chain/utils.js b/ui/packages/consul-ui/app/components/consul/discovery-chain/utils.js index e7698caa9d..e9d8d7c4bd 100644 --- a/ui/packages/consul-ui/app/components/consul/discovery-chain/utils.js +++ b/ui/packages/consul-ui/app/components/consul/discovery-chain/utils.js @@ -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], }; diff --git a/ui/packages/consul-ui/mock-api/v1/discovery-chain/virtual-admin-1 b/ui/packages/consul-ui/mock-api/v1/discovery-chain/virtual-admin-1 index 13177cdd58..e8617411cf 100644 --- a/ui/packages/consul-ui/mock-api/v1/discovery-chain/virtual-admin-1 +++ b/ui/packages/consul-ui/mock-api/v1/discovery-chain/virtual-admin-1 @@ -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" + } + } + } +} diff --git a/ui/packages/consul-ui/mock-api/v1/discovery-chain/virtual-admin-2 b/ui/packages/consul-ui/mock-api/v1/discovery-chain/virtual-admin-2 index 221964e5c3..c0aabdf89a 100644 --- a/ui/packages/consul-ui/mock-api/v1/discovery-chain/virtual-admin-2 +++ b/ui/packages/consul-ui/mock-api/v1/discovery-chain/virtual-admin-2 @@ -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" + } + } + } +} diff --git a/ui/packages/consul-ui/mock-api/v1/discovery-chain/virtual-admin-3 b/ui/packages/consul-ui/mock-api/v1/discovery-chain/virtual-admin-3 index 9f7f32eba4..8906a35739 100644 --- a/ui/packages/consul-ui/mock-api/v1/discovery-chain/virtual-admin-3 +++ b/ui/packages/consul-ui/mock-api/v1/discovery-chain/virtual-admin-3 @@ -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" + } + } + } + } diff --git a/ui/packages/consul-ui/mock-api/v1/discovery-chain/virtual-admin-4 b/ui/packages/consul-ui/mock-api/v1/discovery-chain/virtual-admin-4 index f0bf99482e..03284be5e7 100644 --- a/ui/packages/consul-ui/mock-api/v1/discovery-chain/virtual-admin-4 +++ b/ui/packages/consul-ui/mock-api/v1/discovery-chain/virtual-admin-4 @@ -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" + } + } + } + } diff --git a/ui/packages/consul-ui/mock-api/v1/discovery-chain/virtual-admin-5 b/ui/packages/consul-ui/mock-api/v1/discovery-chain/virtual-admin-5 index 35a216eedd..e4d9cfc5fc 100644 --- a/ui/packages/consul-ui/mock-api/v1/discovery-chain/virtual-admin-5 +++ b/ui/packages/consul-ui/mock-api/v1/discovery-chain/virtual-admin-5 @@ -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" + } + } + } + } diff --git a/ui/packages/consul-ui/mock-api/v1/discovery-chain/virtual-admin-6 b/ui/packages/consul-ui/mock-api/v1/discovery-chain/virtual-admin-6 new file mode 100644 index 0000000000..638b2a9525 --- /dev/null +++ b/ui/packages/consul-ui/mock-api/v1/discovery-chain/virtual-admin-6 @@ -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" + } + } + } +} diff --git a/ui/packages/consul-ui/tests/unit/components/consul/discovery-chain/get-resolvers-test.js b/ui/packages/consul-ui/tests/unit/components/consul/discovery-chain/get-resolvers-test.js index e298984092..042909b703 100644 --- a/ui/packages/consul-ui/tests/unit/components/consul/discovery-chain/get-resolvers-test.js +++ b/ui/packages/consul-ui/tests/unit/components/consul/discovery-chain/get-resolvers-test.js @@ -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', }, ], }; diff --git a/ui/packages/consul-ui/tests/unit/components/consul/discovery-chain/get-splitters-test.js b/ui/packages/consul-ui/tests/unit/components/consul/discovery-chain/get-splitters-test.js index 317936b2e9..a119e8fc46 100644 --- a/ui/packages/consul-ui/tests/unit/components/consul/discovery-chain/get-splitters-test.js +++ b/ui/packages/consul-ui/tests/unit/components/consul/discovery-chain/get-splitters-test.js @@ -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,