Skip to content

Commit

Permalink
Graduate support of GKE Compact Placement to GA
Browse files Browse the repository at this point in the history
  • Loading branch information
kawych committed Dec 23, 2022
1 parent b40e53f commit 19876d5
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ var schemaNodePool = map[string]*schema.Schema{
},
},

<% unless version == 'ga' -%>
"placement_policy": {
Type: schema.TypeList,
Optional: true,
Expand All @@ -190,7 +189,6 @@ var schemaNodePool = map[string]*schema.Schema{
},
},
},
<% end -%>

"max_pods_per_node": &schema.Schema{
Type: schema.TypeInt,
Expand Down Expand Up @@ -852,14 +850,12 @@ func expandNodePool(d *schema.ResourceData, prefix string) (*container.NodePool,
}
}

<% unless version == 'ga' -%>
if v, ok := d.GetOk(prefix + "placement_policy"); ok {
placement_policy := v.([]interface{})[0].(map[string]interface{})
np.PlacementPolicy = &container.PlacementPolicy{
Type: placement_policy["type"].(string),
}
}
<% end -%>

if v, ok := d.GetOk(prefix + "max_pods_per_node"); ok {
np.MaxPodsConstraint = &container.MaxPodsConstraint{
Expand Down Expand Up @@ -1044,15 +1040,13 @@ func flattenNodePool(d *schema.ResourceData, config *Config, np *container.NodeP
}
}

<% unless version == 'ga' -%>
if np.PlacementPolicy != nil {
nodePool["placement_policy"] = []map[string]interface{}{
{
"type": np.PlacementPolicy.Type,
},
}
}
<% end -%>

if np.MaxPodsConstraint != nil {
nodePool["max_pods_per_node"] = np.MaxPodsConstraint.MaxPodsPerNode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1343,7 +1343,6 @@ resource "google_container_node_pool" "np" {
`, cluster, np)
}

<% unless version == 'ga' -%>
func TestAccContainerNodePool_compactPlacement(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -1390,7 +1389,6 @@ resource "google_container_node_pool" "np" {
}
`, cluster, np, placementType)
}
<% end -%>

func testAccCheckContainerNodePoolDestroyProducer(t *testing.T) func(s *terraform.State) error {
return func(s *terraform.State) error {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ cluster.
when fuzzy versions are used. See the `google_container_engine_versions` data source's
`version_prefix` field to approximate fuzzy versions in a Terraform-compatible way.

* `placement_policy` - (Optional, [Beta](https://terraform.io/docs/providers/google/provider_versions.html)) Specifies a custom placement policy for the
* `placement_policy` - (Optional) Specifies a custom placement policy for the
nodes.

<a name="nested_autoscaling"></a>The `autoscaling` block supports (either total or per zone limits are required):
Expand Down

0 comments on commit 19876d5

Please sign in to comment.