@@ -32,6 +32,9 @@ module "oke" {
32
32
# # Cluster API Endpoint visibility
33
33
cluster_endpoint_visibility = var. cluster_endpoint_visibility
34
34
35
+ # # Control Plane Kubernetes Version
36
+ k8s_version = var. k8s_version
37
+
35
38
# # Create Dynamic group and Policies for Autoscaler and OCI Metrics and Logging
36
39
create_dynamic_group_for_nodes_in_compartment = var. create_dynamic_group_for_nodes_in_compartment
37
40
create_compartment_policies = var. create_compartment_policies
@@ -42,27 +45,41 @@ module "oke" {
42
45
existent_encryption_key_id = var. existent_encryption_key_id
43
46
44
47
# # Enable Cluster Autoscaler
45
- cluster_autoscaler_enabled = var. cluster_autoscaler_enabled
46
- cluster_autoscaler_min_nodes = var. cluster_autoscaler_min_nodes
47
- cluster_autoscaler_max_nodes = var. cluster_autoscaler_max_nodes
48
- existent_oke_nodepool_id_for_autoscaler = var. existent_oke_nodepool_id_for_autoscaler
48
+ cluster_autoscaler_enabled = var. cluster_autoscaler_enabled
49
+ # cluster_autoscaler_min_nodes = var.cluster_autoscaler_min_nodes
50
+ # cluster_autoscaler_max_nodes = var.cluster_autoscaler_max_nodes
51
+ # existent_oke_nodepool_id_for_autoscaler = var.existent_oke_nodepool_id_for_autoscaler
49
52
50
53
# # OKE Worker Nodes (Compute)
51
- num_pool_workers = var. num_pool_workers
54
+ num_pool_workers = var. cluster_autoscaler_enabled ? var . cluster_autoscaler_min_nodes : var . num_pool_workers
52
55
node_pool_shape = var. node_pool_instance_shape . instanceShape
53
56
node_pool_node_shape_config_ocpus = var. node_pool_instance_shape . ocpus
54
57
node_pool_node_shape_config_memory_in_gbs = var. node_pool_instance_shape . memory
55
58
generate_public_ssh_key = var. generate_public_ssh_key
56
59
public_ssh_key = var. public_ssh_key
60
+ }
61
+
62
+ module "oke-cluster-autoscaler" {
63
+ source = " ./modules/oke-cluster-autoscaler"
57
64
58
- # count = var.oke_provision ? 1 : 0
65
+ # Oracle Cloud Infrastructure Tenancy and Compartment OCID
66
+ # tenancy_ocid = var.tenancy_ocid
67
+ # compartment_ocid = var.compartment_ocid
68
+ region = var. region
69
+
70
+ # # Enable Cluster Autoscaler
71
+ cluster_autoscaler_enabled = var. cluster_autoscaler_enabled
72
+ # cluster_autoscaler_min_nodes = var.cluster_autoscaler_min_nodes
73
+ # cluster_autoscaler_max_nodes = var.cluster_autoscaler_max_nodes
74
+ # existent_oke_nodepool_id_for_autoscaler = var.existent_oke_nodepool_id_for_autoscaler
75
+ oke_node_pools = var. oke_node_pools
76
+
77
+ # # Nodes Kubernetes Version
78
+ k8s_version = var. k8s_version
79
+
80
+ depends_on = [module . oke ]
59
81
}
60
82
61
- # OKE Variables
62
- # variable "oke_provision" {
63
- # default = false
64
- # description = "Provision OCI Container Engine - OKE"
65
- # }
66
83
# # OKE Cluster Details
67
84
variable "app_name" {
68
85
default = " K8s App"
@@ -142,18 +159,30 @@ variable "cluster_autoscaler_enabled" {
142
159
default = true
143
160
description = " Enables OKE cluster autoscaler. Node pools will auto scale based on the resources usage"
144
161
}
145
- variable "cluster_autoscaler_min_nodes" {
146
- default = 3
147
- description = " Minimum number of nodes on the node pool to be scheduled by the Kubernetes"
148
- }
149
- variable "cluster_autoscaler_max_nodes" {
150
- default = 10
151
- description = " Maximum number of nodes on the node pool to be scheduled by the Kubernetes"
152
- }
153
- variable "existent_oke_nodepool_id_for_autoscaler" {
154
- default = " "
155
- description = " Nodepool Id of the existent OKE to use with Cluster Autoscaler"
156
- }
162
+ variable "oke_node_pools" {
163
+ type = list (any )
164
+
165
+ default = [
166
+ {
167
+ node_pool_id = " " # TODO: node pool Id from module
168
+ node_pool_min_nodes = 3
169
+ node_pool__max_nodes = 10
170
+ }
171
+ ]
172
+ description = " Node pools (id, min_nodes, max_nodes) to use with Cluster Autoscaler"
173
+ }
174
+ # variable "cluster_autoscaler_min_nodes" {
175
+ # default = 3
176
+ # description = "Minimum number of nodes on the node pool to be scheduled by the Kubernetes"
177
+ # }
178
+ # variable "cluster_autoscaler_max_nodes" {
179
+ # default = 10
180
+ # description = "Maximum number of nodes on the node pool to be scheduled by the Kubernetes"
181
+ # }
182
+ # variable "existent_oke_nodepool_id_for_autoscaler" {
183
+ # default = ""
184
+ # description = "Nodepool Id of the existent OKE to use with Cluster Autoscaler"
185
+ # }
157
186
158
187
# # OKE Node Pool Details
159
188
variable "node_pool_name" {
@@ -179,14 +208,6 @@ variable "node_pool_instance_shape" {
179
208
}
180
209
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"
181
210
}
182
- # variable "node_pool_node_shape_config_ocpus" {
183
- # default = "1" # Only used if flex shape is selected
184
- # description = "You can customize the number of OCPUs to a flexible shape"
185
- # }
186
- # variable "node_pool_node_shape_config_memory_in_gbs" {
187
- # default = "16" # Only used if flex shape is selected
188
- # description = "You can customize the amount of memory allocated to a flexible shape"
189
- # }
190
211
variable "node_pool_boot_volume_size_in_gbs" {
191
212
default = " 60"
192
213
description = " Specify a custom boot volume size (in GB)"
@@ -209,15 +230,15 @@ variable "public_ssh_key" {
209
230
210
231
# Create Dynamic Group and Policies
211
232
variable "create_dynamic_group_for_nodes_in_compartment" {
212
- default = false # TODO: true
233
+ default = true
213
234
description = " Creates dynamic group of Nodes in the compartment. Note: You need to have proper rights on the Tenancy. If you only have rights in a compartment, uncheck and ask you administrator to create the Dynamic Group for you"
214
235
}
215
236
variable "existent_dynamic_group_for_nodes_in_compartment" {
216
237
default = " "
217
238
description = " Enter previous created Dynamic Group for the policies"
218
239
}
219
240
variable "create_compartment_policies" {
220
- default = false # TODO: true
241
+ default = true
221
242
description = " Creates policies that will reside on the compartment. e.g.: Policies to support Cluster Autoscaler, OCI Logging datasource on Grafana"
222
243
}
223
244
0 commit comments