Skip to content

Commit 13f845b

Browse files
authored
fix: handle placement_ads for 1 AD regions. (#581)
Added additional examples for other nodepool parameters Resolves #577 Signed-off-by: Ali Mukadam <[email protected]> Signed-off-by: Ali Mukadam <[email protected]>
1 parent 2ef6707 commit 13f845b

File tree

3 files changed

+105
-19
lines changed

3 files changed

+105
-19
lines changed

docs/terraformoptions.adoc

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -758,15 +758,20 @@ EOT
758758
|31
759759

760760
|node_pools
761-
|The number, shape of node pools and node_pool_size to create. Each key and tuple pair corresponds to 1 node pool.
761+
|The number, shape of node pool, node_pool_size to create. Use this input variable to also set other nodepool parameters. See terraform.tfvars.example. Each key and tuple pair corresponds to 1 node pool that will be created.
762762

763763
Refer to {uri-topology}[topology] for more thorough examples.
764764
|e.g.
765765

766766
node_pools = {
767-
np1 = { shape = "VM.Standard.E4.Flex", ocpus = 1, memory = 16, node_pool_size = 1, boot_volume_size = 150, label = { app = "frontend", pool = "np1" } }
768-
np2 = {shape="VM.Standard.E2.2",node_pool_size=2,boot_volume_size=150,label={app="application",name="test"}}
769-
np3 = {shape="VM.Standard.E2.2",node_pool_size=1,placement_ads=[1]}
767+
# Basic node pool
768+
np1 = {
769+
shape = "VM.Standard.E4.Flex",
770+
ocpus = 2,
771+
memory = 32,
772+
node_pool_size = 1,
773+
boot_volume_size = 150,
774+
}
770775
}
771776
|{}
772777

modules/oke/nodepools.tf

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,15 @@ resource "oci_containerengine_node_pool" "nodepools" {
2020
kms_key_id = var.node_pool_volume_kms_key_id
2121

2222
# iterating over ADs
23+
## If placement_ads are specified, use them.
24+
## Else, iterate over all ADs.
25+
## If a single AD region is used, pick the only AD returned from the data source.
26+
2327
dynamic "placement_configs" {
2428
iterator = ad_iterator
2529
for_each = [for n in lookup(each.value, "placement_ads", local.ad_numbers) :
26-
local.ad_number_to_name[n]]
30+
length(local.ad_numbers) == 1 ? local.ad_number_to_name[1] : local.ad_number_to_name[n]
31+
]
2732
content {
2833
availability_domain = ad_iterator.value
2934
subnet_id = var.cluster_subnets["workers"]

terraform.tfvars.example

Lines changed: 90 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -179,20 +179,96 @@ image_signing_keys = []
179179
check_node_active = "all"
180180
enable_pv_encryption_in_transit = false
181181
node_pools = {
182-
np1 = { shape = "VM.Standard.E4.Flex", ocpus = 1, memory = 16, node_pool_size = 1, boot_volume_size = 150, label = { app = "frontend", pool = "np1" }, nodepool_freeform_tags = { app = "frontend", pool = "np1" }, nodepool_defined_tags = { "Operations.CostCenter" = "42" } }
183-
np2 = { shape = "VM.Standard.E4.Flex", ocpus = 1, memory = 16, node_pool_size = 1, boot_volume_size = 150, label = { app = "frontend", pool = "np2" } }
184-
# np3 = { shape = "VM.Standard.E4.Flex", ocpus = 1, memory = 16, node_pool_size = 1, boot_volume_size = 150, label = { app = "frontend", pool = "np1" } }
185-
# np4 = { shape = "VM.Standard.E4.Flex", ocpus = 1, memory = 16, node_pool_size = 1, placement_ads = [1] }
186-
# np2 = {shape="VM.Standard.E4.Flex",ocpus=4,memory=16,node_pool_size=1,boot_volume_size=150, label={app="backend",pool="np2"}}
187-
# np3 = {shape="VM.Standard.A1.Flex",ocpus=8,memory=16,node_pool_size=1,boot_volume_size=150, label={pool="np3"}}
188-
# np4 = {shape="BM.Standard2.52",node_pool_size=1,boot_volume_size=150}
189-
# np5 = {shape="VM.Optimized3.Flex",node_pool_size=6}
190-
# np5 = {shape="BM.Standard.A1.160",node_pool_size=6}
191-
# np6 = {shape="VM.Standard.E2.2", node_pool_size=5}
192-
# np7 = {shape="BM.DenseIO2.52", node_pool_size=5}
193-
# np8 = {shape="BM.GPU3.8", node_pool_size=1}
194-
# np9 = {shape="BM.GPU4.8", node_pool_size=5}
195-
# np10 = {shape="BM.HPC2.36 ", node_pool_size=5}
182+
# Basic node pool
183+
np1 = {
184+
shape = "VM.Standard.E4.Flex",
185+
ocpus = 2,
186+
memory = 32,
187+
node_pool_size = 1,
188+
boot_volume_size = 150,
189+
}
190+
# # node pool with initial node labels
191+
# np2 = {
192+
# shape = "VM.Standard.E4.Flex",
193+
# ocpus = 2,
194+
# memory = 32,
195+
# node_pool_size = 1,
196+
# boot_volume_size = 150,
197+
# label = { app = "frontend", pool = "np2" },
198+
# }
199+
# # node pool with freeform tags
200+
# np3 = {
201+
# shape = "VM.Standard.E4.Flex",
202+
# ocpus = 2,
203+
# memory = 32,
204+
# node_pool_size = 1,
205+
# boot_volume_size = 150,
206+
# nodepool_freeform_tags = { app = "frontend", pool = "np2" },
207+
# node_freeform_tags = { app = "frontend", nodes = "np2" },
208+
# }
209+
# # node pool with defined tags
210+
# np4 = {
211+
# shape = "VM.Standard.E4.Flex",
212+
# ocpus = 2,
213+
# memory = 32,
214+
# node_pool_size = 1,
215+
# boot_volume_size = 150,
216+
# nodepool_defined_tags = { "cn.environment" = "prod" },
217+
# node_defined_tags = { "cn.environment" = "prod" },
218+
# }
219+
# # node pool with placement ads
220+
# np5 = {
221+
# shape = "VM.Standard.E4.Flex",
222+
# ocpus = 2,
223+
# memory = 32,
224+
# node_pool_size = 1,
225+
# boot_volume_size = 150,
226+
# placement_ads = [1]
227+
# }
228+
# # node pool using ARM Flex shape
229+
# np6 = {
230+
# shape = "VM.Standard.A1.Flex",
231+
# ocpus = 2,
232+
# memory = 32,
233+
# node_pool_size = 1,
234+
# boot_volume_size = 150,
235+
# }
236+
# # node pool using Baremetal X86_64
237+
# np7 = {
238+
# shape = "BM.Standard2.52",
239+
# node_pool_size = 1,
240+
# boot_volume_size = 150,
241+
# }
242+
# # node pool using Baremetal ARM
243+
# np8 = {
244+
# shape = "BM.Standard.A1.160",
245+
# node_pool_size = 1,
246+
# boot_volume_size = 150,
247+
# }
248+
# # node pool using Optimized Flex
249+
# np9 = {
250+
# shape = "VM.Optimized3.Flex",
251+
# node_pool_size = 1,
252+
# boot_volume_size = 150,
253+
# }
254+
# # node pool using DenseIO2
255+
# np9 = {
256+
# shape = "BM.DenseIO2.52",
257+
# node_pool_size = 1,
258+
# boot_volume_size = 150,
259+
# }
260+
# # node pool using BM.GPU3.8
261+
# np10 = {
262+
# shape = "BM.GPU3.8",
263+
# node_pool_size = 1,
264+
# boot_volume_size = 150,
265+
# }
266+
# # node pool using BM.GPU4.8
267+
# np11 = {
268+
# shape = "BM.GPU4.8",
269+
# node_pool_size = 1,
270+
# boot_volume_size = 150,
271+
# }
196272
}
197273
node_pool_image_id = "none"
198274
node_pool_image_type = "oke"

0 commit comments

Comments
 (0)