Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spotVM for GKE Node Pools is out of beta #11796

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/6086.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
container: added `spot` field to `node_config` sub-resource
```
12 changes: 12 additions & 0 deletions google/node_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,14 @@ func schemaNodeConfig() *schema.Schema {
Description: `Whether the nodes are created as preemptible VM instances.`,
},

"spot": {
Type: schema.TypeBool,
Optional: true,
ForceNew: true,
Default: false,
Description: `Whether the nodes are created as spot VM instances.`,
},

"service_account": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -416,6 +424,9 @@ func expandNodeConfig(v interface{}) *container.NodeConfig {
// Preemptible Is Optional+Default, so it always has a value
nc.Preemptible = nodeConfig["preemptible"].(bool)

// Spot Is Optional+Default, so it always has a value
nc.Spot = nodeConfig["spot"].(bool)

if v, ok := nodeConfig["min_cpu_platform"]; ok {
nc.MinCpuPlatform = v.(string)
}
Expand Down Expand Up @@ -490,6 +501,7 @@ func flattenNodeConfig(c *container.NodeConfig) []map[string]interface{} {
"labels": c.Labels,
"tags": c.Tags,
"preemptible": c.Preemptible,
"spot": c.Spot,
"min_cpu_platform": c.MinCpuPlatform,
"shielded_instance_config": flattenShieldedInstanceConfig(c.ShieldedInstanceConfig),
"taint": flattenTaints(c.Taints),
Expand Down
1 change: 1 addition & 0 deletions google/resource_container_node_pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1245,6 +1245,7 @@ resource "google_container_node_pool" "with_workload_metadata_config" {
cluster = google_container_cluster.cluster.name
initial_node_count = 1
node_config {
spot = true
oauth_scopes = [
"https://www.googleapis.com/auth/logging.write",
"https://www.googleapis.com/auth/monitoring",
Expand Down
4 changes: 2 additions & 2 deletions website/docs/r/container_cluster.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -719,8 +719,8 @@ gvnic {
are preemptible. See the [official documentation](https://cloud.google.com/container-engine/docs/preemptible-vm)
for more information. Defaults to false.

* `spot` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)) A boolean
that represents whether the underlying node VMs are spot. See the [official documentation](https://cloud.google.com/kubernetes-engine/docs/concepts/spot-vms)
* `spot` - (Optional) A boolean that represents whether the underlying node VMs are spot.
See the [official documentation](https://cloud.google.com/kubernetes-engine/docs/concepts/spot-vms)
for more information. Defaults to false.

* `sandbox_config` - (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)) [GKE Sandbox](https://cloud.google.com/kubernetes-engine/docs/how-to/sandbox-pods) configuration. When enabling this feature you must specify `image_type = "COS_CONTAINERD"` and `node_version = "1.12.7-gke.17"` or later to use it.
Expand Down