diff --git a/website/content/docs/connect/config-entries/service-resolver.mdx b/website/content/docs/connect/config-entries/service-resolver.mdx index b8ec5ce2b..27b86af94 100644 --- a/website/content/docs/connect/config-entries/service-resolver.mdx +++ b/website/content/docs/connect/config-entries/service-resolver.mdx @@ -122,9 +122,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`: @@ -174,6 +174,104 @@ spec: + + Failover to another datacenter and namespace for all service subsets. + + + + +```hcl +Kind = "service-resolver" +Name = "product-api" +Namespace = "primary" +ConnectTimeout = "0s" +Failover = { + "*" = { + Datacenters = ["dc2"] + Namespace = "secondary" + } +} +``` + +```yaml +apiVersion: consul.hashicorp.com/v1alpha1 +kind: ServiceResolver +metadata: + name: product-api + namespace: primary +spec: + connectTimeout: 0s + failover: + namespace: 'secondary' + datacenters: ['dc2'] +``` + +```json +{ + "Kind": "service-resolver", + "Name": "product-api", + "Namespace": "primary", + "ConnectTimeout": "0s", + "Failover": { + "*": { + "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" + } + } +} +``` + + + ### Consistent load balancing Apply consistent load balancing for requests based on `x-user-id` header: