Skip to content

Commit a1feb8f

Browse files
committed
complete stack all flex instance shape support
Signed-off-by: junior <[email protected]>
1 parent 35fe8bc commit a1feb8f

File tree

3 files changed

+33
-65
lines changed

3 files changed

+33
-65
lines changed

deploy/complete/terraform/oke-variables.tf

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -106,17 +106,26 @@ variable "num_pool_workers" {
106106
default = 3
107107
description = "The number of worker nodes in the node pool. If select Cluster Autoscaler, will assume the minimum number of nodes configured"
108108
}
109-
variable "node_pool_shape" {
110-
default = "VM.Standard.E3.Flex"
111-
description = "A shape is a template that determines the number of OCPUs, amount of memory, and other resources allocated to a newly created instance for the Worker Node"
112-
}
113-
variable "node_pool_node_shape_config_ocpus" {
114-
default = "1" # Only used if flex shape is selected
115-
description = "You can customize the number of OCPUs to a flexible shape"
116-
}
117-
variable "node_pool_node_shape_config_memory_in_gbs" {
118-
default = "16" # Only used if flex shape is selected
119-
description = "You can customize the amount of memory allocated to a flexible shape"
109+
# variable "node_pool_shape" {
110+
# default = "VM.Standard.E3.Flex"
111+
# description = "A shape is a template that determines the number of OCPUs, amount of memory, and other resources allocated to a newly created instance for the Worker Node"
112+
# }
113+
# variable "node_pool_node_shape_config_ocpus" {
114+
# default = "1" # Only used if flex shape is selected
115+
# description = "You can customize the number of OCPUs to a flexible shape"
116+
# }
117+
# variable "node_pool_node_shape_config_memory_in_gbs" {
118+
# default = "16" # Only used if flex shape is selected
119+
# description = "You can customize the amount of memory allocated to a flexible shape"
120+
# }
121+
variable "node_pool_instance_shape" {
122+
type = map(any)
123+
default = {
124+
"instanceShape" = "VM.Standard.E4.Flex"
125+
"ocpus" = 2
126+
"memory" = 16
127+
}
128+
description = "A shape is a template that determines the number of OCPUs, amount of memory, and other resources allocated to a newly created instance for the Worker Node. Select at least 2 OCPUs and 16GB of memory if using Flex shapes"
120129
}
121130
variable "node_pool_boot_volume_size_in_gbs" {
122131
default = "60"

deploy/complete/terraform/oke.tf

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ resource "oci_containerengine_node_pool" "oke_node_pool" {
4343
compartment_id = local.oke_compartment_ocid
4444
kubernetes_version = (var.k8s_version == "Latest") ? local.node_pool_k8s_latest_version : var.k8s_version
4545
name = var.node_pool_name
46-
node_shape = var.node_pool_shape
46+
node_shape = var.node_pool_instance_shape.instanceShape
4747
ssh_public_key = var.generate_public_ssh_key ? tls_private_key.oke_worker_node_ssh_key.public_key_openssh : var.public_ssh_key
4848

4949
node_config_details {
@@ -61,8 +61,8 @@ resource "oci_containerengine_node_pool" "oke_node_pool" {
6161
dynamic "node_shape_config" {
6262
for_each = local.is_flexible_node_shape ? [1] : []
6363
content {
64-
ocpus = var.node_pool_node_shape_config_ocpus
65-
memory_in_gbs = var.node_pool_node_shape_config_memory_in_gbs
64+
ocpus = var.node_pool_instance_shape.ocpus
65+
memory_in_gbs = var.node_pool_instance_shape.memory
6666
}
6767
}
6868

@@ -114,5 +114,6 @@ locals {
114114

115115
# Checks if is using Flexible Compute Shapes
116116
locals {
117-
is_flexible_node_shape = contains(local.compute_flexible_shapes, var.node_pool_shape)
117+
# Checks if is using Flexible Compute Shapes
118+
is_flexible_node_shape = contains(split(".", var.node_pool_instance_shape.instanceShape), "Flex")
118119
}

deploy/complete/terraform/schema.yaml

Lines changed: 8 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@ variableGroups:
4949
- cluster_autoscaler_min_nodes
5050
- cluster_autoscaler_max_nodes
5151
- existent_oke_nodepool_id_for_autoscaler
52-
- node_pool_shape
53-
- node_pool_node_shape_config_ocpus
54-
- node_pool_node_shape_config_memory_in_gbs
52+
- node_pool_instance_shape
5553
- generate_public_ssh_key
5654
- public_ssh_key
5755
- image_operating_system
@@ -270,7 +268,7 @@ variables:
270268

271269
cluster_autoscaler_enabled:
272270
type: boolean
273-
title: "Enable Cluster Autoscaler"
271+
title: "Enable Cluster Autoscaler"
274272

275273
num_pool_workers:
276274
type: integer
@@ -316,8 +314,8 @@ variables:
316314
- not:
317315
- create_new_oke_cluster
318316

319-
node_pool_shape:
320-
type: oci:core:instanceshape:name
317+
node_pool_instance_shape:
318+
type: oci:core:instanceshapewithflex:name
321319
title: "Select a shape for the Worker Nodes instances"
322320
required: true
323321
dependsOn:
@@ -326,46 +324,6 @@ variables:
326324
and:
327325
- create_new_oke_cluster
328326

329-
node_pool_node_shape_config_ocpus:
330-
type: integer
331-
minimum: 1
332-
maximum: 64
333-
title: "Number of OCPUs"
334-
visible:
335-
and:
336-
- and:
337-
- create_new_oke_cluster
338-
- or:
339-
- eq:
340-
- node_pool_shape
341-
- "VM.Standard.E3.Flex"
342-
- eq:
343-
- node_pool_shape
344-
- "VM.Standard.E4.Flex"
345-
- eq:
346-
- node_pool_shape
347-
- "VM.Standard.A1.Flex"
348-
349-
node_pool_node_shape_config_memory_in_gbs:
350-
type: integer
351-
minimum: 1
352-
maximum: 1024
353-
title: "Amount of memory (GB)"
354-
visible:
355-
and:
356-
- and:
357-
- create_new_oke_cluster
358-
- or:
359-
- eq:
360-
- node_pool_shape
361-
- "VM.Standard.E3.Flex"
362-
- eq:
363-
- node_pool_shape
364-
- "VM.Standard.E4.Flex"
365-
- eq:
366-
- node_pool_shape
367-
- "VM.Standard.A1.Flex"
368-
369327
node_pool_name:
370328
type: string
371329
title: "Node Pool Name"
@@ -446,7 +404,7 @@ variables:
446404
- create_tenancy_policies
447405
- not:
448406
- create_dynamic_group_for_nodes_in_compartment
449-
407+
450408
create_compartment_policies:
451409
type: boolean
452410
title: "Create Compartment Policies"
@@ -546,7 +504,7 @@ variables:
546504
- show_advanced
547505
- ingress_nginx_enabled
548506
- eq:
549-
- ingress_load_balancer_shape
507+
- ingress_load_balancer_shape
550508
- "flexible"
551509

552510
ingress_load_balancer_shape_flex_max:
@@ -561,7 +519,7 @@ variables:
561519
- show_advanced
562520
- ingress_nginx_enabled
563521
- eq:
564-
- ingress_load_balancer_shape
522+
- ingress_load_balancer_shape
565523
- "flexible"
566524

567525
ingress_hosts:
@@ -632,7 +590,7 @@ variables:
632590
oda_enabled:
633591
type: boolean
634592
title: "Enable Oracle Digital Assistant support?"
635-
593+
636594
oda_uri:
637595
type: string
638596
title: "Oracle Digital Assistant URI"

0 commit comments

Comments
 (0)