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

Creating GKE cluster without initial_node_count #1163

Closed
pbzdyl opened this issue Mar 7, 2018 · 3 comments · Fixed by #1176
Closed

Creating GKE cluster without initial_node_count #1163

pbzdyl opened this issue Mar 7, 2018 · 3 comments · Fixed by #1176
Assignees

Comments

@pbzdyl
Copy link

pbzdyl commented Mar 7, 2018

Terraform Version

Terraform v0.11.3

  • provider.google v1.6.0

Affected Resource

  • google_container_cluster

Terraform Configuration Files

variable "test_cluster_name" { default = "test2" }
variable "test_cluster_machine_type" { default = "n1-standard-1" }
variable "test_cluster_disk_size_gb" { default = 10 }
variable "test_cluster_min_nodes" { default = 1 }
variable "test_cluster_max_nodes" { default = 16 }
variable "test_cluster_auto_repair" { default = true }
variable "test_cluster_dashboard_disabled" { default = true }
variable "test_cluster_master_version" { default = "1.9.3-gke.0" }
variable "test_cluster_node_version" { default = "1.9.3-gke.0" }
variable "test_cluster_oauth_scopes" {
  type = "list"
  default = [
    "https://www.googleapis.com/auth/devstorage.read_only",
    "https://www.googleapis.com/auth/logging.write",
    "https://www.googleapis.com/auth/monitoring",
    "https://www.googleapis.com/auth/servicecontrol",
    "https://www.googleapis.com/auth/service.management.readonly",
    "https://www.googleapis.com/auth/trace.append"
  ]
}

resource "random_id" "test_gke_username" {
  byte_length = "${var.password_length}"
}

resource "random_id" "test_gke_password" {
  byte_length = "${var.password_length}"
}

resource "google_container_cluster" "test" {
  name               = "${var.test_cluster_name}"
  zone               = "${var.zone}"
  min_master_version = "${var.test_cluster_master_version}"
  node_version       = "${var.test_cluster_node_version}"

  master_auth {
    username = "${random_id.test_gke_username.b64}"
    password = "${random_id.test_gke_username.b64}"
  }

  addons_config {
    kubernetes_dashboard {
      disabled = "${var.test_cluster_dashboard_disabled}"
    }
  }

  node_pool = [
    {
      name = "default-pool"
      node_config {
        machine_type       = "${var.test_cluster_machine_type}"
        disk_size_gb       = "${var.test_cluster_disk_size_gb}"
        oauth_scopes = "${var.test_cluster_oauth_scopes}"
      }
      autoscaling {
        min_node_count = "${var.test_cluster_min_nodes}"
        max_node_count = "${var.test_cluster_max_nodes}"
      }
      management {
        auto_repair = "${var.test_cluster_auto_repair}"
      }
    }
  ]
}

Expected Behavior

With the configuration above - notice that it doesn't specify initial_node_count in the embedded node_pool - a new cluster with a node pool of size 1 is created.

Actual Behavior

A node pool with size 0 is created:
screen shot 2018-03-07 at 20 56 16

The cluster is not auto-resized above size 0 even if non kube-system pods are deployed:
screen shot 2018-03-07 at 20 55 57

Steps to Reproduce

terraform apply the config included above

Workaround

I can fix the issue by specifying initial_node_count = 1 explicitly.
But according to google_container_cluster docs initial_node_count is deprecated and node_count should be used instead. Unfortunately, I cannot use node_count with autoscaling configuration as node_count always sets the cluster size to node_count value when the actual size has been modified by autoscaler - thus usage of autoscaling and node_count is mutually exclusive.

I am concerned that support for initial_node_count will be dropped and it won't be possible to workaround the issue I have (cluster created with size 0) just by specifying initial_node_count.

@pbzdyl
Copy link
Author

pbzdyl commented Mar 7, 2018

According to GKE API reference initialNodeCount is mandatory thus I think it shouldn't be deprecated in terraform-provider-google. It's value has to be within auto-scaling range.

If it's not present in tf configuration and auto-scaling is used then it could be defaulted to min_node_count.

@wmuizelaar
Copy link

I guess this is related to #844

@ghost
Copy link

ghost commented Mar 29, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants