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

Containerservices agentpoolprofile maxpods #1753

Merged
9 changes: 9 additions & 0 deletions azurerm/data_source_kubernetes_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ func dataSourceArmKubernetesCluster() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},

"max_pods": {
Type: schema.TypeInt,
Computed: true,
},
},
},
},
Expand Down Expand Up @@ -339,6 +344,10 @@ func flattenKubernetesClusterDataSourceAgentPoolProfiles(input *[]containerservi
agentPoolProfile["os_type"] = string(profile.OsType)
}

if profile.MaxPods != nil {
agentPoolProfile["max_pods"] = int(*profile.MaxPods)
}

agentPoolProfiles = append(agentPoolProfiles, agentPoolProfile)
}

Expand Down
15 changes: 15 additions & 0 deletions azurerm/resource_arm_kubernetes_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,13 @@ func resourceArmKubernetesCluster() *schema.Resource {
}, true),
DiffSuppressFunc: ignoreCaseDiffSuppressFunc,
},

"max_pods": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
ForceNew: true,
},
},
},
},
Expand Down Expand Up @@ -532,6 +539,10 @@ func flattenAzureRmKubernetesClusterAgentPoolProfiles(profiles *[]containerservi
agentPoolProfile["os_type"] = string(profile.OsType)
}

if profile.MaxPods != nil {
agentPoolProfile["max_pods"] = int(*profile.MaxPods)
}

agentPoolProfiles = append(agentPoolProfiles, agentPoolProfile)
}

Expand Down Expand Up @@ -691,6 +702,10 @@ func expandAzureRmKubernetesClusterAgentProfiles(d *schema.ResourceData) []conta
OsType: containerservice.OSType(osType),
}

if maxPods := int32(config["max_pods"].(int)); maxPods > 0 {
profile.MaxPods = utils.Int32(maxPods)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we update the acceptance tests (for the internal network probably makes the most sense, rather than a new test?) to set this value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done :)


vnetSubnetID := config["vnet_subnet_id"].(string)
if vnetSubnetID != "" {
profile.VnetSubnetID = utils.String(vnetSubnetID)
Expand Down
1 change: 1 addition & 0 deletions website/docs/d/kubernetes_cluster.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ provider "kubernetes" {
* `os_disk_size_gb` - The size of the Agent VM's Operating System Disk in GB.
* `os_type` - The Operating System used for the Agents.
* `vnet_subnet_id` - The ID of the Subnet where the Agents in the Pool are provisioned.
* `max_pods` - The maximum number of pods that can run on each agent.

`service_principal` supports the following:

Expand Down
1 change: 1 addition & 0 deletions website/docs/r/kubernetes_cluster.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ The following arguments are supported:
* `os_disk_size_gb` - (Optional) The Agent Operating System disk size in GB. Changing this forces a new resource to be created.
* `os_type` - (Optional) The Operating System used for the Agents. Possible values are `Linux` and `Windows`. Changing this forces a new resource to be created. Defaults to `Linux`.
* `vnet_subnet_id` - (Optional) The ID of the Subnet where the Agents in the Pool should be provisioned. Changing this forces a new resource to be created.
* `max_pods` - (Optional) The maximum number of pods that can run on each agent. Default is 30.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This no longer defaults to 30 - so can we remove this?


`service_principal` supports the following:

Expand Down