Skip to content

Commit

Permalink
Relax constraint around reservation and static nodesets with placement
Browse files Browse the repository at this point in the history
  • Loading branch information
mr0re1 committed Dec 7, 2024
1 parent 8b4d994 commit 6bb4318
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,6 @@ output "nodeset" {
error_message = "A disk_type=${var.disk_type} cannot be used with machine_type=${var.machine_type}."
}

precondition {
condition = var.reservation_name == "" || !var.enable_placement
error_message = <<-EOD
If a reservation is specified, `var.enable_placement` must be `false`.
If the specified reservation has a placement policy then it will be used automatically.
EOD
}

precondition {
condition = var.reservation_name == "" || length(var.zones) == 0
error_message = <<-EOD
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@
# limitations under the License.

locals {
non_static_ns_with_placement = [for ns in var.nodeset : ns.nodeset_name if ns.enable_placement && ns.node_count_static == 0]
use_static = [for ns in concat(var.nodeset, var.nodeset_tpu) : ns.nodeset_name if ns.node_count_static > 0]
uses_job_duration = length([for ns in var.nodeset : ns.dws_flex.use_job_duration if ns.dws_flex.use_job_duration]) > 0 ? true : false
use_static = [for ns in concat(var.nodeset, var.nodeset_tpu) : ns.nodeset_name if ns.node_count_static > 0]
uses_job_duration = length([for ns in var.nodeset : ns.dws_flex.use_job_duration if ns.dws_flex.use_job_duration]) > 0 ? true : false

has_node = length(var.nodeset) > 0
has_dyn = length(var.nodeset_dyn) > 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ output "partitions" {

value = [local.partition]

precondition {
condition = (length(local.non_static_ns_with_placement) == 0) || var.exclusive
error_message = "If any non-static nodesets has `enable_placement`, `var.exclusive` must be set true"
}

precondition {
condition = (length(local.use_static) == 0) || !var.exclusive
error_message = <<-EOD
Expand Down

0 comments on commit 6bb4318

Please sign in to comment.