Skip to content

Commit

Permalink
max_pods_per_node is GA now.
Browse files Browse the repository at this point in the history
Signed-off-by: Modular Magician <magic-modules@google.com>
  • Loading branch information
nat-henderson authored and modular-magician committed Oct 4, 2019
1 parent e116744 commit 6ea9b33
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions google/resource_container_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,13 @@ func resourceContainerCluster() *schema.Resource {
Elem: &schema.Schema{Type: schema.TypeString},
},

"default_max_pods_per_node": {
Type: schema.TypeInt,
Optional: true,
ForceNew: true,
Computed: true,
},

"enable_intranode_visibility": {
Type: schema.TypeBool,
Optional: true,
Expand Down Expand Up @@ -775,6 +782,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 Expand Up @@ -989,6 +1000,9 @@ func resourceContainerClusterRead(d *schema.ResourceData, meta interface{}) erro
if err := d.Set("cluster_autoscaling", nil); err != nil {
return err
}
if cluster.DefaultMaxPodsConstraint != nil {
d.Set("default_max_pods_per_node", cluster.DefaultMaxPodsConstraint.MaxPodsPerNode)
}
if err := d.Set("node_config", flattenNodeConfig(cluster.NodeConfig)); err != nil {
return err
}
Expand Down Expand Up @@ -1830,6 +1844,16 @@ func expandPodSecurityPolicyConfig(configured interface{}) *containerBeta.PodSec
return nil
}

func expandDefaultMaxPodsConstraint(v interface{}) *containerBeta.MaxPodsConstraint {
if v == nil {
return nil
}

return &containerBeta.MaxPodsConstraint{
MaxPodsPerNode: int64(v.(int)),
}
}

func flattenNetworkPolicy(c *containerBeta.NetworkPolicy) []map[string]interface{} {
result := []map[string]interface{}{}
if c != nil {
Expand Down

0 comments on commit 6ea9b33

Please sign in to comment.