opentelekomcloud / terraform-provider-opentelekomcloud

Terraform OpenTelekomCloud provider
https://registry.terraform.io/providers/opentelekomcloud/opentelekomcloud/latest
Mozilla Public License 2.0
87 stars 77 forks source link

CCE changing pool min_node_count causes rolling of all nodes in that pool #2276

Closed bbung closed 1 year ago

bbung commented 1 year ago

Terraform provider version

Terraform v1.5.3 OTC 1.35.3

Affected Resource(s)

opentelekomcloud_cce_node_pool_v3

Terraform Configuration Files

resource "opentelekomcloud_cce_node_pool_v3" "node_pool_2" {
  cluster_id         = opentelekomcloud_cce_cluster_v3.cluster_1.id
  name               = "${var.cluster_name}-node-pool-de-02"
  os                 = "EulerOS 2.5"
  flavor             = "s2.xlarge.4"
  initial_node_count = 2
  availability_zone  = "eu-de-02"
  key_pair           = opentelekomcloud_compute_keypair_v2.cce_ha_nodes_keypair.name
  scale_enable             = true
  min_node_count           = 2
  max_node_count           = var.max_nodes
  scale_down_cooldown_time = 10
  priority                 = 10

  root_volume {
    size       = 40
    volumetype = "SSD"
    kms_id = data.opentelekomcloud_kms_key_v1.key_1.id
  }
  data_volumes {
    size       = 100
    volumetype = "SSD"
    kms_id = data.opentelekomcloud_kms_key_v1.key_1.id
  }

  depends_on = [
    opentelekomcloud_compute_keypair_v2.cce_ha_nodes_keypair
  ]
  lifecycle {
    create_before_destroy = true
  }

  timeouts {
    create = "1h"
    update = "30m"
    delete = "30m"
  }
}

Debug Output/Panic Output

Steps to Reproduce

  1. terraform apply (min_node_count = 5) 2.terraform apply (min_node_count = 2)
    
    opentelekomcloud_cce_node_pool_v3.node_pool_2: Refreshing state... [id=xxx]
    data.opentelekomcloud_cce_cluster_kubeconfig_v3.cluster_1: Read complete after 0s [id=xxx]

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following symbols: ~ update in-place

Terraform will perform the following actions:

opentelekomcloud_cce_node_pool_v3.node_pool_3 will be updated in-place

~ resource "opentelekomcloud_cce_node_pool_v3" "node_pool_3" { id = "xxx" ~ min_node_count = 8 -> 2 name = "int-otc-001-node-pool-de-03"

(12 unchanged attributes hidden)

    # (3 unchanged blocks hidden)
}

Plan: 0 to add, 1 to change, 0 to destroy.



# Expected Behavior
<!--
What should have happened?
-->
Just set min_node_count to the expected value and do not delete existing nodes.

# Actual Behavior
<!--
What actually happened?
-->
All nodes in that pool got drained and new ones got created (just 2) and than the autoscaler kicked in.

# Important Factoids
<!--
Are there anything atypical about your accounts that we should know?
For example: Which version of OpenTelekomCloud? Tight ACLs.
-->
OTC Kubernetes Version 1.25

# References
<!--
Are there any other GitHub issues (open or closed) or Pull Requests that should be linked here? For example:
- GH-1234
- #2546
-->
artem-lifshits commented 1 year ago

Hello @bbung I couldn't reproduce the issue with your config. I've applied the one you provided, then changed min_node_count to 5 and hit terraform apply, next I did the same with min_node_count = 2. Can you recheck if issue still persists?