docs: update file scaling policy docs
This commit is contained in:
parent
9fea300de4
commit
11b8bcddf8
|
@ -65,32 +65,92 @@ horizontal application scaling or horizontal cluster scaling.
|
||||||
Detailed information on the configuration options can be found on the
|
Detailed information on the configuration options can be found on the
|
||||||
[Strategy Plugins][strategy_plugin_docs] page.
|
[Strategy Plugins][strategy_plugin_docs] page.
|
||||||
|
|
||||||
### Example
|
### Example in a Job
|
||||||
|
|
||||||
A full example of a policy document that can be written into the Nomad task group
|
A full example of a policy document that can be written into the Nomad task group
|
||||||
`scaling` stanza or via a file within the `policy_dir` can be seen below.
|
`scaling` stanza can be seen below.
|
||||||
|
|
||||||
```hcl
|
```hcl
|
||||||
min = 2
|
job "example" {
|
||||||
max = 10
|
group "app" {
|
||||||
enabled = true
|
scaling {
|
||||||
|
min = 2
|
||||||
|
max = 10
|
||||||
|
enabled = true
|
||||||
|
|
||||||
policy {
|
policy {
|
||||||
evaluation_interval = "5s"
|
evaluation_interval = "5s"
|
||||||
cooldown = "1m"
|
cooldown = "1m"
|
||||||
|
|
||||||
target "target" {
|
check "active_connections" {
|
||||||
Job = "example"
|
source = "prometheus"
|
||||||
Group = "example"
|
query = "scalar(open_connections_example_cache)"
|
||||||
|
|
||||||
|
strategy "target_value" {
|
||||||
|
target = 10
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
check "active_connections" {
|
### Example in a File
|
||||||
source = "prometheus"
|
|
||||||
query = "scalar(open_connections_example_cache)"
|
|
||||||
query_window = "5m"
|
|
||||||
|
|
||||||
strategy "target_value" {
|
An example of a policy document that can be placed in a file within the
|
||||||
target = 10
|
`policy_dir` can be seen below. Multiple policies can be defined in the same
|
||||||
|
file using multiple `stanza` blocks.
|
||||||
|
|
||||||
|
```hcl
|
||||||
|
scaling "aws_cluster_policy" {
|
||||||
|
enabled = true
|
||||||
|
min = 1
|
||||||
|
max = 2
|
||||||
|
|
||||||
|
policy {
|
||||||
|
cooldown = "2m"
|
||||||
|
evaluation_interval = "1m"
|
||||||
|
|
||||||
|
check "cpu_allocated_percentage" {
|
||||||
|
source = "prometheus"
|
||||||
|
query = "..."
|
||||||
|
|
||||||
|
strategy "target-value" {
|
||||||
|
target = 70
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
check "mem_allocated_percentage" {
|
||||||
|
source = "prometheus"
|
||||||
|
query = "..."
|
||||||
|
|
||||||
|
strategy "target-value" {
|
||||||
|
target = 70
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
target "aws-asg" {
|
||||||
|
dry-run = "false"
|
||||||
|
aws_asg_name = "hashistack-nomad_client"
|
||||||
|
node_class = "hashistack"
|
||||||
|
node_drain_deadline = "5m"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
scaling "azure_cluster_policy" {
|
||||||
|
enabled = true
|
||||||
|
min = 1
|
||||||
|
max = 2
|
||||||
|
|
||||||
|
policy {
|
||||||
|
...
|
||||||
|
target "azure-vmss" {
|
||||||
|
resource_group = "hashistack"
|
||||||
|
vm_scale_set = "clients"
|
||||||
|
node_class = "hashistack"
|
||||||
|
node_drain_deadline = "5m"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue