Skip to content

Commit c177189

Browse files
committed
fix: Unspecified default placement FDs when mode != virtual-node-pool
Signed-off-by: Devon Crouse <[email protected]>
1 parent e8dfa76 commit c177189

File tree

6 files changed

+11
-23
lines changed

6 files changed

+11
-23
lines changed

modules/workers/instance.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
resource "oci_core_instance" "workers" {
22
for_each = local.enabled_instances
33
availability_domain = element(each.value.availability_domains, 1)
4+
fault_domain = try(each.value.placement_fds[0], null)
45
compartment_id = each.value.compartment_id
56
display_name = each.key
67
preserve_boot_volume = false

modules/workers/instanceconfig.tf

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,8 @@ resource "oci_core_instance_configuration" "workers" {
1515
launch_details {
1616
availability_domain = element(each.value.availability_domains, 1)
1717

18-
# Intersect the list of available and configured FDs for this AD, selecting the first
19-
fault_domain = element(tolist(setintersection(
20-
each.value.placement_fds,
21-
lookup(
22-
local.fault_domains_available,
23-
element(each.value.availability_domains, 1),
24-
each.value.placement_fds
25-
)
26-
)), 1)
18+
# First value specified on pool, or null to select automatically
19+
fault_domain = try(each.value.placement_fds[0], null)
2720

2821
compartment_id = each.value.compartment_id
2922
defined_tags = each.value.defined_tags

modules/workers/instancepools.tf

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,8 @@ resource "oci_core_instance_pool" "workers" {
2020
availability_domain = ad.value
2121
primary_subnet_id = each.value.subnet_id
2222

23-
# Intersect the list of available and configured FDs for this AD
24-
fault_domains = tolist(setintersection(
25-
each.value.placement_fds,
26-
lookup(local.fault_domains_available, ad.value, local.fault_domains_default)
27-
))
23+
# Value(s) specified on pool, or null to select automatically
24+
fault_domains = try(each.value.placement_fds, null)
2825

2926
dynamic "secondary_vnic_subnets" {
3027
for_each = lookup(each.value, "secondary_vnics", {})

modules/workers/locals.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ locals {
77
ocpus = max(1, lookup(var.shape, "ocpus", 1))
88
shape = lookup(var.shape, "shape", "VM.Standard.E4.Flex")
99

10-
fault_domains_default = formatlist("FD-%v", [1, 2, 3])
10+
# Used for default values of required input for virtual node pools
11+
fault_domains_all = formatlist("FD-%v", [1, 2, 3])
1112
fault_domains_available = {
1213
for ad, fd in data.oci_identity_fault_domains.all : ad => fd
1314
}
@@ -35,7 +36,6 @@ locals {
3536
os = var.image_os
3637
os_version = var.image_os_version
3738
placement_ads = var.ad_numbers
38-
placement_fds = local.fault_domains_default
3939
platform_config = var.platform_config
4040
pod_nsg_ids = var.pod_nsg_ids
4141
pod_subnet_id = coalesce(var.pod_subnet_id, var.worker_subnet_id, "none")

modules/workers/nodepools.tf

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,8 @@ resource "oci_containerengine_node_pool" "workers" {
3131
capacity_reservation_id = each.value.capacity_reservation_id
3232
subnet_id = each.value.subnet_id
3333

34-
# Intersect the list of available and configured FDs for this AD
35-
fault_domains = tolist(setintersection(
36-
each.value.placement_fds,
37-
lookup(local.fault_domains_available, ad.value, local.fault_domains_default)
38-
))
34+
# Value(s) specified on pool, or null to select automatically
35+
fault_domains = try(each.value.placement_fds, null)
3936

4037
dynamic "preemptible_node_config" {
4138
for_each = each.value.preemptible_config.enable ? [1] : []

modules/workers/virtualnodepools.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ resource "oci_containerengine_virtual_node_pool" "workers" {
2323

2424
# Intersect the list of available and configured FDs for this AD
2525
fault_domain = tolist(setintersection(
26-
each.value.placement_fds,
27-
lookup(local.fault_domains_available, ad.value, local.fault_domains_default)
26+
try(each.value.placement_fds, local.fault_domains_all),
27+
lookup(local.fault_domains_available, ad.value, local.fault_domains_all)
2828
))
2929
}
3030
}

0 commit comments

Comments
 (0)