Skip to content

Commit 0308f34

Browse files
authored
Merge pull request #297 from kbst/gke-node-pool-location-policy
GKE: Add location policy required from v1.24.1
2 parents 10f2001 + 2c452f4 commit 0308f34

File tree

9 files changed

+26
-9
lines changed

9 files changed

+26
-9
lines changed

google/_modules/gke/node_pool.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ module "node_pool" {
1616
initial_node_count = var.initial_node_count
1717
min_node_count = var.min_node_count
1818
max_node_count = var.max_node_count
19+
location_policy = var.location_policy
1920

2021
extra_oauth_scopes = var.extra_oauth_scopes
2122

google/_modules/gke/node_pool/main.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ resource "google_container_node_pool" "current" {
77
initial_node_count = var.initial_node_count
88

99
autoscaling {
10-
min_node_count = var.min_node_count
11-
max_node_count = var.max_node_count
10+
min_node_count = var.min_node_count
11+
max_node_count = var.max_node_count
12+
location_policy = var.location_policy
1213
}
1314

1415
node_locations = var.node_locations

google/_modules/gke/node_pool/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ variable "max_node_count" {
4343
type = string
4444
}
4545

46+
variable "location_policy" {
47+
type = string
48+
description = "Location policy specifies the algorithm used when scaling-up the node pool."
49+
}
50+
4651
variable "service_account_email" {
4752
description = "The service account email to use for this node pool."
4853
type = string

google/_modules/gke/variables.tf

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ variable "location" {
2828
description = "Location accepts a region or zone and starts a regional or zonal cluster respectively. Kubestack is only supported for regional clusters."
2929
}
3030

31-
variable "node_locations" {
32-
type = list(string)
33-
description = "List of zones in the cluster's region to start worker nodes in."
31+
variable "location_policy" {
32+
type = string
33+
description = "Location policy specifies the algorithm used when scaling-up the node pool."
3434
}
3535

3636
variable "min_master_version" {
@@ -63,6 +63,11 @@ variable "max_node_count" {
6363
type = string
6464
}
6565

66+
variable "node_locations" {
67+
type = list(string)
68+
description = "List of zones in the cluster's region to start worker nodes in."
69+
}
70+
6671
variable "extra_oauth_scopes" {
6772
description = "List of additional oauth scopes for workers."
6873
type = list(string)

google/cluster/configuration.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ locals {
3232

3333
cluster_initial_node_count = lookup(local.cfg, "cluster_initial_node_count", 1)
3434

35-
cluster_min_node_count = lookup(local.cfg, "cluster_min_node_count", 1)
36-
cluster_max_node_count = lookup(local.cfg, "cluster_max_node_count", 1)
35+
cluster_min_node_count = lookup(local.cfg, "cluster_min_node_count", 1)
36+
cluster_max_node_count = lookup(local.cfg, "cluster_max_node_count", 1)
37+
cluster_node_location_policy = lookup(local.cfg, "cluster_node_location_policy", null)
3738

3839
cluster_extra_oauth_scopes_lookup = lookup(local.cfg, "cluster_extra_oauth_scopes", "")
3940
cluster_extra_oauth_scopes = split(",", local.cluster_extra_oauth_scopes_lookup)

google/cluster/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ module "cluster" {
3030
initial_node_count = local.cluster_initial_node_count
3131
min_node_count = local.cluster_min_node_count
3232
max_node_count = local.cluster_max_node_count
33+
location_policy = local.cluster_node_location_policy
3334

3435
extra_oauth_scopes = local.cluster_extra_oauth_scopes
3536

google/cluster/node-pool/configuration.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ locals {
1919
initial_node_count = local.cfg["initial_node_count"]
2020
min_node_count = local.cfg["min_node_count"]
2121
max_node_count = local.cfg["max_node_count"]
22+
location_policy = local.cfg["location_policy"] != null ? local.cfg["location_policy"] : "BALANCED"
2223

2324
disk_size_gb = local.cfg["disk_size_gb"]
2425
disk_type = local.cfg["disk_type"]

google/cluster/node-pool/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ module "node_pool" {
1515
initial_node_count = local.initial_node_count
1616
min_node_count = local.min_node_count
1717
max_node_count = local.max_node_count
18+
location_policy = local.location_policy
1819

1920
extra_oauth_scopes = local.extra_oauth_scopes
2021

google/cluster/node-pool/variables.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ variable "configuration" {
44

55
name = optional(string)
66

7-
location = optional(string)
8-
node_locations = optional(list(string))
7+
location = optional(string)
8+
node_locations = optional(list(string))
9+
location_policy = optional(string)
910

1011
initial_node_count = optional(string)
1112
min_node_count = optional(string)

0 commit comments

Comments
 (0)