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

Enable GKE pods_per_node flags in GA #4620

Closed
Closed
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
4 changes: 4 additions & 0 deletions google/resource_container_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,10 @@ func resourceContainerClusterCreate(d *schema.ResourceData, meta interface{}) er
ResourceLabels: expandStringMap(d, "resource_labels"),
}

if v, ok := d.GetOk("default_max_pods_per_node"); ok {
cluster.DefaultMaxPodsConstraint = expandDefaultMaxPodsConstraint(v)
}

// Only allow setting node_version on create if it's set to the equivalent master version,
// since `InitialClusterVersion` only accepts valid master-style versions.
if v, ok := d.GetOk("node_version"); ok {
Expand Down
11 changes: 10 additions & 1 deletion google/resource_container_node_pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ var schemaNodePool = map[string]*schema.Schema{
},

"max_pods_per_node": {
Removed: "This field is in beta. Use it in the the google-beta provider instead. See https://terraform.io/docs/providers/google/provider_versions.html for more details.",
Type: schema.TypeInt,
Optional: true,
ForceNew: true,
Expand Down Expand Up @@ -494,6 +493,12 @@ func expandNodePool(d *schema.ResourceData, prefix string) (*containerBeta.NodeP
}
}

if v, ok := d.GetOk(prefix + "max_pods_per_node"); ok {
np.MaxPodsConstraint = &containerBeta.MaxPodsConstraint{
MaxPodsPerNode: int64(v.(int)),
}
}

if v, ok := d.GetOk(prefix + "management"); ok {
managementConfig := v.([]interface{})[0].(map[string]interface{})
np.Management = &containerBeta.NodeManagement{}
Expand Down Expand Up @@ -550,6 +555,10 @@ func flattenNodePool(d *schema.ResourceData, config *Config, np *containerBeta.N
}
}

if np.MaxPodsConstraint != nil {
nodePool["max_pods_per_node"] = np.MaxPodsConstraint.MaxPodsPerNode
}

nodePool["management"] = []map[string]interface{}{
{
"auto_repair": np.Management.AutoRepair,
Expand Down