mirror of https://github.com/status-im/consul.git
Switching service-route, service-resolver, service-splitter examples to CamelCase (#8107)
* Switching service-route example to CamelCase * Switch service-resovler examples to CamelCase * Changing service-splitter examples to CamelCase
This commit is contained in:
parent
15b5142bca
commit
fdac1d8add
|
@ -28,15 +28,15 @@ and discovery terminates.
|
||||||
Create service subsets based on a version metadata and override the defaults:
|
Create service subsets based on a version metadata and override the defaults:
|
||||||
|
|
||||||
```hcl
|
```hcl
|
||||||
kind = "service-resolver"
|
Kind = "service-resolver"
|
||||||
name = "web"
|
Name = "web"
|
||||||
default_subset = "v1"
|
DefaultSubset = "v1"
|
||||||
subsets = {
|
Subsets = {
|
||||||
"v1" = {
|
"v1" = {
|
||||||
filter = "Service.Meta.version == v1"
|
Filter = "Service.Meta.version == v1"
|
||||||
}
|
}
|
||||||
"v2" = {
|
"v2" = {
|
||||||
filter = "Service.Meta.version == v2"
|
Filter = "Service.Meta.version == v2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -44,23 +44,23 @@ subsets = {
|
||||||
Expose a set of services in another datacenter as a virtual service:
|
Expose a set of services in another datacenter as a virtual service:
|
||||||
|
|
||||||
```hcl
|
```hcl
|
||||||
kind = "service-resolver"
|
Kind = "service-resolver"
|
||||||
name = "web-dc2"
|
Name = "web-dc2"
|
||||||
redirect {
|
Redirect {
|
||||||
service = "web"
|
Service = "web"
|
||||||
datacenter = "dc2"
|
Datacenter = "dc2"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Enable failover for all subsets:
|
Enable failover for all subsets:
|
||||||
|
|
||||||
```hcl
|
```hcl
|
||||||
kind = "service-resolver"
|
Kind = "service-resolver"
|
||||||
name = "web"
|
Name = "web"
|
||||||
connect_timeout = "15s"
|
ConnectTimeout = "15s"
|
||||||
failover = {
|
Failover = {
|
||||||
"*" = {
|
"*" = {
|
||||||
datacenters = ["dc3", "dc4"]
|
Datacenters = ["dc3", "dc4"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -68,8 +68,8 @@ failover = {
|
||||||
Representation of the defaults when a resolver is not configured:
|
Representation of the defaults when a resolver is not configured:
|
||||||
|
|
||||||
```hcl
|
```hcl
|
||||||
kind = "service-resolver"
|
Kind = "service-resolver"
|
||||||
name = "web"
|
Name = "web"
|
||||||
```
|
```
|
||||||
|
|
||||||
## Available Fields
|
## Available Fields
|
||||||
|
|
|
@ -41,18 +41,18 @@ service of the same name.
|
||||||
Route HTTP requests with a path starting with `/admin` to a different service:
|
Route HTTP requests with a path starting with `/admin` to a different service:
|
||||||
|
|
||||||
```hcl
|
```hcl
|
||||||
kind = "service-router"
|
Kind = "service-router"
|
||||||
name = "web"
|
Name = "web"
|
||||||
routes = [
|
Routes = [
|
||||||
{
|
{
|
||||||
match {
|
Match {
|
||||||
http {
|
HTTP {
|
||||||
path_prefix = "/admin"
|
PathPrefix = "/admin"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
destination {
|
Destination {
|
||||||
service = "admin"
|
Service = "admin"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
# NOTE: a default catch-all will send unmatched traffic to "web"
|
# NOTE: a default catch-all will send unmatched traffic to "web"
|
||||||
|
@ -62,39 +62,39 @@ routes = [
|
||||||
Route HTTP requests with a special url parameter or header to a canary subset:
|
Route HTTP requests with a special url parameter or header to a canary subset:
|
||||||
|
|
||||||
```hcl
|
```hcl
|
||||||
kind = "service-router"
|
Kind = "service-router"
|
||||||
name = "web"
|
Name = "web"
|
||||||
routes = [
|
Routes = [
|
||||||
{
|
{
|
||||||
match {
|
Match {
|
||||||
http {
|
HTTP {
|
||||||
header = [
|
Header = [
|
||||||
{
|
{
|
||||||
name = "x-debug"
|
Name = "x-debug"
|
||||||
exact = "1"
|
Exact = "1"
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
destination {
|
Destination {
|
||||||
service = "web"
|
Service = "web"
|
||||||
service_subset = "canary"
|
ServiceSubset = "canary"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
match {
|
Match {
|
||||||
http {
|
HTTP {
|
||||||
query_param = [
|
QueryParam = [
|
||||||
{
|
{
|
||||||
name = "x-debug"
|
Name = "x-debug"
|
||||||
exact = "1"
|
Exact = "1"
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
destination {
|
Destination {
|
||||||
service = "web"
|
Service = "web"
|
||||||
service_subset = "canary"
|
ServiceSubset = "canary"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
# NOTE: a default catch-all will send unmatched traffic to "web"
|
# NOTE: a default catch-all will send unmatched traffic to "web"
|
||||||
|
@ -105,18 +105,18 @@ Re-route a gRPC method to another service. Since gRPC method calls [are
|
||||||
HTTP2](https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md), we can use an HTTP path match rule to re-route traffic:
|
HTTP2](https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md), we can use an HTTP path match rule to re-route traffic:
|
||||||
|
|
||||||
```hcl
|
```hcl
|
||||||
kind = "service-router"
|
Kind = "service-router"
|
||||||
name = "billing"
|
Name = "billing"
|
||||||
routes = [
|
Routes = [
|
||||||
{
|
{
|
||||||
match {
|
Match {
|
||||||
http {
|
HTTP {
|
||||||
path_exact = "/mycompany.BillingService/GenerateInvoice"
|
PathExact = "/mycompany.BillingService/GenerateInvoice"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
destination {
|
Destination {
|
||||||
service = "invoice-generator"
|
Service = "invoice-generator"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
# NOTE: a default catch-all will send unmatched traffic to "billing"
|
# NOTE: a default catch-all will send unmatched traffic to "billing"
|
||||||
|
|
|
@ -44,16 +44,16 @@ resolution stage.
|
||||||
Split traffic between two subsets of the same service:
|
Split traffic between two subsets of the same service:
|
||||||
|
|
||||||
```hcl
|
```hcl
|
||||||
kind = "service-splitter"
|
Kind = "service-splitter"
|
||||||
name = "web"
|
Name = "web"
|
||||||
splits = [
|
Splits = [
|
||||||
{
|
{
|
||||||
weight = 90
|
Weight = 90
|
||||||
service_subset = "v1"
|
ServiceSubset = "v1"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
weight = 10
|
Weight = 10
|
||||||
service_subset = "v2"
|
ServiceSubset = "v2"
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
@ -61,16 +61,16 @@ splits = [
|
||||||
Split traffic between two services:
|
Split traffic between two services:
|
||||||
|
|
||||||
```hcl
|
```hcl
|
||||||
kind = "service-splitter"
|
Kind = "service-splitter"
|
||||||
name = "web"
|
Name = "web"
|
||||||
splits = [
|
Splits = [
|
||||||
{
|
{
|
||||||
weight = 50
|
Weight = 50
|
||||||
# will default to service with same name as config entry ("web")
|
# will default to service with same name as config entry ("web")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
weight = 10
|
Weight = 10
|
||||||
service = "web-rewrite"
|
Service = "web-rewrite"
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in New Issue