Skip to content

Commit 3aa92db

Browse files
authored
Merge pull request #168 from sassoftware/staging
4.4.0 - April 20, 2023
2 parents 7582f89 + 3ee8d34 commit 3aa92db

File tree

6 files changed

+59
-4
lines changed

6 files changed

+59
-4
lines changed

.pre-commit-config_template.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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

docs/CONFIG-VARS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ The application of a Kubernetes version in GCP has some limitations when assigni
107107
| cluster_autoscaling_max_cpu_cores | MAX number of cores in the cluster | number | 500 | |
108108
| cluster_autoscaling_max_memory_gb | MAX number of gb of memory in the cluster | number | 10000 | |
109109
| 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** |
111111
| create_jump_vm | Create bastion host | bool | true | |
112112
| create_jump_public_ip | Add public ip to jump VM | bool | true | |
113113
| jump_vm_admin | OS Admin User for the Jump VM | string | "jumpuser" | |

locals.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ locals {
5555
vm_type = settings.vm_type
5656
node_taints = settings.accelerator_count > 0 ? concat(settings.node_taints, ["nvidia.com/gpu=present:NoSchedule"]) : settings.node_taints
5757
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
5859
}
5960
}
6061

@@ -70,6 +71,7 @@ locals {
7071
"accelerator_count" = 0
7172
"accelerator_type" = ""
7273
"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
7375
}
7476
})
7577

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ module "gke" {
141141
for nodepool, settings in local.node_pools : {
142142
name = nodepool
143143
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
145145
min_count = settings.min_nodes
146146
max_count = settings.max_nodes
147147
node_count = (settings.min_nodes == settings.max_nodes) ? settings.min_nodes : null

outputs.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ output "kube_config" {
1717
sensitive = true
1818
}
1919

20-
#postgres
20+
# postgres
2121
output "postgres_servers" {
2222
value = length(module.postgresql) != 0 ? local.postgres_outputs : null
2323
sensitive = true
@@ -90,7 +90,7 @@ output "nfs_admin_username" {
9090
value = var.storage_type == "standard" ? module.nfs_server.0.admin_username : null
9191
}
9292

93-
# Container regsitry
93+
# Container registry
9494
output "cr_endpoint" {
9595
value = var.enable_registry_access ? "https://gcr.io/${var.project}" : null
9696
}

variables.tf

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,13 @@ variable "default_nodepool_labels" {
196196
default = {}
197197
}
198198

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+
199206
variable "node_pools" {
200207
description = "Node pool definitions"
201208
type = map(object({
@@ -266,6 +273,22 @@ variable "node_pools" {
266273
}
267274
}
268275

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+
269292
variable "enable_cluster_autoscaling" {
270293
description = "Setting this value will enable cluster_autoscaling"
271294
type = bool

0 commit comments

Comments
 (0)