github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/website/content/tools/autoscaling/plugins/target/gce-mig.mdx (about) 1 --- 2 layout: docs 3 page_title: 'Autoscaling Plugins: GCE MIG' 4 description: The "gcp-mig" target plugin scales a Google Cloud Engine Managed Instance Group. 5 --- 6 7 # Google Cloud Engine Managed Instance Groups Target 8 9 The `gce-mig` target plugin allows for the scaling of the Nomad cluster clients 10 via manipulating [Google Cloud Engine Managed Instance Groups][gce_migs]. The 11 plugin supports both regional and zonal groups. 12 13 ## Agent Configuration Options 14 15 The plugin uses the official Google Cloud Golang SDK. This means it supports 16 the common ways of [providing credentials to Google Cloud][gcp_credentials]. 17 18 It is recommended, if possible to use the [Vault GCP Secrets 19 engine][vault_gcp_backend] for supplying access credentials to the plugin. 20 21 Credentials should be injected into the configuration via a template rather 22 than as environment variables. This ensures the credentials are passed only to 23 the plugin, rather than being available for all plugins and the agent process. 24 25 ```hcl 26 target "gce-mig" { 27 driver = "gce-mig" 28 config = { 29 credentials = "local/creds.json" 30 } 31 } 32 ``` 33 34 - `credentials` `(string: "")` - This is specified as the path to a Google Cloud 35 credentials file, typically for a service account. 36 37 ### Nomad ACL 38 39 When using a Nomad cluster with ACLs enabled, the plugin will require an ACL token 40 which provides the following permissions: 41 42 ```hcl 43 node { 44 policy = "write" 45 } 46 ``` 47 48 ## Policy Configuration Options 49 50 ```hcl 51 check "hashistack-allocated-cpu" { 52 # ... 53 target "gce-mig" { 54 project = "hashistack-demo" 55 region = "us-west1" 56 mig_name = "nomad-client-hashistack" 57 node_class = "hashistack" 58 node_drain_deadline = "5m" 59 node_purge = "true" 60 } 61 # ... 62 } 63 ``` 64 65 - `project` `(string: <required>)` - The [Google Cloud Platform project 66 ID][gcp_projects] within which the managed instance group is running. 67 68 - `region` `(string: "")` - The GCP region where the Managed Instance Group 69 resides. Providing this parameter indicates the MIG is regional. Conflicts 70 with `zone`. 71 72 - `zone` `(string: "")` - The GCP zone where the Managed Instance Group 73 resides. Providing this parameter indicates the MIG is zonal. Conflicts with 74 `region`. 75 76 - `mig_name` `(string: <required>)` - The name of the GCE Managed Instance 77 Group to interact with when performing scaling actions. 78 79 - `datacenter` `(string: "")` - The Nomad client [datacenter][nomad_datacenter] 80 identifier used to group nodes into a pool of resource. 81 82 - `node_class` `(string: "")` - The Nomad [client node class][nomad_node_class] 83 identifier used to group nodes into a pool of resource. 84 85 - `node_drain_deadline` `(duration: "15m")` The Nomad [drain 86 deadline][nomad_node_drain_deadline] to use when performing node draining 87 actions. **Note that the default value for this setting differs from Nomad's 88 default of 1h.** 89 90 - `node_drain_ignore_system_jobs` `(bool: "false")` A boolean flag used to 91 control if system jobs should be stopped when performing node draining 92 actions. 93 94 - `node_purge` `(bool: "false")` A boolean flag to determine whether Nomad 95 clients should be [purged][nomad_node_purge] when performing scale in 96 actions. 97 98 - `node_selector_strategy` `(string: "least_busy")` The strategy to use when 99 selecting nodes for termination. Refer to the [node selector 100 strategy][node_selector_strategy] documentation for more information. 101 102 [gcp_credentials]: https://cloud.google.com/docs/authentication/production#providing_credentials_to_your_application 103 104 [gcp_projects]: https://cloud.google.com/resource-manager/docs/creating-managing-projects 105 106 [gce_migs]: https://cloud.google.com/compute/docs/instance-groups/ 107 108 [nomad_datacenter]: /docs/configuration#datacenter 109 110 [nomad_node_class]: /docs/configuration/client#node_class 111 112 [nomad_node_drain_deadline]: /api-docs/nodes#deadline 113 114 [nomad_node_purge]: /api-docs/nodes#purge-node 115 116 [node_selector_strategy]: /tools/autoscaling/internals/node-selector-strategy 117 118 [vault_gcp_backend]: https://www.vaultproject.io/docs/secrets/gcp