Skip to content

Commit

Permalink
hashicorp#1300 Supporting regional clusters for node pools (hashicorp…
Browse files Browse the repository at this point in the history
…#1320)

This PR also switched us to using the beta API in all cases, and that had a side effect which is worth noting, note included here for posterity.

=====
The problem is, we add a GPU, and as per the docs, GKE adds a taint to
the node pool saying "don't schedule here unless you tolerate GPUs",
which is pretty sensible.

Terraform doesn't know about that, because it didn't ask for the taint
to be added. So after apply, on refresh, it sees the state of the world
(1 taint) and the state of the config (0 taints) and wants to set the
world equal to the config. This introduces a diff, which makes the test
fail - tests fail if there's a diff after they run.

Taints are a beta feature, though. :) And since the config doesn't
contain any taints, terraform didn't see any beta features in that node
pool ... so it used to send the request to the v1 API. And since the v1
API didn't return anything about taints (since they're a beta feature),
terraform happily checked the state of the world (0 taints I know about)
vs the config (0 taints), and all was well.

This PR makes every node pool refresh request hit the beta API. So now
terraform finds out about the taints (which were always there) and the
test fails (which it always should have done).

The solution is probably to write a little bit of code which suppresses
the report of the diff of any taint with value 'nvidia.com/gpu', but
only if GPUs are enabled. I think that's something that can be done.
  • Loading branch information
darrenhaken authored and nat-henderson committed Apr 25, 2018
1 parent 6849665 commit 83676c9
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions docs/r/container_node_pool.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,34 @@ resource "google_container_cluster" "primary" {
}
```

### Usage with a regional cluster

```hcl
resource "google_container_cluster" "regional" {
name = "marcellus-wallace"
region = "us-central1"
}
resource "google_container_node_pool" "regional-np" {
name = "my-node-pool"
region = "us-central1"
cluster = "${google_container_cluster.primary.name}"
node_count = 1
}
```

## Argument Reference

* `zone` - (Required) The zone in which the cluster resides.
* `zone` - (Optional) The zone in which the cluster resides.

* `region` - (Optional) The region in which the cluster resides (for regional clusters).

* `cluster` - (Required) The cluster to create the node pool for. Cluster must be present in `zone` provided for zonal clusters.

* `cluster` - (Required) The cluster to create the node pool for. Cluster must be present in `zone` provided for this resource.
Note: You must be provide region for regional clusters and zone for zonal clusters

- - -

Expand Down

0 comments on commit 83676c9

Please sign in to comment.