Skip to content

Commit b61584c

Browse files
authored
feat(TPG>=7.0)!: adding default_compute_class_enabled (#2434)
1 parent 3a1945f commit b61584c

Some content is hidden

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

60 files changed

+193
-49
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ Then perform the following commands on the root folder:
159159
| create\_service\_account | Defines if service account specified to run nodes should be created. | `bool` | `true` | no |
160160
| 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 |
161161
| 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 |
162+
| default\_compute\_class\_enabled | Enable Spot VMs as the default compute class for Node Auto-Provisioning | `bool` | `null` | no |
162163
| default\_max\_pods\_per\_node | The maximum number of pods to schedule per node | `number` | `110` | no |
163164
| deletion\_protection | Whether or not to allow Terraform to destroy the cluster. | `bool` | `true` | no |
164165
| description | The description of the cluster | `string` | `""` | no |

autogen/main/cluster.tf.tmpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +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
159160
dynamic "auto_provisioning_defaults" {
160161
for_each = var.cluster_autoscaling.enabled ? [1] : []
161162

@@ -217,6 +218,7 @@ resource "google_container_cluster" "primary" {
217218
{% endif %}
218219
{% if autopilot_cluster == true %}
219220
cluster_autoscaling {
221+
default_compute_class_enabled = var.default_compute_class_enabled
220222
dynamic "auto_provisioning_defaults" {
221223
for_each = (var.create_service_account || var.service_account != "" || var.boot_disk_kms_key != null) ? [1] : []
222224

autogen/main/variables.tf.tmpl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -858,6 +858,13 @@ variable "enable_shielded_nodes" {
858858
}
859859

860860
{% endif %}
861+
862+
variable "default_compute_class_enabled" {
863+
type = bool
864+
description = "Enable Spot VMs as the default compute class for Node Auto-Provisioning"
865+
default = null
866+
}
867+
861868
variable "enable_binary_authorization" {
862869
type = bool
863870
description = "Enable BinAuthZ Admission controller"

autogen/main/versions.tf.tmpl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,33 +24,33 @@ terraform {
2424
required_providers {
2525
google = {
2626
source = "hashicorp/google"
27-
version = ">= 6.47.0, < 8"
27+
version = ">= 7.0.0, < 8"
2828
}
2929
google-beta = {
3030
source = "hashicorp/google-beta"
31-
version = ">= 6.47.0, < 8"
31+
version = ">= 7.0.0, < 8"
3232
}
3333
{% elif beta_cluster and autopilot_cluster %}
3434
required_providers {
3535
google = {
3636
source = "hashicorp/google"
37-
version = ">= 6.47.0, < 8"
37+
version = ">= 7.0.0, < 8"
3838
}
3939
google-beta = {
4040
source = "hashicorp/google-beta"
41-
version = ">= 6.47.0, < 8"
41+
version = ">= 7.0.0, < 8"
4242
}
4343
{% elif autopilot_cluster %}
4444
required_providers {
4545
google = {
4646
source = "hashicorp/google"
47-
version = ">= 6.47.0, < 8"
47+
version = ">= 7.0.0, < 8"
4848
}
4949
{% else %}
5050
required_providers {
5151
google = {
5252
source = "hashicorp/google"
53-
version = ">= 6.47.0, < 8"
53+
version = ">= 7.0.0, < 8"
5454
}
5555
{% endif %}
5656
kubernetes = {

cluster.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ resource "google_container_cluster" "primary" {
122122
monitoring_service = local.logmon_config_is_set ? null : var.monitoring_service
123123

124124
cluster_autoscaling {
125-
enabled = var.cluster_autoscaling.enabled
125+
enabled = var.cluster_autoscaling.enabled
126+
default_compute_class_enabled = var.default_compute_class_enabled
126127
dynamic "auto_provisioning_defaults" {
127128
for_each = var.cluster_autoscaling.enabled ? [1] : []
128129

examples/simple_fleet_app_operator_permissions/versions.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ terraform {
2020
required_providers {
2121
google = {
2222
source = "hashicorp/google"
23-
version = ">= 6.39.0"
23+
version = ">= 7.0.0"
2424
}
2525
google-beta = {
2626
source = "hashicorp/google-beta"
27-
version = ">= 6.39.0"
27+
version = ">= 7.0.0"
2828
}
2929
}
3030
}

metadata.display.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ spec:
8787
datapath_provider:
8888
name: datapath_provider
8989
title: Datapath Provider
90+
default_compute_class_enabled:
91+
name: default_compute_class_enabled
92+
title: Default Compute Class Enabled
9093
default_max_pods_per_node:
9194
name: default_max_pods_per_node
9295
title: Default Max Pods Per Node

metadata.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,9 @@ spec:
650650
description: Enable Shielded Nodes features on all nodes in this cluster
651651
varType: bool
652652
defaultValue: true
653+
- name: default_compute_class_enabled
654+
description: Enable Spot VMs as the default compute class for Node Auto-Provisioning
655+
varType: bool
653656
- name: enable_binary_authorization
654657
description: Enable BinAuthZ Admission controller
655658
varType: bool
@@ -855,7 +858,7 @@ spec:
855858
- roles/editor
856859
providerVersions:
857860
- source: hashicorp/google
858-
version: ">= 6.47.0, < 8"
861+
version: ">= 7.0.0, < 8"
859862
- source: hashicorp/kubernetes
860863
version: ~> 2.10
861864
- source: hashicorp/random

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

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

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

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

105105
cluster_autoscaling {
106+
default_compute_class_enabled = var.default_compute_class_enabled
106107
dynamic "auto_provisioning_defaults" {
107108
for_each = (var.create_service_account || var.service_account != "" || var.boot_disk_kms_key != null) ? [1] : []
108109

0 commit comments

Comments
 (0)