File tree Expand file tree Collapse file tree 6 files changed +59
-4
lines changed Expand file tree Collapse file tree 6 files changed +59
-4
lines changed Original file line number Diff line number Diff line change
1
+ # See https://pre-commit.com for more information
2
+ # See https://pre-commit.com/hooks.html for more hooks
3
+ repos :
4
+ - repo : meta
5
+ hooks :
6
+ - id : check-hooks-apply
7
+ - repo : local
8
+ hooks :
9
+ - id : hadolint-docker-file-entrypoint
10
+ name : hadolint
11
+ entry : docker.io/hadolint/hadolint /bin/hadolint
12
+ language : docker_image
13
+ types : [dockerfile]
14
+ - id : shellcheck-docker-file-entrypoint
15
+ name : shellcheck
16
+ entry : docker.io/koalaman/shellcheck
17
+ language : docker_image
18
+ types : [shell]
19
+ - id : tflint-locally-installed
20
+ name : tflint
21
+ entry : tflint
22
+ language : system
23
+ types : [terraform]
24
+ - repo : https://github.com/pre-commit/pre-commit-hooks
25
+ rev : v4.4.0
26
+ hooks :
27
+ - id : trailing-whitespace
28
+ - id : end-of-file-fixer
29
+ - id : check-added-large-files
30
+ - id : check-yaml
Original file line number Diff line number Diff line change @@ -107,7 +107,7 @@ The application of a Kubernetes version in GCP has some limitations when assigni
107
107
| cluster_autoscaling_max_cpu_cores | MAX number of cores in the cluster | number | 500 | |
108
108
| cluster_autoscaling_max_memory_gb | MAX number of gb of memory in the cluster | number | 10000 | |
109
109
| create_static_kubeconfig | Allows the user to create a provider / service account based kube config file | bool | true | A value of ` false ` will default to using the cloud providers mechanism for generating the kubeconfig file. A value of ` true ` will create a static kubeconfig which utilizes a ` Service Account ` and ` Cluster Role Binding ` to provide credentials. |
110
- | regional | Create a regional GKE control plane | bool | true | If false a zonal GKE control plane is created |
110
+ | regional | Create a regional GKE control plane | bool | true | If false a zonal GKE control plane is created. ** WARNING: changing this after cluster creation is destructive ** |
111
111
| create_jump_vm | Create bastion host | bool | true | |
112
112
| create_jump_public_ip | Add public ip to jump VM | bool | true | |
113
113
| jump_vm_admin | OS Admin User for the Jump VM | string | "jumpuser" | |
Original file line number Diff line number Diff line change @@ -55,6 +55,7 @@ locals {
55
55
vm_type = settings.vm_type
56
56
node_taints = settings.accelerator_count > 0 ? concat (settings. node_taints , [" nvidia.com/gpu=present:NoSchedule" ]) : settings.node_taints
57
57
initial_node_count = max (local. initial_node_count , settings. min_nodes )
58
+ node_locations = var.nodepools_locations != " " && var.nodepools_locations != null ? var.nodepools_locations : local.zone
58
59
}
59
60
}
60
61
@@ -70,6 +71,7 @@ locals {
70
71
" accelerator_count" = 0
71
72
" accelerator_type" = " "
72
73
" initial_node_count" = var.default_nodepool_min_nodes
74
+ " node_locations" = var.default_nodepool_locations != " " && var.default_nodepool_locations != null ? var.default_nodepool_locations : local.zone
73
75
}
74
76
})
75
77
Original file line number Diff line number Diff line change @@ -141,7 +141,7 @@ module "gke" {
141
141
for nodepool , settings in local . node_pools : {
142
142
name = nodepool
143
143
machine_type = settings . vm_type
144
- node_locations = local . zone # This must be a zone not a region. So var.location may not always work. ;)
144
+ node_locations = settings . node_locations
145
145
min_count = settings . min_nodes
146
146
max_count = settings . max_nodes
147
147
node_count = (settings. min_nodes == settings. max_nodes ) ? settings . min_nodes : null
Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ output "kube_config" {
17
17
sensitive = true
18
18
}
19
19
20
- # postgres
20
+ # postgres
21
21
output "postgres_servers" {
22
22
value = length (module. postgresql ) != 0 ? local. postgres_outputs : null
23
23
sensitive = true
@@ -90,7 +90,7 @@ output "nfs_admin_username" {
90
90
value = var. storage_type == " standard" ? module. nfs_server . 0 . admin_username : null
91
91
}
92
92
93
- # Container regsitry
93
+ # Container registry
94
94
output "cr_endpoint" {
95
95
value = var. enable_registry_access ? " https://gcr.io/${ var . project } " : null
96
96
}
Original file line number Diff line number Diff line change @@ -196,6 +196,13 @@ variable "default_nodepool_labels" {
196
196
default = {}
197
197
}
198
198
199
+ # Multi-zonal cluster support - Experimental - may change, use at your own risk
200
+ variable "default_nodepool_locations" {
201
+ description = " GCP zone(s) where the default nodepool will allocate nodes in. Comma separated list."
202
+ type = string
203
+ default = " "
204
+ }
205
+
199
206
variable "node_pools" {
200
207
description = " Node pool definitions"
201
208
type = map (object ({
@@ -266,6 +273,22 @@ variable "node_pools" {
266
273
}
267
274
}
268
275
276
+ # Multi-zonal cluster support - Experimental - may change, use at your own risk
277
+ # TODO - NOTE
278
+ # This was made external to the node_pools map variable since a requirement of terraform v1.0.0 (the minimum version
279
+ # we require, see versions.tf) is that for variables with nested fields, all attributes are required otherwise
280
+ # execution fails.
281
+ # In Terraform v1.3+ you can mark nested attributes as optional.
282
+ # Since this is an experimental change, at the moment I do no want to impose new requirements on existing users.
283
+ # Potentially we upgrade Terraform modules and versions and we bump our minimum required terraform version to be >1.3
284
+ # then at that time I can deprecate this variable and instead allow the user to configure node_locations per node pool.
285
+ # Refer to https://github.com/hashicorp/terraform/issues/29407#issuecomment-1150491619
286
+ variable "nodepools_locations" {
287
+ description = " GCP zone(s) where the additional node pools will allocate nodes in. Comma separated list."
288
+ type = string
289
+ default = " "
290
+ }
291
+
269
292
variable "enable_cluster_autoscaling" {
270
293
description = " Setting this value will enable cluster_autoscaling"
271
294
type = bool
You can’t perform that action at this time.
0 commit comments