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

allow updating node image types #1843

Merged
merged 1 commit into from
Aug 7, 2018
Merged

Conversation

danawillow
Copy link
Contributor

Fixes #1702.

@chrisst I'm putting you as a reviewer, but no rush. Feel free to ask as many questions as you have! Also feel free to offer suggestions 😃 (or just say it's perfect as-is, that works too)

@danawillow danawillow requested a review from chrisst August 6, 2018 21:20
Copy link
Contributor

@chrisst chrisst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly just clarifying my assumptions, otherwise LGTM

@@ -1120,6 +1120,36 @@ func resourceContainerClusterUpdate(d *schema.ResourceData, meta interface{}) er
d.SetPartial("logging_service")
}

if d.HasChange("node_config") {
if d.HasChange("node_config.0.image_type") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming that the node_config.0 is referencing the first instance of node_config in the HCL. In which case I'm also assuming that there is something in place to stop 2 different node_config blocks from existing in the same container cluster definition?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly.

MaxItems: 1 at https://github.com/terraform-providers/terraform-provider-google/blob/master/google/node_config.go#L27 is that check. The nice thing about it existing in the schema is that it means that when you run terraform plan, it'll tell you that your config is invalid right away, vs doing so after you've started applying.

return containerBetaOperationWait(config, op,
nodePoolInfo.project,
nodePoolInfo.location, "updating GKE node pool",
timeoutInMinutes, 2)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a standard/process for choosing what timeouts should be? I didn't see any reference to timeouts in the gcp api docs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, mostly trial and error. Many of our resources have a Timeouts block, which lets the user specify their own timeouts if they think our default ones are wrong. See:

if d.HasChange(prefix + "node_config.0.image_type") {
req := &containerBeta.UpdateClusterRequest{
Update: &containerBeta.ClusterUpdate{
DesiredNodePoolId: name,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why pass an update to the name in addition to the image type?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's what this particular API wants: https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1beta1/ClusterUpdate (also, the GKE API is super unusual with regards to how properties can be updated. Most other resources just use a regular PUT or PATCH or the occasional custom update verb)

}

// Call update serially.
if err := lockedCall(lockKey, updateF); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean if a config gets changed in many different top level blocks we will end up making a different update call for each block? eg: 1 update if node_config is updated and another if auto_scaling is update, etc...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup. Again, that's a GKE-specific thing: https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1beta1/ClusterUpdate

Exactly one update can be applied to a cluster with each request, so at most one field can be provided.

@danawillow danawillow merged commit 00e5bd5 into hashicorp:master Aug 7, 2018
@danawillow danawillow deleted the is-1702 branch August 7, 2018 21:07
chrisst pushed a commit to chrisst/terraform-provider-google that referenced this pull request Nov 9, 2018
Fixes hashicorp#1702.

@chrisst I'm putting you as a reviewer, but no rush. Feel free to ask as many questions as you have! Also feel free to offer suggestions 😃 (or just say it's perfect as-is, that works too)
@ghost
Copy link

ghost commented Nov 17, 2018

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Nov 17, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants