Skip to content

Commit db5d854

Browse files
authored
Merge pull request #4492 from GoogleCloudPlatform/revert-4372-validations
Revert "Added capacity checks for reservations"
2 parents 0b3b9dd + c31175e commit db5d854

File tree

2 files changed

+0
-23
lines changed

2 files changed

+0
-23
lines changed

modules/compute/gke-node-pool/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,6 @@ limitations under the License.
305305
| [null_resource.enable_tcpxo_in_workload](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource |
306306
| [null_resource.install_dependencies](https://registry.terraform.io/providers/hashicorp/null/latest/docs/resources/resource) | resource |
307307
| [google_compute_machine_types.machine_info](https://registry.terraform.io/providers/hashicorp/google/latest/docs/data-sources/compute_machine_types) | data source |
308-
| [google_compute_reservation.specific](https://registry.terraform.io/providers/hashicorp/google/latest/docs/data-sources/compute_reservation) | data source |
309308
| [google_compute_reservation.specific_reservations](https://registry.terraform.io/providers/hashicorp/google/latest/docs/data-sources/compute_reservation) | data source |
310309
| [google_container_cluster.gke_cluster](https://registry.terraform.io/providers/hashicorp/google/latest/docs/data-sources/container_cluster) | data source |
311310

modules/compute/gke-node-pool/main.tf

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -67,20 +67,6 @@ data "google_container_cluster" "gke_cluster" {
6767
location = local.cluster_location
6868
}
6969

70-
data "google_compute_reservation" "specific" {
71-
count = local.input_specific_reservations_count == 1 ? 1 : 0
72-
project = var.project_id
73-
zone = var.zones[0]
74-
name = var.reservation_affinity.specific_reservations[0].name
75-
}
76-
77-
locals {
78-
reservation_available_count = (local.input_specific_reservations_count == 1) ? (
79-
try(data.google_compute_reservation.specific[0].specific_reservation[0].count, 0) -
80-
try(data.google_compute_reservation.specific[0].specific_reservation[0].in_use_count, 0)
81-
) : 0
82-
}
83-
8470
resource "google_container_node_pool" "node_pool" {
8571
provider = google
8672

@@ -393,14 +379,6 @@ resource "google_container_node_pool" "node_pool" {
393379
condition = var.enable_flex_start == true ? (var.spot == false) : true
394380
error_message = "Both enable_flex_start and spot consumption option cannot be set to true at the same time."
395381
}
396-
precondition {
397-
condition = var.reservation_affinity.consume_reservation_type != "SPECIFIC_RESERVATION" || (var.static_node_count != null && var.static_node_count <= local.reservation_available_count)
398-
error_message = "Requested static_node_count (${coalesce(var.static_node_count, "not set")}) exceeds the available reservation capacity (${local.reservation_available_count})."
399-
}
400-
precondition {
401-
condition = local.input_specific_reservations_count == 1 || var.reservation_affinity.consume_reservation_type != "SPECIFIC_RESERVATION"
402-
error_message = "Exactly one reservation must be specified when using SPECIFIC_RESERVATION."
403-
}
404382
}
405383
}
406384

0 commit comments

Comments
 (0)