syseleven / terraform-provider-metakube

Terraform Kubermatic provider
Apache License 2.0
9 stars 7 forks source link

Autoscaling Node Deployment is scaled up upon every tf apply #107

Closed jdftapi closed 3 weeks ago

jdftapi commented 3 months ago

Provider Version: 5.3.3

Observed Behaviour

We have created a node deployment like this:

resource "metakube_node_deployment" "storage-backup-nodes" {
  name = "storage-backup-nodes"
  cluster_id = metakube_cluster.cluster.id
  spec {
    min_replicas = 0
    max_replicas = 3
    template {
      cloud {
        openstack {
          flavor = var.storage_backup_nodepool.flavor
          image = var.storage_backup_nodepool.image
          use_floating_ip = false
        }
      }
      operating_system {
        ubuntu {}
      }
      versions {
        kubelet = 1.28.11
      }
      labels = {
        "labels.ftapi.com/run" = "storage-backup"
        "labels.ftapi.com/disktype" = "network-shared"
      }
      taints {
        key = "run"
        value = "storage-backup"
        effect = "NoSchedule"
      }
    }
  }
}

It is autoscaling from 0 to 3. Whenever we run terraform apply, terraform wants to change the replicas from the current value (0 for most of the time) to the max_replicas value (3). We explicitly have NOT set a value for replicas.

  # module.metakube_prod.module.cluster_prod-fes1-1.metakube_node_deployment.storage-backup-nodes will be updated in-place
  ~ resource "metakube_node_deployment" "storage-backup-nodes" {
        id                 = "storage-backup-nodes"
        name               = "storage-backup-nodes"
        # (4 unchanged attributes hidden)

      ~ spec {
          ~ replicas     = 0 -> 3
            # (2 unchanged attributes hidden)

            # (1 unchanged block hidden)
        }
    }

Expected Behaviour

Since only min_replicas and max_replicas are defined, we expect terraform to ignore the replicas value.

phiphi282 commented 1 month ago

This will be fixed with version v5.4.0 We decided to remove the default entirely and instead make it mandatory to either set replicas or min and max replicas See #108