Skip to content

Commit d380ab4

Browse files
authored
Merge branch 'main' into huge_pages
2 parents c629490 + 260be87 commit d380ab4

File tree

71 files changed

+928
-153
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+928
-153
lines changed

Diff for: CHANGELOG.md

+17
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
Extending the adopted spec, each change should have a link to its corresponding pull request appended.
88

9+
## [36.1.0](https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/compare/v36.0.2...v36.1.0) (2025-03-10)
10+
11+
12+
### Features
13+
14+
* add confidential nodes example ([#2227](https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/issues/2227)) ([2ae739b](https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/commit/2ae739be0e7a3f71c2e613260c096d46eeaebed7))
15+
* add enterprise config ([#2298](https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/issues/2298)) ([adaabbf](https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/commit/adaabbfbc2e6449719e19402f73886e906f45f86))
16+
* add node_affinity ([#2295](https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/issues/2295)) ([0e7a249](https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/commit/0e7a2493e74721cd3a8e946ba30248904b180825))
17+
* Add possibility to setup private nodes pool if global configuration is different ([#2290](https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/issues/2290)) ([aadc860](https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/commit/aadc8605be10db5d50b06b943573adb9df0d5dce))
18+
* Make autoscaling resource limits optional ([#2301](https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/issues/2301)) ([99fc4ce](https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/commit/99fc4ced63cde4793db69425e7126db1396a64f1))
19+
* workload_identity - add image pull secrets ([#2276](https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/issues/2276)) ([8d5c9a4](https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/commit/8d5c9a4c9e434438af86aca64fd58ee3f96ef3a4))
20+
21+
22+
### Bug Fixes
23+
24+
* network_config with just enable_private_nodes ([#2292](https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/issues/2292)) ([d49c3bf](https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/commit/d49c3bf156365c0bf8ba6525197cafd930e0da15))
25+
926
## [36.0.2](https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/compare/v36.0.1...v36.0.2) (2025-02-11)
1027

1128

Diff for: README.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ Then perform the following commands on the root folder:
145145
| additive\_vpc\_scope\_dns\_domain | This will enable Cloud DNS additive VPC scope. Must provide a domain name that is unique within the VPC. For this to work cluster\_dns = `CLOUD_DNS` and cluster\_dns\_scope = `CLUSTER_SCOPE` must both be set as well. | `string` | `""` | no |
146146
| authenticator\_security\_group | The name of the RBAC security group for use with Google security groups in Kubernetes RBAC. Group name must be in format [email protected] | `string` | `null` | no |
147147
| boot\_disk\_kms\_key | The Customer Managed Encryption Key used to encrypt the boot disk attached to each node in the node pool, if not overridden in `node_pools`. This should be of the form projects/[KEY\_PROJECT\_ID]/locations/[LOCATION]/keyRings/[RING\_NAME]/cryptoKeys/[KEY\_NAME]. For more information about protecting resources with Cloud KMS Keys please see: https://cloud.google.com/compute/docs/disks/customer-managed-encryption | `string` | `null` | no |
148-
| cluster\_autoscaling | Cluster autoscaling configuration. See [more details](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1beta1/projects.locations.clusters#clusterautoscaling) | <pre>object({<br> enabled = bool<br> autoscaling_profile = string<br> min_cpu_cores = number<br> max_cpu_cores = number<br> min_memory_gb = number<br> max_memory_gb = number<br> gpu_resources = list(object({ resource_type = string, minimum = number, maximum = number }))<br> auto_repair = bool<br> auto_upgrade = bool<br> disk_size = optional(number)<br> disk_type = optional(string)<br> image_type = optional(string)<br> strategy = optional(string)<br> max_surge = optional(number)<br> max_unavailable = optional(number)<br> node_pool_soak_duration = optional(string)<br> batch_soak_duration = optional(string)<br> batch_percentage = optional(number)<br> batch_node_count = optional(number)<br> enable_secure_boot = optional(bool, false)<br> enable_integrity_monitoring = optional(bool, true)<br> })</pre> | <pre>{<br> "auto_repair": true,<br> "auto_upgrade": true,<br> "autoscaling_profile": "BALANCED",<br> "disk_size": 100,<br> "disk_type": "pd-standard",<br> "enable_integrity_monitoring": true,<br> "enable_secure_boot": false,<br> "enabled": false,<br> "gpu_resources": [],<br> "image_type": "COS_CONTAINERD",<br> "max_cpu_cores": 0,<br> "max_memory_gb": 0,<br> "min_cpu_cores": 0,<br> "min_memory_gb": 0<br>}</pre> | no |
148+
| cluster\_autoscaling | Cluster autoscaling configuration. See [more details](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1beta1/projects.locations.clusters#clusterautoscaling) | <pre>object({<br> enabled = bool<br> autoscaling_profile = string<br> min_cpu_cores = optional(number)<br> max_cpu_cores = optional(number)<br> min_memory_gb = optional(number)<br> max_memory_gb = optional(number)<br> gpu_resources = list(object({ resource_type = string, minimum = number, maximum = number }))<br> auto_repair = bool<br> auto_upgrade = bool<br> disk_size = optional(number)<br> disk_type = optional(string)<br> image_type = optional(string)<br> strategy = optional(string)<br> max_surge = optional(number)<br> max_unavailable = optional(number)<br> node_pool_soak_duration = optional(string)<br> batch_soak_duration = optional(string)<br> batch_percentage = optional(number)<br> batch_node_count = optional(number)<br> enable_secure_boot = optional(bool, false)<br> enable_integrity_monitoring = optional(bool, true)<br> })</pre> | <pre>{<br> "auto_repair": true,<br> "auto_upgrade": true,<br> "autoscaling_profile": "BALANCED",<br> "disk_size": 100,<br> "disk_type": "pd-standard",<br> "enable_integrity_monitoring": true,<br> "enable_secure_boot": false,<br> "enabled": false,<br> "gpu_resources": [],<br> "image_type": "COS_CONTAINERD",<br> "max_cpu_cores": 0,<br> "max_memory_gb": 0,<br> "min_cpu_cores": 0,<br> "min_memory_gb": 0<br>}</pre> | no |
149149
| cluster\_dns\_domain | The suffix used for all cluster service records. | `string` | `""` | no |
150150
| cluster\_dns\_provider | Which in-cluster DNS provider should be used. PROVIDER\_UNSPECIFIED (default) or PLATFORM\_DEFAULT or CLOUD\_DNS. | `string` | `"PROVIDER_UNSPECIFIED"` | no |
151151
| cluster\_dns\_scope | The scope of access to cluster DNS records. DNS\_SCOPE\_UNSPECIFIED (default) or CLUSTER\_SCOPE or VPC\_SCOPE. | `string` | `"DNS_SCOPE_UNSPECIFIED"` | no |
@@ -161,6 +161,7 @@ Then perform the following commands on the root folder:
161161
| description | The description of the cluster | `string` | `""` | no |
162162
| disable\_default\_snat | Whether to disable the default SNAT to support the private use of public IP addresses | `bool` | `false` | no |
163163
| disable\_legacy\_metadata\_endpoints | Disable the /0.1/ and /v1beta1/ metadata server endpoints on the node. Changing this value will cause all node pools to be recreated. | `bool` | `true` | no |
164+
| dns\_allow\_external\_traffic | (Optional) Controls whether external traffic is allowed over the dns endpoint. | `bool` | `null` | no |
164165
| dns\_cache | The status of the NodeLocal DNSCache addon. | `bool` | `false` | no |
165166
| enable\_binary\_authorization | Enable BinAuthZ Admission controller | `bool` | `false` | no |
166167
| enable\_cilium\_clusterwide\_network\_policy | Enable Cilium Cluster Wide Network Policies on the cluster | `bool` | `false` | no |
@@ -180,6 +181,7 @@ Then perform the following commands on the root folder:
180181
| enable\_shielded\_nodes | Enable Shielded Nodes features on all nodes in this cluster | `bool` | `true` | no |
181182
| enable\_tpu | Enable Cloud TPU resources in the cluster. WARNING: changing this after cluster creation is destructive! | `bool` | `false` | no |
182183
| enable\_vertical\_pod\_autoscaling | Vertical Pod Autoscaling automatically adjusts the resources of pods controlled by it | `bool` | `false` | no |
184+
| enterprise\_config | (Optional) Enable or disable GKE enterprise. Valid values are STANDARD and ENTERPRISE. | `string` | `null` | no |
183185
| filestore\_csi\_driver | The status of the Filestore CSI driver addon, which allows the usage of filestore instance as volumes | `bool` | `false` | no |
184186
| firewall\_inbound\_ports | List of TCP ports for admission/webhook controllers. Either flag `add_master_webhook_firewall_rules` or `add_cluster_firewall_rules` (also adds egress rules) must be set to `true` for inbound-ports firewall rules to be applied. | `list(string)` | <pre>[<br> "8443",<br> "9443",<br> "15017"<br>]</pre> | no |
185187
| firewall\_priority | Priority rule for firewall rules | `number` | `1000` | no |
@@ -358,6 +360,7 @@ The node_pools variable takes the following parameters:
358360
| placement_policy | Placement type to set for nodes in a node pool. Can be set as [COMPACT](https://cloud.google.com/kubernetes-engine/docs/how-to/compact-placement#overview) if desired | | Optional |
359361
| pod_range | The name of the secondary range for pod IPs. | | Optional |
360362
| enable_private_nodes | Whether nodes have internal IP addresses only. | | Optional |
363+
| node_affinity | The node affinty in the format `"{\"key\": \"compute.googleapis.com/node-group-name\", \"operator\": \"IN\", \"values\": [\"node-group-name\"]}"`. | | Optional |
361364
| node_count | The number of nodes in the nodepool when autoscaling is false. Otherwise defaults to 1. Only valid for non-autoscaling clusters | | Required |
362365
| node_locations | The list of zones in which the cluster's nodes are located. Nodes must be in the region of their regional cluster or in the same region as their cluster's zone for zonal clusters. Defaults to cluster level node locations if nothing is specified | " " | Optional |
363366
| node_metadata | Options to expose the node metadata to the workload running on the node | | Optional |

Diff for: autogen/main/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ The node_pools variable takes the following parameters:
245245
{% if not private_cluster %}
246246
| enable_private_nodes | Whether nodes have internal IP addresses only. | | Optional |
247247
{% endif %}
248+
| node_affinity | The node affinty in the format `"{\"key\": \"compute.googleapis.com/node-group-name\", \"operator\": \"IN\", \"values\": [\"node-group-name\"]}"`. | | Optional |
248249
| node_count | The number of nodes in the nodepool when autoscaling is false. Otherwise defaults to 1. Only valid for non-autoscaling clusters | | Required |
249250
| node_locations | The list of zones in which the cluster's nodes are located. Nodes must be in the region of their regional cluster or in the same region as their cluster's zone for zonal clusters. Defaults to cluster level node locations if nothing is specified | " " | Optional |
250251
| node_metadata | Options to expose the node metadata to the workload running on the node | | Optional |

Diff for: autogen/main/cluster.tf.tmpl

+48-5
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,13 @@ resource "google_container_cluster" "primary" {
260260
}
261261
}
262262

263+
dynamic "enterprise_config" {
264+
for_each = var.enterprise_config != null ? [1] : []
265+
content {
266+
desired_tier = var.enterprise_config
267+
}
268+
}
269+
263270
enable_fqdn_network_policy = var.enable_fqdn_network_policy
264271
{% if autopilot_cluster %}
265272
enable_autopilot = true
@@ -529,6 +536,7 @@ resource "google_container_cluster" "primary" {
529536
machine_type = lookup(var.node_pools[0], "machine_type", "e2-medium")
530537
min_cpu_platform = lookup(var.node_pools[0], "min_cpu_platform", "")
531538
enable_confidential_storage = lookup(var.node_pools[0], "enable_confidential_storage", false)
539+
disk_type = lookup(var.node_pools[0], "disk_type", null)
532540
dynamic "gcfs_config" {
533541
for_each = lookup(var.node_pools[0], "enable_gcfs", null) != null ? [var.node_pools[0].enable_gcfs] : []
534542
content {
@@ -565,6 +573,21 @@ resource "google_container_cluster" "primary" {
565573
}
566574
}
567575

576+
dynamic "sole_tenant_config" {
577+
# node_affinity is currently the only member of sole_tenant_config
578+
for_each = lookup(var.node_pools[0], "node_affinity", null) != null ? [true] : []
579+
content {
580+
dynamic "node_affinity" {
581+
for_each = lookup(var.node_pools[0], "node_affinity", null) != null ? [lookup(var.node_pools[0], "node_affinity", null)] : []
582+
content {
583+
key = lookup(jsondecode(node_affinity.value), "key", null)
584+
operator = lookup(jsondecode(node_affinity.value), "operator", null)
585+
values = lookup(jsondecode(node_affinity.value), "values", [])
586+
}
587+
}
588+
}
589+
}
590+
568591
service_account = lookup(var.node_pools[0], "service_account", local.service_account)
569592

570593
tags = concat(
@@ -644,15 +667,20 @@ resource "google_container_cluster" "primary" {
644667
}
645668
}
646669

670+
{% endif %}
647671
dynamic "control_plane_endpoints_config" {
648-
for_each = var.enable_private_endpoint && var.deploy_using_private_endpoint ? [1] : []
672+
for_each = var.dns_allow_external_traffic != null {% if private_cluster %}|| (var.enable_private_endpoint && var.deploy_using_private_endpoint) {% endif %}? [1] : []
649673
content {
650674
dns_endpoint_config {
651-
allow_external_traffic = var.deploy_using_private_endpoint
675+
{% if private_cluster %}
676+
# TODO: Migrate to only dns_allow_external_traffic in next breaking release
677+
allow_external_traffic = var.dns_allow_external_traffic == true || var.deploy_using_private_endpoint
678+
{% else %}
679+
allow_external_traffic = var.dns_allow_external_traffic
680+
{% endif %}
652681
}
653682
}
654683
}
655-
{% endif %}
656684

657685
{% if autopilot_cluster != true %}
658686
remove_default_node_pool = var.remove_default_node_pool
@@ -876,11 +904,11 @@ resource "google_container_node_pool" "windows_pools" {
876904
}
877905

878906
dynamic "network_config" {
879-
for_each = length(lookup(each.value, "pod_range", "")) > 0 ? [each.value] : []
907+
for_each = length(lookup(each.value, "pod_range", "")) > 0 || lookup(each.value, "enable_private_nodes", null) != null ? [each.value] : []
880908
content {
881909
pod_range = lookup(network_config.value, "pod_range", null)
882910
{% if private_cluster %}
883-
enable_private_nodes = var.enable_private_nodes
911+
enable_private_nodes = lookup(network_config.value, "enable_private_nodes", var.enable_private_nodes)
884912
{% else %}
885913
enable_private_nodes = lookup(network_config.value, "enable_private_nodes", null)
886914
{% endif %}
@@ -1094,6 +1122,21 @@ resource "google_container_node_pool" "windows_pools" {
10941122
pod_pids_limit = lookup(each.value, "pod_pids_limit", null)
10951123
}
10961124
}
1125+
1126+
dynamic "sole_tenant_config" {
1127+
# node_affinity is currently the only member of sole_tenant_config
1128+
for_each = lookup(each.value, "node_affinity", null) != null ? [true] : []
1129+
content {
1130+
dynamic "node_affinity" {
1131+
for_each = lookup(each.value, "node_affinity", null) != null ? [lookup(each.value, "node_affinity", null)] : []
1132+
content {
1133+
key = lookup(jsondecode(node_affinity.value), "key", null)
1134+
operator = lookup(jsondecode(node_affinity.value), "operator", null)
1135+
values = lookup(jsondecode(node_affinity.value), "values", [])
1136+
}
1137+
}
1138+
}
1139+
}
10971140
{% if beta_cluster %}
10981141

10991142
dynamic "sandbox_config" {

Diff for: autogen/main/variables.tf.tmpl

+20-4
Original file line numberDiff line numberDiff line change
@@ -300,10 +300,10 @@ variable "cluster_autoscaling" {
300300
type = object({
301301
enabled = bool
302302
autoscaling_profile = string
303-
min_cpu_cores = number
304-
max_cpu_cores = number
305-
min_memory_gb = number
306-
max_memory_gb = number
303+
min_cpu_cores = optional(number)
304+
max_cpu_cores = optional(number)
305+
min_memory_gb = optional(number)
306+
max_memory_gb = optional(number)
307307
gpu_resources = list(object({ resource_type = string, minimum = number, maximum = number }))
308308
auto_repair = bool
309309
auto_upgrade = bool
@@ -1059,3 +1059,19 @@ variable "monitoring_metric_writer_role" {
10591059
error_message = "The monitoring_metric_writer_role must be either a predefined role (roles/*) or a custom role (projects/*/roles/*)."
10601060
}
10611061
}
1062+
1063+
variable "enterprise_config" {
1064+
description = "(Optional) Enable or disable GKE enterprise. Valid values are STANDARD and ENTERPRISE."
1065+
type = string
1066+
default = null
1067+
validation {
1068+
condition = var.enterprise_config == null ? true : contains(["STANDARD", "ENTERPRISE"], var.enterprise_config)
1069+
error_message = "The enterprise_config variable must be either null, STANDARD, or ENTERPRISE."
1070+
}
1071+
}
1072+
1073+
variable "dns_allow_external_traffic" {
1074+
description = "(Optional) Controls whether external traffic is allowed over the dns endpoint."
1075+
type = bool
1076+
default = null
1077+
}

Diff for: autogen/main/versions.tf.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,6 @@ terraform {
6363
}
6464
}
6565
provider_meta "{% if beta_cluster %}google-beta{% else %}google{% endif %}" {
66-
module_name = "blueprints/terraform/terraform-google-kubernetes-engine{% if module_registry_name %}:{{ module_registry_name }}{% endif %}/v36.0.2"
66+
module_name = "blueprints/terraform/terraform-google-kubernetes-engine{% if module_registry_name %}:{{ module_registry_name }}{% endif %}/v36.1.0"
6767
}
6868
}

Diff for: autogen/safer-cluster/main.tf.tmpl

+4-2
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,10 @@ module "gke" {
107107
logging_service = var.logging_service
108108
monitoring_service = var.monitoring_service
109109

110-
monitoring_enable_managed_prometheus = var.monitoring_enable_managed_prometheus
111-
monitoring_enabled_components = var.monitoring_enabled_components
110+
monitoring_enable_managed_prometheus = var.monitoring_enable_managed_prometheus
111+
monitoring_enable_observability_metrics = var.monitoring_enable_observability_metrics
112+
monitoring_enable_observability_relay = var.monitoring_enable_observability_relay
113+
monitoring_enabled_components = var.monitoring_enabled_components
112114

113115
enable_confidential_nodes = var.enable_confidential_nodes
114116

Diff for: autogen/safer-cluster/variables.tf.tmpl

+12
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,18 @@ variable "monitoring_enable_managed_prometheus" {
280280
default = false
281281
}
282282

283+
variable "monitoring_enable_observability_metrics" {
284+
type = bool
285+
description = "Whether or not the advanced datapath metrics are enabled."
286+
default = false
287+
}
288+
289+
variable "monitoring_enable_observability_relay" {
290+
type = bool
291+
description = "Whether or not the advanced datapath relay is enabled."
292+
default = false
293+
}
294+
283295
variable "monitoring_enabled_components" {
284296
type = list(string)
285297
description = "List of services to monitor: SYSTEM_COMPONENTS, WORKLOADS. Empty list is default GKE configuration."

Diff for: autogen/safer-cluster/versions.tf.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ terraform {
2323
required_version = ">=1.3"
2424

2525
provider_meta "google-beta" {
26-
module_name = "blueprints/terraform/terraform-google-kubernetes-engine{% if module_registry_name %}:{{ module_registry_name }}{% endif %}/v36.0.2"
26+
module_name = "blueprints/terraform/terraform-google-kubernetes-engine{% if module_registry_name %}:{{ module_registry_name }}{% endif %}/v36.1.0"
2727
}
2828
}

0 commit comments

Comments
 (0)