Skip to content

Commit a551911

Browse files
committed
feat: Move default_compute_class_enabled to cluster_autoscaling block
Remove default_compute_class_enabled variable and update references to use cluster_autoscaling.enable_default_compute_class instead. This change simplifies the configuration by eliminating the need for a separate variable for enabling Spot VMs as the default compute class for Node Auto-Provisioning across multiple modules and documentation.
1 parent 0fde8c6 commit a551911

File tree

40 files changed

+20
-124
lines changed

40 files changed

+20
-124
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ 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 Spot VMs as the default compute class for Node Auto-Provisioning | `bool` | `null` | no |
164163
| default\_max\_pods\_per\_node | The maximum number of pods to schedule per node | `number` | `110` | no |
165164
| deletion\_protection | Whether or not to allow Terraform to destroy the cluster. | `bool` | `true` | no |
166165
| description | The description of the cluster | `string` | `""` | no |

autogen/main/cluster.tf.tmpl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ resource "google_container_cluster" "primary" {
156156

157157
cluster_autoscaling {
158158
enabled = var.cluster_autoscaling.enabled
159-
default_compute_class_enabled = var.default_compute_class_enabled
159+
default_compute_class_enabled = lookup(var.cluster_autoscaling, "enable_default_compute_class", false)
160160
dynamic "auto_provisioning_defaults" {
161161
for_each = var.cluster_autoscaling.enabled ? [1] : []
162162

@@ -206,7 +206,6 @@ resource "google_container_cluster" "primary" {
206206
}
207207
}
208208
autoscaling_profile = var.cluster_autoscaling.autoscaling_profile != null ? var.cluster_autoscaling.autoscaling_profile : "BALANCED"
209-
default_compute_class_enabled = lookup(var.cluster_autoscaling, "enable_default_compute_class", false)
210209
dynamic "resource_limits" {
211210
for_each = local.autoscaling_resource_limits
212211
content {
@@ -219,7 +218,7 @@ resource "google_container_cluster" "primary" {
219218
{% endif %}
220219
{% if autopilot_cluster == true %}
221220
cluster_autoscaling {
222-
default_compute_class_enabled = var.default_compute_class_enabled
221+
default_compute_class_enabled = lookup(var.cluster_autoscaling, "enable_default_compute_class", false)
223222
dynamic "auto_provisioning_defaults" {
224223
for_each = (var.create_service_account || var.service_account != "" || var.boot_disk_kms_key != null) ? [1] : []
225224

autogen/main/variables.tf.tmpl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -867,12 +867,6 @@ variable "enable_shielded_nodes" {
867867

868868
{% endif %}
869869

870-
variable "default_compute_class_enabled" {
871-
type = bool
872-
description = "Enable Spot VMs as the default compute class for Node Auto-Provisioning"
873-
default = null
874-
}
875-
876870
variable "enable_binary_authorization" {
877871
type = bool
878872
description = "Enable BinAuthZ Admission controller"

cluster.tf

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ resource "google_container_cluster" "primary" {
123123

124124
cluster_autoscaling {
125125
enabled = var.cluster_autoscaling.enabled
126-
default_compute_class_enabled = var.default_compute_class_enabled
126+
default_compute_class_enabled = lookup(var.cluster_autoscaling, "enable_default_compute_class", false)
127127
dynamic "auto_provisioning_defaults" {
128128
for_each = var.cluster_autoscaling.enabled ? [1] : []
129129

@@ -169,8 +169,7 @@ resource "google_container_cluster" "primary" {
169169
image_type = lookup(var.cluster_autoscaling, "image_type", "COS_CONTAINERD")
170170
}
171171
}
172-
autoscaling_profile = var.cluster_autoscaling.autoscaling_profile != null ? var.cluster_autoscaling.autoscaling_profile : "BALANCED"
173-
default_compute_class_enabled = lookup(var.cluster_autoscaling, "enable_default_compute_class", false)
172+
autoscaling_profile = var.cluster_autoscaling.autoscaling_profile != null ? var.cluster_autoscaling.autoscaling_profile : "BALANCED"
174173
dynamic "resource_limits" {
175174
for_each = local.autoscaling_resource_limits
176175
content {

metadata.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -655,9 +655,6 @@ spec:
655655
description: Enable Shielded Nodes features on all nodes in this cluster
656656
varType: bool
657657
defaultValue: true
658-
- name: default_compute_class_enabled
659-
description: Enable Spot VMs as the default compute class for Node Auto-Provisioning
660-
varType: bool
661658
- name: enable_binary_authorization
662659
description: Enable BinAuthZ Admission controller
663660
varType: bool

modules/beta-autopilot-private-cluster/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ Then perform the following commands on the root folder:
8686
| cluster\_resource\_labels | The GCE resource labels (a map of key/value pairs) to be applied to the cluster | `map(string)` | `{}` | no |
8787
| create\_service\_account | Defines if service account specified to run nodes should be created. | `bool` | `true` | no |
8888
| 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 |
89-
| default\_compute\_class\_enabled | Enable Spot VMs as the default compute class for Node Auto-Provisioning | `bool` | `null` | no |
9089
| deletion\_protection | Whether or not to allow Terraform to destroy the cluster. | `bool` | `true` | no |
9190
| deploy\_using\_private\_endpoint | A toggle for Terraform and kubectl to connect to the master's internal IP address during deployment. | `bool` | `false` | no |
9291
| description | The description of the cluster | `string` | `""` | no |

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 = var.default_compute_class_enabled
106+
default_compute_class_enabled = lookup(var.cluster_autoscaling, "enable_default_compute_class", false)
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-private-cluster/metadata.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -450,9 +450,6 @@ spec:
450450
defaultValue:
451451
- key_name: ""
452452
state: DECRYPTED
453-
- name: default_compute_class_enabled
454-
description: Enable Spot VMs as the default compute class for Node Auto-Provisioning
455-
varType: bool
456453
- name: enable_binary_authorization
457454
description: Enable BinAuthZ Admission controller
458455
varType: bool

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -537,12 +537,6 @@ variable "database_encryption" {
537537
}
538538

539539

540-
variable "default_compute_class_enabled" {
541-
type = bool
542-
description = "Enable Spot VMs as the default compute class for Node Auto-Provisioning"
543-
default = null
544-
}
545-
546540
variable "enable_binary_authorization" {
547541
type = bool
548542
description = "Enable BinAuthZ Admission controller"

modules/beta-autopilot-public-cluster/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ Then perform the following commands on the root folder:
8080
| cluster\_resource\_labels | The GCE resource labels (a map of key/value pairs) to be applied to the cluster | `map(string)` | `{}` | no |
8181
| create\_service\_account | Defines if service account specified to run nodes should be created. | `bool` | `true` | no |
8282
| 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 |
83-
| default\_compute\_class\_enabled | Enable Spot VMs as the default compute class for Node Auto-Provisioning | `bool` | `null` | no |
8483
| deletion\_protection | Whether or not to allow Terraform to destroy the cluster. | `bool` | `true` | no |
8584
| description | The description of the cluster | `string` | `""` | no |
8685
| disable\_default\_snat | Whether to disable the default SNAT to support the private use of public IP addresses | `bool` | `false` | no |

0 commit comments

Comments
 (0)