Skip to content

Commit

Permalink
Allow configuring GKE Node Pool upgrade settings
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
chrissng authored and modular-magician committed Nov 22, 2019
1 parent 4c21341 commit dc77573
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
18 changes: 4 additions & 14 deletions google/resource_sql_user.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,8 @@ func resourceSqlUserCreate(d *schema.ResourceData, meta interface{}) error {

mutexKV.Lock(instanceMutexKey(project, instance))
defer mutexKV.Unlock(instanceMutexKey(project, instance))
var op *sqladmin.Operation
insertFunc := func() error {
op, err = config.clientSqlAdmin.Users.Insert(project, instance,
user).Do()
return err
}
err = retryTimeDuration(insertFunc, d.Timeout(schema.TimeoutCreate))
op, err := config.clientSqlAdmin.Users.Insert(project, instance,
user).Do()

if err != nil {
return fmt.Errorf("Error, failed to insert "+
Expand Down Expand Up @@ -177,13 +172,8 @@ func resourceSqlUserUpdate(d *schema.ResourceData, meta interface{}) error {

mutexKV.Lock(instanceMutexKey(project, instance))
defer mutexKV.Unlock(instanceMutexKey(project, instance))
var op *sqladmin.Operation
updateFunc := func() error {
op, err = config.clientSqlAdmin.Users.Update(project, instance, name,
user).Host(host).Do()
return err
}
err = retryTimeDuration(updateFunc, d.Timeout(schema.TimeoutUpdate))
op, err := config.clientSqlAdmin.Users.Update(project, instance, name,
user).Host(host).Do()

if err != nil {
return fmt.Errorf("Error, failed to update"+
Expand Down
14 changes: 14 additions & 0 deletions website/docs/r/container_node_pool.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ cluster.
* `project` - (Optional) The ID of the project in which to create the node pool. If blank,
the provider-configured project will be used.

* `upgrade_settings` (Optional, [Beta](https://terraform.io/docs/providers/google/guides/provider_versions.html)) Specify node upgrade settings to change how many nodes GKE attempts to
upgrade at once. The number of nodes upgraded simultaneously is the sum of `max_surge` and `max_unavailable`.
The maximum number of nodes upgraded simultaneously is limited to 20.

* `version` - (Optional) The Kubernetes version for the nodes in this pool. Note that if this field
and `auto_upgrade` are both specified, they will fight each other for what the node version should
be, so setting both is highly discouraged. While a fuzzy version can be specified, it's
Expand All @@ -164,6 +168,16 @@ The `management` block supports:

* `auto_upgrade` - (Optional) Whether the nodes will be automatically upgraded.

The `upgrade_settings` block supports:

* `max_surge` - (Optional) The number of additional nodes that can be added to the node pool during
an upgrade. Increasing `max_surge` raises the number of nodes that can be upgraded simultaneously.
Default is 1. Can be set to 0 or greater.

* `max_unavailable` - (Optional) The number of nodes that can be simultaneously unavailable during
an upgrade. Default is 0. Increasing `max_unavailable` raises the number of nodes that can be
upgraded in parallel.

<a id="timeouts"></a>
## Timeouts

Expand Down

0 comments on commit dc77573

Please sign in to comment.