Skip to content

Commit

Permalink
Add test for os sku
Browse files Browse the repository at this point in the history
Signed-off-by: Jan-Otto Kröpke <[email protected]>
  • Loading branch information
jkroepke committed May 28, 2023
1 parent 6290300 commit a88ea17
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
25 changes: 14 additions & 11 deletions internal/services/containers/kubernetes_cluster_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -2060,19 +2060,22 @@ func resourceKubernetesClusterUpdate(d *pluginsdk.ResourceData, meta interface{}
return err
}
}

cycleNodePool := false
cycleNodePoolProperties := []string{"name", "enable_host_encryption", "enable_node_public_ip", "kubelet_config", "linux_os_config", "max_pods",
"node_taints", "only_critical_addons_enabled", "os_disk_size_gb", "os_disk_type", "os_sku", "vm_size", "zones"}

for _, property := range cycleNodePoolProperties {
if d.HasChange("default_node_pool.0." + property) {
cycleNodePool = true
/*
cycleNodePool := false
cycleNodePoolProperties := []string{"name", "enable_host_encryption", "enable_node_public_ip", "kubelet_config", "linux_os_config", "max_pods",
"node_taints", "only_critical_addons_enabled", "os_disk_size_gb", "os_disk_type", "os_sku", "vm_size", "zones"}
for _, property := range cycleNodePoolProperties {
if d.HasChange("default_node_pool.0." + property) {
cycleNodePool = true
}
}
}
// if the default node pool name has changed, it means the initial attempt at resizing failed
if cycleNodePool {
// if the default node pool name has changed, it means the initial attempt at resizing failed
if cycleNodePool {
*/

if d.HasChange("default_node_pool.0.name") || d.HasChange("default_node_pool.0.enable_host_encryption") || d.HasChange("default_node_pool.0.enable_node_public_ip") || d.HasChange("default_node_pool.0.kubelet_config") || d.HasChange("default_node_pool.0.linux_os_config") || d.HasChange("default_node_pool.0.max_pods") || d.HasChange("default_node_pool.0.node_taints") || d.HasChange("default_node_pool.0.only_critical_addons_enabled") || d.HasChange("default_node_pool.0.os_disk_size_gb") || d.HasChange("default_node_pool.0.os_disk_type") || d.HasChange("default_node_pool.0.os_sku") || d.HasChange("default_node_pool.0.vm_size") || d.HasChange("default_node_pool.0.zones") {
log.Printf("[DEBUG] Cycling Default Node Pool..")
// to provide a seamless updating experience for the vm size of the default node pool we need to cycle the default
// node pool by provisioning a temporary system node pool, tearing down the former default node pool and then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func TestAccKubernetesCluster_updateVmSizeAfterFailureWithTempWithoutDefault(t *
})
}

func TestAccKubernetesCluster_updateOs(t *testing.T) {
func TestAccKubernetesCluster_cycleSystemNodePool(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_kubernetes_cluster", "test")
r := KubernetesClusterResource{}

Expand Down Expand Up @@ -774,7 +774,7 @@ resource "azurerm_kubernetes_cluster" "test" {
swap_file_size_mb = 301
sysctl_config {
fs_aio_max_nr = 65535
fs_aio_max_nr = 65537
fs_file_max = 100001
fs_inotify_max_user_watches = 1000001
fs_nr_open = 1048575
Expand Down

0 comments on commit a88ea17

Please sign in to comment.