Skip to content

Commit e2ef377

Browse files
authored
PR for issue-216 add support for flex shape (#217)
* issue-216 support for flex shape and issue-219 Signed-off-by: Karthic Ravindran <[email protected]> * changes in terraform.tfvars.example Signed-off-by: Karthic Ravindran <[email protected]>
1 parent 1832f41 commit e2ef377

File tree

5 files changed

+39
-21
lines changed

5 files changed

+39
-21
lines changed

docs/terraformoptions.adoc

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -456,22 +456,35 @@ admission_controller_options = {
456456
|v1.16.8
457457

458458
|`node_pools`
459-
|The number, shape and quantities per subnets of node pools to create. Each key and tuple pair corresponds to 1 node pool. The first parameter in the tuple sets the shape of the worker node, the 2nd parameter sets the size of the node pool and the 3rd parameter the boot volume size in GB. An empty value ("") for the boot volume size will default the boot volume size to 50GB. A minimum of 1 worker worker nodes per node pool will be created. Refer to {uri-topology}[topology] for more thorough examples.
459+
a|The number, shape of node pools and node_pool_size to create. Each key and tuple pair corresponds to 1 node pool.
460+
461+
* shape defines the worker node shape to use for each pool
462+
* ocpus defines the number of OCPUs that will be used if VM.Standard.E3.Flex shape is used
463+
* node_pool_size defines the number of worker nodes in each nodepool
464+
* boot_volume_size defines the custom boot volume size in GBs for the worker nodes.
465+
466+
If an empty nodepool like np3 = {} is specified, then a nodepool will default values:
467+
468+
* shape=VM.Standard.E3.Flex
469+
* ocpus=1
470+
* node_pool_size=1
471+
* boot_volume_size=50
472+
473+
Refer to {uri-topology}[topology] for more thorough examples.
460474
|e.g.
461475
[source]
462476
node_pools = {
463-
np1 = ["VM.Standard.E2.2", 1, 50]
464-
np2 = ["VM.Standard2.8", 2, 100]
465-
np3 = ["VM.Standard.E2.2", 1, 200]
466-
np4 = ["VM.Standard.E2.2", 1, ""]
477+
np1 = {shape="VM.Standard.E3.Flex",ocpus=2,node_pool_size=2,boot_volume_size=150}
478+
np2 = {shape="VM.Standard.E2.2",node_pool_size=2,boot_volume_size=150}
479+
np3 = {shape="VM.Standard.E2.2",node_pool_size=1}
467480
}
468481

469482
|
470483
[source]
471484
node_pools = {
472-
np1 = ["VM.Standard.E2.2", 1, 50]
473-
np2 = ["VM.Standard2.8", 2, 100]
474-
np3 = ["VM.Standard.E2.2", 1, 200]
485+
np1 = {shape="VM.Standard.E3.Flex",ocpus=2,node_pool_size=2,boot_volume_size=150}
486+
np2 = {shape="VM.Standard.E2.2",node_pool_size=2,boot_volume_size=150}
487+
np3 = {shape="VM.Standard.E2.2",node_pool_size=1}
475488
}
476489

477490
|`node_pools_to_drain`

modules/oke/datasources.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ data "oci_core_images" "latest_images" {
66
compartment_id = var.compartment_id
77
operating_system = var.node_pools.node_pool_os
88
operating_system_version = var.node_pools.node_pool_os_version
9-
shape = element(each.value, 0)
9+
shape = lookup(each.value,"shape","VM.Standard.E3.Flex")
1010
sort_by = "TIMECREATED"
1111
}
1212

modules/oke/nodepools.tf

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,21 @@ resource "oci_containerengine_node_pool" "nodepools" {
2121
}
2222
}
2323
# set quantity to a minimum of 1 to allow small clusters.
24-
size = max(1, element(each.value,1))
24+
size = max(1, lookup(each.value,"node_pool_size",1))
25+
}
26+
dynamic "node_shape_config" {
27+
for_each = length(regexall("Flex",lookup(each.value,"shape","VM.Standard.E3.Flex"))) > 0 ? [1] : []
28+
content {
29+
ocpus = max(1,lookup(each.value,"ocpus",1))
30+
}
2531
}
26-
2732
node_source_details {
28-
boot_volume_size_in_gbs = element(each.value,2) == "" ? 50 : element(each.value,2)
33+
boot_volume_size_in_gbs = lookup(each.value,"boot_volume_size",50)
2934
image_id = var.node_pools.node_pool_image_id == "none" ? data.oci_core_images.latest_images[each.key].images[0].id : var.node_pools.node_pool_image_id
3035
source_type = "IMAGE"
3136
}
3237

33-
node_shape = element(each.value,0)
38+
node_shape = lookup(each.value,"shape","VM.Standard.E3.Flex")
3439

3540
ssh_public_key = file(var.oke_ssh_keys.ssh_public_key_path)
3641

terraform.tfvars.example

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,9 @@ dashboard_enabled = false
133133
kubernetes_version = "v1.16.8"
134134

135135
node_pools = {
136-
np1 = ["VM.Standard.E2.2", 1, 50]
137-
np2 = ["VM.Standard2.8", 2, 100]
138-
np3 = ["VM.Standard.E2.2", 1, 200]
139-
# np4 = ["VM.Standard.E2.2", 4, 500]
136+
np1 = {shape="VM.Standard.E3.Flex",ocpus=2,node_pool_size=2,boot_volume_size=150}
137+
np2 = {shape="VM.Standard.E2.2",node_pool_size=2,boot_volume_size=150}
138+
np3 = {shape="VM.Standard.E2.2",node_pool_size=1}
140139
}
141140

142141
node_pools_to_drain = [ "np1", "np2", "np3" ]

variables.tf

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,11 +282,11 @@ variable "kubernetes_version" {
282282

283283
variable "node_pools" {
284284
default = {
285-
np1 = ["VM.Standard.E2.2", 1, 50]
286-
np2 = ["VM.Standard2.8", 2, 100]
287-
np3 = ["VM.Standard.E2.2", 1, 200]
285+
np1 = {shape="VM.Standard.E3.Flex",ocpus=2,node_pool_size=2,boot_volume_size=150}
286+
np2 = {shape="VM.Standard.E2.2",node_pool_size=2,boot_volume_size=150}
287+
np3 = {shape="VM.Standard.E2.2",node_pool_size=1}
288288
}
289-
description = "Tuple of node pools. Each key maps to a node pool. Each value is a tuple of shape (string) and size(number)."
289+
description = "Tuple of node pools. Each key maps to a node pool. Each value is a tuple of shape (string),ocpus(number) , node_pool_size(number) and boot_volume_size(number)"
290290
type = map(any)
291291
}
292292

@@ -408,6 +408,7 @@ variable "ocir_urls" {
408408
uk-london-1 = "lhr.ocir.io"
409409
us-ashburn-1 = "iad.ocir.io"
410410
us-phoenix-1 = "phx.ocir.io"
411+
us-sanjose-1 = "sjc.ocir.io"
411412
}
412413
type = map(string)
413414
}

0 commit comments

Comments
 (0)