Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upRolling update support for instance group manager #1137
Conversation
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
apenney
Mar 1, 2018
@ishashchuk I don't have any code feedback, I just wanted to thank you for tackling this (as we'll be early adopters of it, soon as it's merged).
apenney
commented
Mar 1, 2018
|
@ishashchuk I don't have any code feedback, I just wanted to thank you for tackling this (as we'll be early adopters of it, soon as it's merged). |
paddycarver
referenced this pull request
Mar 1, 2018
Closed
Feature Request: support rolling updates for google instance group manager. #51
paddycarver
self-requested a review
Mar 1, 2018
paddycarver
self-assigned this
Mar 1, 2018
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
amoiseiev
commented
Mar 8, 2018
|
@paddycarver friendly reminder :) |
ndmckinley
self-requested a review
Mar 12, 2018
ndmckinley
requested changes
Mar 12, 2018
I'm storing rolling_update_policy block locally, and not applying it to computeBeta.InstanceGroupManager. There is no way to make an update call for this block on the InstanceGroupManager. It is only updated when the patch call for the instances is made. That's the reason I'm storing it locally and only applying it on the update calls that are changing the instance template.
I like this... but I wonder, what happens if someone:
- creates the resource with
RESTART - changes it to
ROLLING_UPDATE - does an update
- changes it back to
RESTART - does another update
In that case, would this code act correctly? It seems like it wouldn't send a PATCH request to remove the strategy, but I might be off.
google/resource_compute_instance_group_manager.go
| @@ -184,6 +241,12 @@ func resourceComputeInstanceGroupManagerCreate(d *schema.ResourceData, meta inte | ||
| return err | ||
| } | ||
| _, ok := d.GetOk("rolling_update_policy") |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
google/resource_compute_instance_group_manager.go
| @@ -380,6 +443,11 @@ func resourceComputeInstanceGroupManagerUpdate(d *schema.ResourceData, meta inte | ||
| d.Partial(true) | ||
| _, ok := d.GetOk("rolling_update_policy") |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
ishashchuk
Mar 13, 2018
Contributor
I like this... but I wonder, what happens if someone:
- creates the resource with RESTART
- changes it to ROLLING_UPDATE
- does an update
- changes it back to RESTART
- does another update
In that case, would this code act correctly? It seems like it wouldn't send a PATCH request to remove the strategy, but I might be off.
@ndmckinley
There is no need to remove the strategy, since it only matters on PATCH requests. PATCH request is using a different API endpoint(clientComputeBeta.InstanceGroupManagers.Patch) and is only used when the resource is set to ROLLING_UPDATE. And we will always get the most up-to-date strategy from the config, because we are passing it explicitly on template change
When resource is set to RESTART, config.clientCompute.InstanceGroupManagers.RecreateInstances is used and that endpoint doesn't care about update_strategy attributes. It reboots all the machines at the same time.
@ndmckinley When resource is set to RESTART, |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
ndmckinley
Mar 13, 2018
Collaborator
Ah! That's quite nice, then, neat trick. I think (but am not 100% sure) that I'd like it to be set during Create as well as during Update, then, because in the event that someone creates a resource with Terraform then runs a ROLLING_UPDATE manually or using some other tool, I think the most sensible behavior is to default to what they specified in Terraform. Does that seem right to you?
|
Ah! That's quite nice, then, neat trick. I think (but am not 100% sure) that I'd like it to be set during |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
ishashchuk
Mar 14, 2018
Contributor
@ndmckinley
I don't think there is much value in setting update_strategy on CREATE, because most of the tools are either expect the user to provide those values, or use their own defaults.
In UI, the values for ROLLING RESTART/REPLACE are pre-populated with defaults, which means that the values instantiated on terraform create won't be respected
Running gcloud beta compute instance-groups managed rolling-action without specifying strategy, use their own defaults too without respecting anything that was previously set on instance manager
|
@ndmckinley In UI, the values for Running |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
ndmckinley
Mar 14, 2018
Collaborator
Fair enough - can you add a comment to that effect? Just that and I'll be ready to merge.
|
Fair enough - can you add a comment to that effect? Just that and I'll be ready to merge. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Should be good to go |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
ndmckinley
Mar 15, 2018
Collaborator
Perfect. I'm running the tests now, and I expect to merge in an hour or so assuming no problems.
|
Perfect. I'm running the tests now, and I expect to merge in an hour or so assuming no problems. |
ishashchuk commentedFeb 28, 2018
•
edited
Edited 1 time
-
ishashchuk
edited Feb 28, 2018 (most recent)
Addresses 51
Supports beta functionality for rolling updates.
When rolling_update is selected as update_strategy, it requires "rolling_update_policy" block.
I'm storing rolling_update_policy block locally, and not applying it to computeBeta.InstanceGroupManager. There is no way to make an update call for this block on the InstanceGroupManager. It is only updated when the patch call for the instances is made. That's the reason I'm storing it locally and only applying it on the update calls that are changing the instance template. That allows us to change rolling_update_policy arguments post creating InstanceGroupManager and making sure that they will be applied at the next patch call.
Once I get feedback on this, I will add similar support to region_instance_group_manager