mirror of https://github.com/status-im/consul.git
Add documentation for resolver LB cfg
This commit is contained in:
parent
28d0602fc1
commit
0236e169bb
|
@ -1028,10 +1028,10 @@ func (l LoadBalancer) IsHashBased() bool {
|
|||
|
||||
// RingHashConfig contains configuration for the "ring_hash" policy type
|
||||
type RingHashConfig struct {
|
||||
// MinimumRingSize determines the minimum number of hashes per destination host
|
||||
// MinimumRingSize determines the minimum number of entries in the hash ring
|
||||
MinimumRingSize uint64 `json:",omitempty" alias:"minimum_ring_size"`
|
||||
|
||||
// MaximumRingSize determines the maximum number of hashes per destination host
|
||||
// MaximumRingSize determines the maximum number of entries in the hash ring
|
||||
MaximumRingSize uint64 `json:",omitempty" alias:"maximum_ring_size"`
|
||||
}
|
||||
|
||||
|
@ -1058,7 +1058,7 @@ type HashPolicy struct {
|
|||
FieldMatchValue string `json:",omitempty" alias:"field_value"`
|
||||
|
||||
// SourceAddress determines whether the hash should be of the source IP rather than of a field and field value.
|
||||
// Cannot be specified along with Field and FieldMatchValue.
|
||||
// Cannot be specified along with Field or FieldMatchValue.
|
||||
SourceAddress bool `json:",omitempty" alias:"source_address"`
|
||||
|
||||
// Terminal will short circuit the computation of the hash when multiple hash policies are present.
|
||||
|
|
|
@ -228,10 +228,10 @@ type LoadBalancer struct {
|
|||
|
||||
// RingHashConfig contains configuration for the "ring_hash" policy type
|
||||
type RingHashConfig struct {
|
||||
// MinimumRingSize determines the minimum number of hashes per destination host
|
||||
// MinimumRingSize determines the minimum number of entries in the hash ring
|
||||
MinimumRingSize uint64 `json:",omitempty" alias:"minimum_ring_size"`
|
||||
|
||||
// MaximumRingSize determines the maximum number of hashes per destination host
|
||||
// MaximumRingSize determines the maximum number of entries in the hash ring
|
||||
MaximumRingSize uint64 `json:",omitempty" alias:"maximum_ring_size"`
|
||||
}
|
||||
|
||||
|
|
|
@ -72,6 +72,23 @@ Kind = "service-resolver"
|
|||
Name = "web"
|
||||
```
|
||||
|
||||
Apply consistent load balancing for requests based on `x-user-id` header:
|
||||
|
||||
```hcl
|
||||
Kind = "service-resolver"
|
||||
Name = "web"
|
||||
|
||||
LoadBalancer = {
|
||||
Policy = "maglev"
|
||||
HashPolicies = [
|
||||
{
|
||||
Field = "header"
|
||||
FieldMatchValue = "x-user-id"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Available Fields
|
||||
|
||||
- `Kind` - Must be set to `service-resolver`
|
||||
|
@ -150,6 +167,53 @@ Name = "web"
|
|||
- `Datacenters` `(array<string>)` - A fixed list of datacenters to try during
|
||||
failover.
|
||||
|
||||
- `LoadBalancer` `(LoadBalancer`) - Determines the load balancing policy and
|
||||
configuration for services issuing requests to this upstream.
|
||||
This option is available in Consul versions 1.8.4 and newer.
|
||||
|
||||
**Note:** The options below are specific to Envoy proxy.
|
||||
|
||||
- `Policy` `(string: "")` - The load balancing policy used to select a host.
|
||||
One of: `random`, `round_robin`, `least_request`, `ring_hash`, `maglev`.
|
||||
|
||||
- `RingHashConfig` `(RingHashConfig)` - Configuration for the `ring_hash`
|
||||
policy type.
|
||||
|
||||
- `MinimumRingRize` `(int: 1024)` - Determines the minimum number of entries
|
||||
in the hash ring.
|
||||
|
||||
- `MaximumRingRize` `(int: 8192)` - Determines the maximum number of entries
|
||||
in the hash ring.
|
||||
|
||||
- `LeastRequestConfig` `(LeastRequestConfig)` - Configuration for the `least_request`
|
||||
policy type.
|
||||
|
||||
- `ChoiceCount` `(int: 2)` - Determines the number of random healthy hosts
|
||||
from which to select the one with the least requests.
|
||||
|
||||
- `HashPolicies` `(array<HashPolicies>)` - a list of hash policies to use for
|
||||
hashing load balancing algorithms. Hash policies are evaluated individually
|
||||
and combined such that identical lists result in the same hash.
|
||||
If no hash policies are present, or none are successfully evaluated,
|
||||
then a random backend host will be selected.
|
||||
|
||||
- `Field` `(string: "")` - The attribute type to hash on.
|
||||
Must be one of `header`,`cookie`, or `query_parameter`.
|
||||
Cannot be specified along with `SourceAddress`.
|
||||
|
||||
- `FieldMatchValue` `(string: "")` - The value to hash.
|
||||
ie. header name, cookie name, URL query parameter name.
|
||||
Cannot be specified along with `SourceAddress`.
|
||||
|
||||
- `SourceAddress` `(bool: false)` - Determines whether the hash should be of the source IP
|
||||
address rather than of a field and field value.
|
||||
Cannot be specified along with `Field` or `FieldMatchValue`.
|
||||
|
||||
- `Terminal` `(bool: false)` - Will short circuit the computation of the hash
|
||||
when multiple hash policies are present. If a hash is computed when a
|
||||
Terminal policy is evaluated, then that hash will be used and subsequent
|
||||
hash policies will be ignored.
|
||||
|
||||
## Service Subsets
|
||||
|
||||
A service subset assigns a concrete name to a specific subset of discoverable
|
||||
|
|
Loading…
Reference in New Issue