https://github.com/jsiebens/nomad-droplets-autoscaler
DigitalOcean Droplets target plugin for HashiCorp Nomad Autoscaler
https://github.com/jsiebens/nomad-droplets-autoscaler
autoscaling digitalocean hashicorp hashicorp-nomad nomad nomad-autoscaler
Last synced: 6 months ago
JSON representation
DigitalOcean Droplets target plugin for HashiCorp Nomad Autoscaler
- Host: GitHub
- URL: https://github.com/jsiebens/nomad-droplets-autoscaler
- Owner: jsiebens
- License: mit
- Created: 2021-04-20T06:37:52.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-05-07T06:04:56.000Z (about 3 years ago)
- Last Synced: 2024-06-19T02:03:15.966Z (11 months ago)
- Topics: autoscaling, digitalocean, hashicorp, hashicorp-nomad, nomad, nomad-autoscaler
- Language: Go
- Homepage:
- Size: 75.2 KB
- Stars: 47
- Watchers: 3
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-nomad - jsiebens/nomad-droplets-autoscaler - This project is a plugin for HashiCorp Nomad that allows for the automated scaling of DigitalOcean Droplets. (Plugins / User Interfaces and Dashboards)
README
# Nomad DigitalOcean Droplets Autoscaler
The `do-droplets` target plugin allows for the scaling of the Nomad cluster clients via creating and
destroying [DigitalOcean Droplets](https://www.digitalocean.com/products/droplets/).## Requirements
* nomad autoscaler 0.3.0+
* DigitalOcean account## Documentation
### Agent Configuration Options
To use the `do-droplets` target plugin, the agent configuration needs to be populated with the appropriate target block.
Currently, Personal Access Token (PAT) is the only method of authenticating with the API. You can manage your tokens at the DigitalOcean Control Panel [Applications Page](https://cloud.digitalocean.com/settings/applications).```
target "do-droplets" {
driver = "do-droplets"
config = {
token = "local/token"
}
}
```- `token` `(string: "")` - a DigitalOcean API token or a path to a file containing a token. Alternatively, this can also be specified using environment variables ordered by precedence:
- `DIGITALOCEAN_TOKEN`
- `DIGITALOCEAN_ACCESS_TOKEN`### Policy Configuration Options
``` hcl
check "hashistack-allocated-cpu" {
# ...
target "do-droplets" {
name = "hashi-worker"
region = "nyc1"
size = "s-1vcpu-1gb"
snapshot_id = 84589509
user_data = "local/hashi-worker-user-data.sh"
tags = "hashi-stack"
node_class = "hashistack"
node_drain_deadline = "5m"
node_purge = "true"
}
# ...
}
```
- `name` `(string: )` - A logical name of a Droplet "group". Every managed Droplet will be tagged with this value and its name is this value with a random suffix
- `region` `(string: )` - The region to start in.- `vpc_uuid` `(string: )` - The ID of the VPC where the Droplet will be located.
- `size` `(string: )` - The unique slug that indentifies the type of Droplet. You can find a list of available slugs on [DigitalOcean API documentation](https://developers.digitalocean.com/documentation/v2/#list-all-sizes).
- `snapshot_id` `(string: )` - The Droplet image ID.
- `user_data` `(string: "")` - A string of the desired User Data for the Droplet or a path to a file containing the User Data
- `ssh_keys` `(string: "")` - A comma-separated list of SSH fingerprints to enable
- `tags` `(string: "")` - A comma-separated list of additional tags to be applied to the Droplets.
- `datacenter` `(string: "")` - The Nomad client [datacenter](https://www.nomadproject.io/docs/configuration#datacenter)
identifier used to group nodes into a pool of resource. Conflicts with
`node_class`.- `node_class` `(string: "")` - The Nomad [client node class](https://www.nomadproject.io/docs/configuration/client#node_class)
identifier used to group nodes into a pool of resource. Conflicts with
`datacenter`.- `node_drain_deadline` `(duration: "15m")` The Nomad [drain deadline](https://www.nomadproject.io/api-docs/nodes#deadline) to use when performing node draining
actions. **Note that the default value for this setting differs from Nomad's
default of 1h.**- `node_drain_ignore_system_jobs` `(bool: "false")` A boolean flag used to
control if system jobs should be stopped when performing node draining
actions.- `node_purge` `(bool: "false")` A boolean flag to determine whether Nomad
clients should be [purged](https://www.nomadproject.io/api-docs/nodes#purge-node) when performing scale in
actions.- `node_selector_strategy` `(string: "least_busy")` The strategy to use when
selecting nodes for termination. Refer to the [node selector
strategy](https://www.nomadproject.io/docs/autoscaling/internals/node-selector-strategy) documentation for more information.