Skip to content

Commit

Permalink
fix: handle placement_ads for 1 AD regions. (#581)
Browse files Browse the repository at this point in the history
Added additional examples for other nodepool parameters

Resolves #577

Signed-off-by: Ali Mukadam <[email protected]>

Signed-off-by: Ali Mukadam <[email protected]>
  • Loading branch information
hyder authored Sep 23, 2022
1 parent 2ef6707 commit 13f845b
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 19 deletions.
13 changes: 9 additions & 4 deletions docs/terraformoptions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -758,15 +758,20 @@ EOT
|31

|node_pools
|The number, shape of node pools and node_pool_size to create. Each key and tuple pair corresponds to 1 node pool.
|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.

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

node_pools = {
np1 = { shape = "VM.Standard.E4.Flex", ocpus = 1, memory = 16, node_pool_size = 1, boot_volume_size = 150, label = { app = "frontend", pool = "np1" } }
np2 = {shape="VM.Standard.E2.2",node_pool_size=2,boot_volume_size=150,label={app="application",name="test"}}
np3 = {shape="VM.Standard.E2.2",node_pool_size=1,placement_ads=[1]}
# Basic node pool
np1 = {
shape = "VM.Standard.E4.Flex",
ocpus = 2,
memory = 32,
node_pool_size = 1,
boot_volume_size = 150,
}
}
|{}

Expand Down
7 changes: 6 additions & 1 deletion modules/oke/nodepools.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,15 @@ resource "oci_containerengine_node_pool" "nodepools" {
kms_key_id = var.node_pool_volume_kms_key_id

# iterating over ADs
## If placement_ads are specified, use them.
## Else, iterate over all ADs.
## If a single AD region is used, pick the only AD returned from the data source.

dynamic "placement_configs" {
iterator = ad_iterator
for_each = [for n in lookup(each.value, "placement_ads", local.ad_numbers) :
local.ad_number_to_name[n]]
length(local.ad_numbers) == 1 ? local.ad_number_to_name[1] : local.ad_number_to_name[n]
]
content {
availability_domain = ad_iterator.value
subnet_id = var.cluster_subnets["workers"]
Expand Down
104 changes: 90 additions & 14 deletions terraform.tfvars.example
Original file line number Diff line number Diff line change
Expand Up @@ -179,20 +179,96 @@ image_signing_keys = []
check_node_active = "all"
enable_pv_encryption_in_transit = false
node_pools = {
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" } }
np2 = { shape = "VM.Standard.E4.Flex", ocpus = 1, memory = 16, node_pool_size = 1, boot_volume_size = 150, label = { app = "frontend", pool = "np2" } }
# np3 = { shape = "VM.Standard.E4.Flex", ocpus = 1, memory = 16, node_pool_size = 1, boot_volume_size = 150, label = { app = "frontend", pool = "np1" } }
# np4 = { shape = "VM.Standard.E4.Flex", ocpus = 1, memory = 16, node_pool_size = 1, placement_ads = [1] }
# np2 = {shape="VM.Standard.E4.Flex",ocpus=4,memory=16,node_pool_size=1,boot_volume_size=150, label={app="backend",pool="np2"}}
# np3 = {shape="VM.Standard.A1.Flex",ocpus=8,memory=16,node_pool_size=1,boot_volume_size=150, label={pool="np3"}}
# np4 = {shape="BM.Standard2.52",node_pool_size=1,boot_volume_size=150}
# np5 = {shape="VM.Optimized3.Flex",node_pool_size=6}
# np5 = {shape="BM.Standard.A1.160",node_pool_size=6}
# np6 = {shape="VM.Standard.E2.2", node_pool_size=5}
# np7 = {shape="BM.DenseIO2.52", node_pool_size=5}
# np8 = {shape="BM.GPU3.8", node_pool_size=1}
# np9 = {shape="BM.GPU4.8", node_pool_size=5}
# np10 = {shape="BM.HPC2.36 ", node_pool_size=5}
# Basic node pool
np1 = {
shape = "VM.Standard.E4.Flex",
ocpus = 2,
memory = 32,
node_pool_size = 1,
boot_volume_size = 150,
}
# # node pool with initial node labels
# np2 = {
# shape = "VM.Standard.E4.Flex",
# ocpus = 2,
# memory = 32,
# node_pool_size = 1,
# boot_volume_size = 150,
# label = { app = "frontend", pool = "np2" },
# }
# # node pool with freeform tags
# np3 = {
# shape = "VM.Standard.E4.Flex",
# ocpus = 2,
# memory = 32,
# node_pool_size = 1,
# boot_volume_size = 150,
# nodepool_freeform_tags = { app = "frontend", pool = "np2" },
# node_freeform_tags = { app = "frontend", nodes = "np2" },
# }
# # node pool with defined tags
# np4 = {
# shape = "VM.Standard.E4.Flex",
# ocpus = 2,
# memory = 32,
# node_pool_size = 1,
# boot_volume_size = 150,
# nodepool_defined_tags = { "cn.environment" = "prod" },
# node_defined_tags = { "cn.environment" = "prod" },
# }
# # node pool with placement ads
# np5 = {
# shape = "VM.Standard.E4.Flex",
# ocpus = 2,
# memory = 32,
# node_pool_size = 1,
# boot_volume_size = 150,
# placement_ads = [1]
# }
# # node pool using ARM Flex shape
# np6 = {
# shape = "VM.Standard.A1.Flex",
# ocpus = 2,
# memory = 32,
# node_pool_size = 1,
# boot_volume_size = 150,
# }
# # node pool using Baremetal X86_64
# np7 = {
# shape = "BM.Standard2.52",
# node_pool_size = 1,
# boot_volume_size = 150,
# }
# # node pool using Baremetal ARM
# np8 = {
# shape = "BM.Standard.A1.160",
# node_pool_size = 1,
# boot_volume_size = 150,
# }
# # node pool using Optimized Flex
# np9 = {
# shape = "VM.Optimized3.Flex",
# node_pool_size = 1,
# boot_volume_size = 150,
# }
# # node pool using DenseIO2
# np9 = {
# shape = "BM.DenseIO2.52",
# node_pool_size = 1,
# boot_volume_size = 150,
# }
# # node pool using BM.GPU3.8
# np10 = {
# shape = "BM.GPU3.8",
# node_pool_size = 1,
# boot_volume_size = 150,
# }
# # node pool using BM.GPU4.8
# np11 = {
# shape = "BM.GPU4.8",
# node_pool_size = 1,
# boot_volume_size = 150,
# }
}
node_pool_image_id = "none"
node_pool_image_type = "oke"
Expand Down

0 comments on commit 13f845b

Please sign in to comment.