Skip to content

Commit b4b7ed8

Browse files
committed
multiple nodepool support
Signed-off-by: junior <junior@users.noreply.github.com>
1 parent e87eef8 commit b4b7ed8

File tree

3 files changed

+35
-30
lines changed

3 files changed

+35
-30
lines changed

module-oke.tf

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ module "oke_node_pool" {
9494
node_pool_node_shape_config_memory_in_gbs = each.value.node_pool_node_shape_config_memory_in_gbs
9595
existent_oke_nodepool_id_for_autoscaler = each.value.existent_oke_nodepool_id_for_autoscaler
9696
public_ssh_key = local.workers_public_ssh_key
97+
image_operating_system = each.value.image_operating_system
98+
image_operating_system_version = each.value.image_operating_system_version
9799

98100
# OKE Network Details
99101
oke_vcn_nodes_subnet_ocid = module.oke.oke_vcn_nodes_subnet_ocid
@@ -104,15 +106,17 @@ module "oke_node_pool" {
104106
locals {
105107
node_pools = [
106108
{
107-
node_pool_name = var.node_pool_name != "" ? var.node_pool_name : "pool1" # Must be unique
108-
node_pool_min_nodes = var.cluster_autoscaler_enabled ? var.cluster_autoscaler_min_nodes_1 : var.num_pool_workers
109+
node_pool_name = var.node_pool_name_1 != "" ? var.node_pool_name_1 : "pool1" # Must be unique
110+
node_pool_min_nodes = var.cluster_autoscaler_enabled ? var.cluster_autoscaler_min_nodes_1 : var.num_pool_workers_1
109111
node_pool_max_nodes = var.cluster_autoscaler_max_nodes_1
110112
node_k8s_version = var.k8s_version # TODO: Allow to set different version for each node pool
111-
node_pool_shape = var.node_pool_instance_shape.instanceShape
112-
node_pool_node_shape_config_ocpus = var.node_pool_instance_shape.ocpus
113-
node_pool_node_shape_config_memory_in_gbs = var.node_pool_instance_shape.memory
114-
node_pool_boot_volume_size_in_gbs = var.node_pool_boot_volume_size_in_gbs
113+
node_pool_shape = var.node_pool_instance_shape_1.instanceShape
114+
node_pool_node_shape_config_ocpus = var.node_pool_instance_shape_1.ocpus
115+
node_pool_node_shape_config_memory_in_gbs = var.node_pool_instance_shape_1.memory
116+
node_pool_boot_volume_size_in_gbs = var.node_pool_boot_volume_size_in_gbs_1
115117
existent_oke_nodepool_id_for_autoscaler = var.existent_oke_nodepool_id_for_autoscaler_1
118+
image_operating_system = var.image_operating_system_1
119+
image_operating_system_version = var.image_operating_system_version_1
116120
},
117121
]
118122
}
@@ -215,21 +219,22 @@ variable "existent_oke_nodepool_id_for_autoscaler_1" {
215219
}
216220

217221
## OKE Node Pool Details
218-
variable "node_pool_name" {
219-
default = "pool1"
220-
description = "Name of the node pool"
221-
}
222222
variable "k8s_version" {
223223
default = "Latest"
224224
description = "Kubernetes version installed on your Control Plane and worker nodes. If not version select, will use the latest available."
225225
}
226-
variable "num_pool_workers" {
226+
### Node Pool 1
227+
variable "node_pool_name_1" {
228+
default = "pool1"
229+
description = "Name of the node pool"
230+
}
231+
variable "num_pool_workers_1" {
227232
default = 3
228233
description = "The number of worker nodes in the node pool. If select Cluster Autoscaler, will assume the minimum number of nodes configured"
229234
}
230235

231-
# ocpus and memory are only used if flex shape is selected
232-
variable "node_pool_instance_shape" {
236+
#### ocpus and memory are only used if flex shape is selected
237+
variable "node_pool_instance_shape_1" {
233238
type = map(any)
234239
default = {
235240
"instanceShape" = "VM.Standard.E4.Flex"
@@ -238,15 +243,15 @@ variable "node_pool_instance_shape" {
238243
}
239244
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"
240245
}
241-
variable "node_pool_boot_volume_size_in_gbs" {
246+
variable "node_pool_boot_volume_size_in_gbs_1" {
242247
default = "60"
243248
description = "Specify a custom boot volume size (in GB)"
244249
}
245-
variable "image_operating_system" {
250+
variable "image_operating_system_1" {
246251
default = "Oracle Linux"
247252
description = "The OS/image installed on all nodes in the node pool."
248253
}
249-
variable "image_operating_system_version" {
254+
variable "image_operating_system_version_1" {
250255
default = "8"
251256
description = "The OS/image version installed on all nodes in the node pool."
252257
}

modules/oke/variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,10 @@ variable "show_advanced" {
141141

142142
# App Name Locals
143143
locals {
144-
app_name_normalized = substr(replace(lower(var.freeform_deployment_tags.AppName), " ", "-"), 0, 6)
145144
app_name = var.freeform_deployment_tags.AppName
146145
deploy_id = var.freeform_deployment_tags.DeploymentID
147-
app_name_for_db = regex("[[:alnum:]]{1,10}", local.app_name)
146+
app_name_normalized = substr(replace(lower(var.freeform_deployment_tags.AppName), " ", "-"), 0, 6)
147+
app_name_for_dns = substr(lower(replace(var.freeform_deployment_tags.AppName,"/\\W|_|\\s/","")), 0, 6)
148148
}
149149

150150
# OKE Compartment

schema.yaml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ variableGroups:
4040
variables:
4141
- cluster_autoscaler_enabled
4242
- existent_oke_nodepool_id_for_autoscaler_1
43-
- num_pool_workers
43+
- num_pool_workers_1
4444
- cluster_autoscaler_min_nodes_1
4545
- cluster_autoscaler_max_nodes_1
46-
- node_pool_instance_shape
46+
- node_pool_instance_shape_1
4747
- generate_public_ssh_key
4848
- public_ssh_key
49-
- image_operating_system
50-
- image_operating_system_version
51-
- node_pool_name
49+
- image_operating_system_1
50+
- image_operating_system_version_1
51+
- node_pool_name_1
5252

5353
- title: "Dynamic Group and Policies"
5454
variables:
@@ -120,7 +120,7 @@ variableGroups:
120120
- fingerprint
121121
- private_key_path
122122
# - network_cidrs
123-
- node_pool_boot_volume_size_in_gbs
123+
- node_pool_boot_volume_size_in_gbs_1
124124
- oke_compartment_description
125125
visible: false
126126

@@ -247,7 +247,7 @@ variables:
247247
and:
248248
- create_new_oke_cluster
249249

250-
num_pool_workers:
250+
num_pool_workers_1:
251251
type: integer
252252
title: "Number of Worker Nodes"
253253
minimum: 1
@@ -303,7 +303,7 @@ variables:
303303
# and:
304304
# - create_new_oke_cluster
305305

306-
node_pool_instance_shape:
306+
node_pool_instance_shape_1:
307307
type: oci:core:instanceshapewithflex:name
308308
title: "Select a flex or fixed shape for the Worker Nodes instances"
309309
required: true
@@ -353,7 +353,7 @@ variables:
353353
# - node_pool_shape
354354
# - "VM.Standard.A1.Flex"
355355

356-
node_pool_name:
356+
node_pool_name_1:
357357
type: string
358358
title: "Node Pool Name"
359359
required: true
@@ -391,7 +391,7 @@ variables:
391391
- not:
392392
- generate_public_ssh_key
393393

394-
image_operating_system:
394+
image_operating_system_1:
395395
type: enum
396396
title: "Image OS"
397397
enum:
@@ -402,7 +402,7 @@ variables:
402402
- create_new_oke_cluster
403403
- show_advanced
404404

405-
image_operating_system_version:
405+
image_operating_system_version_1:
406406
type: string
407407
title: "Image OS Version"
408408
required: true
@@ -527,7 +527,7 @@ variables:
527527
# Cluster Tools - Ingress
528528
ingress_nginx_enabled:
529529
type: boolean
530-
title: "Ingress NGINX"
530+
title: "Ingress NGINX Controller"
531531

532532
ingress_load_balancer_shape:
533533
type: enum

0 commit comments

Comments
 (0)