Skip to content

Commit 36e2adb

Browse files
committed
feat: add default_compute_class_enabled variable for autopilot
This change introduces the default_compute_class_enabled variable to enable default compute class for Node Auto-Provisioning. This allows users to configure the compute class more flexibly when setting up their Kubernetes clusters.
1 parent a551911 commit 36e2adb

File tree

27 files changed

+81
-5
lines changed

27 files changed

+81
-5
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ Then perform the following commands on the root folder:
160160
| create\_service\_account | Defines if service account specified to run nodes should be created. | `bool` | `true` | no |
161161
| database\_encryption | Application-layer Secrets Encryption settings. The object format is {state = string, key\_name = string}. Valid values of state are: "ENCRYPTED"; "DECRYPTED". key\_name is the name of a CloudKMS key. | `list(object({ state = string, key_name = string }))` | <pre>[<br> {<br> "key_name": "",<br> "state": "DECRYPTED"<br> }<br>]</pre> | no |
162162
| datapath\_provider | The desired datapath provider for this cluster. By default, `DATAPATH_PROVIDER_UNSPECIFIED` enables the IPTables-based kube-proxy implementation. `ADVANCED_DATAPATH` enables Dataplane-V2 feature. | `string` | `"DATAPATH_PROVIDER_UNSPECIFIED"` | no |
163+
| default\_compute\_class\_enabled | Enable default compute class for Node Auto-Provisioning | `bool` | `null` | no |
163164
| default\_max\_pods\_per\_node | The maximum number of pods to schedule per node | `number` | `110` | no |
164165
| deletion\_protection | Whether or not to allow Terraform to destroy the cluster. | `bool` | `true` | no |
165166
| description | The description of the cluster | `string` | `""` | no |

