Skip to content

Commit 054a458

Browse files
committed
Ensure node-pool example node count < 6
When GKE stands up a cluster with more than 6 nodes in the node pool, it will automatically resize the master node. This causes the cluster to enter reconciling, which fouls up our CI configuration. This commit sidesteps this problem by converting the node-pool example to a zonal pool, removing the default node pool and shrinking the max size of the added node pools. We can add graceful handling of cluster reconciliation in a followup PR.
1 parent a7cedfb commit 054a458

File tree

3 files changed

+18
-8
lines changed

3 files changed

+18
-8
lines changed

examples/node_pool/main.tf

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,23 @@ provider "google" {
2525
}
2626

2727
module "gke" {
28-
source = "../../"
29-
project_id = "${var.project_id}"
30-
name = "${local.cluster_type}-cluster${var.cluster_name_suffix}"
31-
region = "${var.region}"
32-
network = "${var.network}"
33-
subnetwork = "${var.subnetwork}"
34-
ip_range_pods = "${var.ip_range_pods}"
35-
ip_range_services = "${var.ip_range_services}"
28+
source = "../../"
29+
project_id = "${var.project_id}"
30+
name = "${local.cluster_type}-cluster${var.cluster_name_suffix}"
31+
regional = "false"
32+
region = "${var.region}"
33+
zones = "${var.zones}"
34+
network = "${var.network}"
35+
subnetwork = "${var.subnetwork}"
36+
ip_range_pods = "${var.ip_range_pods}"
37+
ip_range_services = "${var.ip_range_services}"
38+
remove_default_node_pool = "true"
3639

3740
node_pools = [
3841
{
3942
name = "pool-01"
4043
min_count = 1
44+
max_count = 2
4145
service_account = "${var.compute_engine_service_account}"
4246
},
4347
{

examples/node_pool/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ variable "region" {
3131
description = "The region to host the cluster in"
3232
}
3333

34+
variable "zones" {
35+
type = "list"
36+
description = "The zone to host the cluster in (required if is a zonal cluster)"
37+
}
38+
3439
variable "network" {
3540
description = "The VPC network to host the cluster in"
3641
}

test/fixtures/node_pool/example.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ module "example" {
2121
credentials_path = "${local.credentials_path}"
2222
cluster_name_suffix = "-${random_string.suffix.result}"
2323
region = "${var.region}"
24+
zones = ["${slice(var.zones,0,1)}"]
2425
network = "${google_compute_network.main.name}"
2526
subnetwork = "${google_compute_subnetwork.main.name}"
2627
ip_range_pods = "${google_compute_subnetwork.main.secondary_ip_range.0.range_name}"

0 commit comments

Comments
 (0)