From e992522c4cc618356b39feffe3d72df2452e1c3e Mon Sep 17 00:00:00 2001 From: Karl Cardenas Date: Mon, 10 Jan 2022 10:45:54 -0700 Subject: [PATCH 1/4] added another example for DC and namespace failover --- .../config-entries/service-resolver.mdx | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/website/content/docs/connect/config-entries/service-resolver.mdx b/website/content/docs/connect/config-entries/service-resolver.mdx index 6afe1265e6..5a060335fb 100644 --- a/website/content/docs/connect/config-entries/service-resolver.mdx +++ b/website/content/docs/connect/config-entries/service-resolver.mdx @@ -168,6 +168,57 @@ spec: + + {' '} + Failover to another datacenter and namespace + + + + +```hcl +Kind = "service-resolver" +Name = "product-api" +Namespace = "primary" +ConnectTimeout = "0s" +Failover = { + "*" = { + Datacenters = ["dc2"] + Namespace = "secodary" + } +} +``` + +```yaml +apiVersion: consul.hashicorp.com/v1alpha1 +kind: ServiceResolver +metadata: + name: product-api + namespace: primary +spec: + connectTimeout: 0 + failover: + namespace: 'secondary' + '*': + datacenters: ['dc2'] +``` + +```json +{ + "Kind": "service-resolver", + "Name": "product-api", + "Namespace": "primary" + "ConnectTimeout": "0s", + "Failover": { + "*": { + "Datacenters": ["dc2"] + "Namespace": "secondary" + } + } +} +``` + + + ### Consistent load balancing Apply consistent load balancing for requests based on `x-user-id` header: From 687f9340f75e9da379a4f5fe78e10244d6448420 Mon Sep 17 00:00:00 2001 From: Karl Cardenas Date: Mon, 10 Jan 2022 10:51:00 -0700 Subject: [PATCH 2/4] removed empty {} --- website/content/docs/connect/config-entries/service-resolver.mdx | 1 - 1 file changed, 1 deletion(-) diff --git a/website/content/docs/connect/config-entries/service-resolver.mdx b/website/content/docs/connect/config-entries/service-resolver.mdx index 5a060335fb..e5716cfd9b 100644 --- a/website/content/docs/connect/config-entries/service-resolver.mdx +++ b/website/content/docs/connect/config-entries/service-resolver.mdx @@ -169,7 +169,6 @@ spec: - {' '} Failover to another datacenter and namespace From b844d68c4b713b6720144daa584d69c01a8f9c63 Mon Sep 17 00:00:00 2001 From: mrspanishviking Date: Mon, 10 Jan 2022 11:22:53 -0700 Subject: [PATCH 3/4] Apply suggestions from code review Co-authored-by: Blake Covarrubias --- .../content/docs/connect/config-entries/service-resolver.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website/content/docs/connect/config-entries/service-resolver.mdx b/website/content/docs/connect/config-entries/service-resolver.mdx index e5716cfd9b..b3560bd795 100644 --- a/website/content/docs/connect/config-entries/service-resolver.mdx +++ b/website/content/docs/connect/config-entries/service-resolver.mdx @@ -169,7 +169,7 @@ spec: - Failover to another datacenter and namespace + Failover to another datacenter and namespace for all service subsets. @@ -182,7 +182,7 @@ ConnectTimeout = "0s" Failover = { "*" = { Datacenters = ["dc2"] - Namespace = "secodary" + Namespace = "secondary" } } ``` From 205d687d07361448b2e5491de4d1eaefa50305b7 Mon Sep 17 00:00:00 2001 From: Karl Cardenas Date: Mon, 10 Jan 2022 11:41:43 -0700 Subject: [PATCH 4/4] added additonal example for failover within DC and unique namespace --- .../config-entries/service-resolver.mdx | 62 ++++++++++++++++--- 1 file changed, 55 insertions(+), 7 deletions(-) diff --git a/website/content/docs/connect/config-entries/service-resolver.mdx b/website/content/docs/connect/config-entries/service-resolver.mdx index b3560bd795..c4ba27d85d 100644 --- a/website/content/docs/connect/config-entries/service-resolver.mdx +++ b/website/content/docs/connect/config-entries/service-resolver.mdx @@ -116,9 +116,9 @@ spec: -### Datacenter failover +### Failover -Enable failover for subset 'v2' to 'dc2', and all other subsets to dc3 or dc4: +Enable failover for subset `v2` to `dc2`, and all other subsets to `dc3` or `dc4`: @@ -194,22 +194,70 @@ metadata: name: product-api namespace: primary spec: - connectTimeout: 0 + connectTimeout: 0s failover: namespace: 'secondary' - '*': - datacenters: ['dc2'] + datacenters: ['dc2'] ``` ```json { "Kind": "service-resolver", "Name": "product-api", - "Namespace": "primary" + "Namespace": "primary", "ConnectTimeout": "0s", "Failover": { "*": { - "Datacenters": ["dc2"] + "Datacenters": ["dc2"], + "Namespace": "secondary" + } + } +} +``` + + + + + Failover within a datacenter and a different namespace. + + + + +```hcl +Kind = "service-resolver" +Name = "product-api" +Namespace = "primary" +ConnectTimeout = "0s" +Failover = { + "*" = { + Service = "product-api-backup" + Namespace = "secondary" + } +} +``` + +```yaml +apiVersion: consul.hashicorp.com/v1alpha1 +kind: ServiceResolver +metadata: + name: product-api + namespace: primary +spec: + connectTimeout: 0s + failover: + service: 'product-api-backup' + namespace: 'secondary' +``` + +```json +{ + "Kind": "service-resolver", + "Name": "product-api", + "Namespace": "primary", + "ConnectTimeout": "0s", + "Failover": { + "*": { + "Service": "product-api-backup", "Namespace": "secondary" } }