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

initial_node_count value not getting updated from terraform #1136

Open
RITESHBRID opened this issue Jan 28, 2022 · 3 comments
Open

initial_node_count value not getting updated from terraform #1136

RITESHBRID opened this issue Jan 28, 2022 · 3 comments
Labels
breaking P4 low priority issues refactor Updates for readability, code cleanliness, DRYness, etc. Only needs Terraform exp. triaged Scoped and ready for work

Comments

@RITESHBRID
Copy link

TL;DR

Whenever we try to update initial_node_count variable, terrafrom plan and apply did not show any changes

Expected behavior

initial_node_count must be updated through terraform

Observed behavior

No response

Terraform Configuration

module "gke" {
  source = "terraform-google-modules/kubernetes-engine/google//modules/beta-private-cluster-update-variant"

  version = "13.1.0"

  project_id                  = var.project_id
  kubernetes_version          = var.kubernetes_version
  name                        = "${var.environment}-${var.location_acronym}-${var.cluster_name_suffix}"
  region                      = var.location
  zones                       = var.zones
  network                     = var.network_name
  subnetwork                  = var.subnet_name
  ip_range_services           = "${var.subnet_name}"
  ip_range_pods               = "${var.subnet_name}"
  http_load_balancing         = var.http_load_balancing
  horizontal_pod_autoscaling  = var.horizontal_pod_autoscaling
  network_policy              = var.network_policy
  enable_private_endpoint     = var.enable_private_endpoint
  enable_private_nodes        = var.enable_private_nodes
  master_ipv4_cidr_block      = var.master_ipv4_cidr_block
  enable_intranode_visibility = var.enable_intranode_visibility
  master_authorized_networks = var.master_authorized_networks
  create_service_account     = var.create_service_account
  service_account            = "gke-sa-${var.project_id}.iam.gserviceaccount.com"
  remove_default_node_pool   = var.remove_default_node_pool
  default_max_pods_per_node  = var.default_max_pods_per_node
  maintenance_start_time     = var.maintenance_start_time
  maintenance_end_time       = var.maintenance_end_time
  notification_config_topic  = "projects/${var.project_id}/topics/${var.notification_config_topic}"
  maintenance_exclusions     =  var.maintenance_exclusions
  cluster_autoscaling        = var.cluster_autoscaling
  
  node_pools = [
    {
      name               = "${var.network_name}-test"
      machine_type       = var.machine_type
      enable_secure_boot = true
      node_locations     = var.node_pools_locations
      min_count          = var.min_node_count_default_node
      max_count          = var.max_node_count_default_node
      local_ssd_count    = 0
      disk_size_gb       = var.disk_size_gb_default_node
      disk_type          = var.disk_type_defnp01_node
      image_type         = var.image_type_default_node
      auto_repair        = var.auto_repair_default_node
      auto_upgrade       = var.auto_upgrade_default_node
      service_account    = "gke-sa-${var.project_id}.iam.gserviceaccount.com"
      preemptible        = var.preemptible_default_node
      initial_node_count = var.initial_node_count_default_node
    }
]

  node_pools_oauth_scopes = {
    all = []

    "${var.network_name}-test" = [
      "https://www.googleapis.com/auth/cloud-platform",
    ]
  }

  node_pools_labels = {
    all = {}


    "${var.network_name}-test" = {"${var.network_name}-test" = true }
  }

  node_pools_metadata = {
    all = {}

   "${var.network_name}-test" = {
      node-pool-metadata-custom-value = "${var.network_name}-test"
    }

  }

  node_pools_taints = {
    all = []

   "${var.network_name}-test" = [
      {
        key    = "${var.network_name}-test"
        value  = true
        effect = "PREFER_NO_SCHEDULE"
      }
    ]
  }

  node_pools_tags = {
    all = []


    "${var.network_name}-test" = [
      "${var.network_name}-test",
    ]

  }
}

Terraform Version

Terraform v1.1.0

Additional information

No response

@RITESHBRID RITESHBRID added the bug Something isn't working label Jan 28, 2022
@morgante
Copy link
Contributor

morgante commented Jan 31, 2022

initial_node_count is only used for the default pool (that we delete anyways) and is therefore intentionally ignored.

We should probably remove it from the module entirely, but that will require additional refactoring.

If you want to change the number of nodes in your cluster, you should adjust the size of your node pools. There is actually no reason to adjust the number at any time.

@morgante morgante added breaking P4 low priority issues refactor Updates for readability, code cleanliness, DRYness, etc. Only needs Terraform exp. triaged Scoped and ready for work and removed bug Something isn't working labels Jan 31, 2022
@RITESHBRID
Copy link
Author

@morgante I my case, I have down scaled my gke cluster to size 0 through GCP console, Now I have tried to upscale the cluster through terraform, I have changed min_count to 5 but still cluster is not spine up new nodes to match min node count. However GCP console show the Min count has been updated in autoscale

@morgante
Copy link
Contributor

Please focus on modifying the node pool configuration.

If that is somehow not working for you, it has nothing to do with Terraform and you should open a support case with Google.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking P4 low priority issues refactor Updates for readability, code cleanliness, DRYness, etc. Only needs Terraform exp. triaged Scoped and ready for work
Projects
None yet
Development

No branches or pull requests

2 participants