autogen/main/cluster.tf.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ resource "google_container_cluster" "primary" {
218218
{% endif %}
219219
{% if autopilot_cluster == true %}
220220
cluster_autoscaling {
221-
default_compute_class_enabled = lookup(var.cluster_autoscaling, "enable_default_compute_class", false)
221+
default_compute_class_enabled = var.default_compute_class_enabled
222222
dynamic "auto_provisioning_defaults" {
223223
for_each = (var.create_service_account || var.service_account != "" || var.boot_disk_kms_key != null) ? [1] : []
224224

autogen/main/variables.tf.tmpl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,12 @@ variable "cluster_autoscaling" {
367367
description = "Cluster autoscaling configuration. See [more details](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1beta1/projects.locations.clusters#clusterautoscaling)"
368368
}
369369

370+
variable "default_compute_class_enabled" {
371+
type = bool
372+
description = "Enable default compute class for Node Auto-Provisioning"
373+
default = null
374+
}
375+
370376
variable "node_pools_taints" {
371377
type = map(list(object({ key = string, value = string, effect = string })))
372378
description = "Map of lists containing node taints by node-pool name"

metadata.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,9 @@ spec:
386386
max_memory_gb: 0
387387
min_cpu_cores: 0
388388
min_memory_gb: 0
389+
- name: default_compute_class_enabled
390+
description: Enable default compute class for Node Auto-Provisioning
391+
varType: bool
389392
- name: node_pools_taints
390393
description: Map of lists containing node taints by node-pool name
391394
varType: map(list(object({ key = string, value = string, effect = string })))

modules/beta-autopilot-private-cluster/cluster.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ resource "google_container_cluster" "primary" {
103103
}
104104

105105
cluster_autoscaling {
106-
default_compute_class_enabled = lookup(var.cluster_autoscaling, "enable_default_compute_class", false)
106+
default_compute_class_enabled = var.default_compute_class_enabled
107107
dynamic "auto_provisioning_defaults" {
108108
for_each = (var.create_service_account || var.service_account != "" || var.boot_disk_kms_key != null) ? [1] : []
109109

modules/beta-autopilot-public-cluster/cluster.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ resource "google_container_cluster" "primary" {
103103
}
104104

105105
cluster_autoscaling {
106-
default_compute_class_enabled = lookup(var.cluster_autoscaling, "enable_default_compute_class", false)
106+
default_compute_class_enabled = var.default_compute_class_enabled
107107
dynamic "auto_provisioning_defaults" {
108108
for_each = (var.create_service_account || var.service_account != "" || var.boot_disk_kms_key != null) ? [1] : []
109109

modules/beta-private-cluster-update-variant/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ Then perform the following commands on the root folder:
194194
| create\_service\_account | Defines if service account specified to run nodes should be created. | `bool` | `true` | no |
195195
| database\_encryption | Application-layer Secrets Encryption settings. The object format is {state = string, key\_name = string}. Valid values of state are: "ENCRYPTED"; "DECRYPTED". key\_name is the name of a CloudKMS key. | `list(object({ state = string, key_name = string }))` | <pre>[<br> {<br> "key_name": "",<br> "state": "DECRYPTED"<br> }<br>]</pre> | no |
196196
| datapath\_provider | The desired datapath provider for this cluster. By default, `DATAPATH_PROVIDER_UNSPECIFIED` enables the IPTables-based kube-proxy implementation. `ADVANCED_DATAPATH` enables Dataplane-V2 feature. | `string` | `"DATAPATH_PROVIDER_UNSPECIFIED"` | no |
197+
| default\_compute\_class\_enabled | Enable default compute class for Node Auto-Provisioning | `bool` | `null` | no |
197198
| default\_max\_pods\_per\_node | The maximum number of pods to schedule per node | `number` | `110` | no |
198199
| deletion\_protection | Whether or not to allow Terraform to destroy the cluster. | `bool` | `true` | no |
199200
| deploy\_using\_private\_endpoint | A toggle for Terraform and kubectl to connect to the master's internal IP address during deployment. | `bool` | `false` | no |

modules/beta-private-cluster-update-variant/metadata.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,9 @@ spec:
346346
max_memory_gb: 0
347347
min_cpu_cores: 0
348348
min_memory_gb: 0
349+
- name: default_compute_class_enabled
350+
description: Enable default compute class for Node Auto-Provisioning
351+
varType: bool
349352
- name: node_pools_taints
350353
description: Map of lists containing node taints by node-pool name
351354
varType: map(list(object({ key = string, value = string, effect = string })))

modules/beta-private-cluster-update-variant/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,12 @@ variable "cluster_autoscaling" {
345345
description = "Cluster autoscaling configuration. See [more details](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1beta1/projects.locations.clusters#clusterautoscaling)"
346346
}
347347

348+
variable "default_compute_class_enabled" {
349+
type = bool
350+
description = "Enable default compute class for Node Auto-Provisioning"
351+
default = null
352+
}
353+
348354
variable "node_pools_taints" {
349355
type = map(list(object({ key = string, value = string, effect = string })))
350356
description = "Map of lists containing node taints by node-pool name"

modules/beta-private-cluster/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ Then perform the following commands on the root folder:
172172
| create\_service\_account | Defines if service account specified to run nodes should be created. | `bool` | `true` | no |
173173
| database\_encryption | Application-layer Secrets Encryption settings. The object format is {state = string, key\_name = string}. Valid values of state are: "ENCRYPTED"; "DECRYPTED". key\_name is the name of a CloudKMS key. | `list(object({ state = string, key_name = string }))` | <pre>[<br> {<br> "key_name": "",<br> "state": "DECRYPTED"<br> }<br>]</pre> | no |
174174
| datapath\_provider | The desired datapath provider for this cluster. By default, `DATAPATH_PROVIDER_UNSPECIFIED` enables the IPTables-based kube-proxy implementation. `ADVANCED_DATAPATH` enables Dataplane-V2 feature. | `string` | `"DATAPATH_PROVIDER_UNSPECIFIED"` | no |
175+
| default\_compute\_class\_enabled | Enable default compute class for Node Auto-Provisioning | `bool` | `null` | no |
175176
| default\_max\_pods\_per\_node | The maximum number of pods to schedule per node | `number` | `110` | no |
176177
| deletion\_protection | Whether or not to allow Terraform to destroy the cluster. | `bool` | `true` | no |
177178
| deploy\_using\_private\_endpoint | A toggle for Terraform and kubectl to connect to the master's internal IP address during deployment. | `bool` | `false` | no |

0 commit comments

Comments
 (0)