Skip to content

Commit 7765d40

Browse files
authored
feat: DA updates:<br>- the logic to handle various kinds of machine_types has been improved to help prevent failures in certain use cases<br>- the default_secondary_storage input is now removed. As GPUs will be included in additional worker pools, secondary storage can be provided there. (#683)
1 parent b551b72 commit 7765d40

File tree

6 files changed

+15
-15
lines changed

6 files changed

+15
-15
lines changed

ibm_catalog.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,6 @@
274274
{
275275
"key": "default_worker_pool_labels"
276276
},
277-
{
278-
"key": "default_worker_pool_secondary_storage"
279-
},
280277
{
281278
"key": "enable_autoscaling_for_default_pool"
282279
},

main.tf

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ locals {
4343

4444
# Local block to verify validations for OCP AI Addon.
4545
locals {
46-
4746
# get the total workers per pool
4847
workers_per_pool = {
4948
for pool in var.worker_pools :
@@ -56,8 +55,8 @@ locals {
5655
worker_specs = {
5756
for pool in var.worker_pools :
5857
pool.pool_name => {
59-
cpu_count = tonumber(split("x", split(".", pool.machine_type)[1])[0])
60-
ram_count = tonumber(split("x", split(".", pool.machine_type)[1])[1])
58+
cpu_count = tonumber(regex("^.*?(\\d+)x(\\d+)", pool.machine_type)[0])
59+
ram_count = tonumber(regex("^.*?(\\d+)x(\\d+)", pool.machine_type)[1])
6160
is_gpu = contains(["gx2", "gx3", "gx4"], split(".", pool.machine_type)[0])
6261
}
6362
}

solutions/fully-configurable/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ The following resources are provisioned by this example:
6565
| <a name="input_default_worker_pool_labels"></a> [default\_worker\_pool\_labels](#input\_default\_worker\_pool\_labels) | A set of key-value labels assigned to the worker pool for identification. For Example: { env = "prod", team = "devops" } | `map(string)` | `{}` | no |
6666
| <a name="input_default_worker_pool_machine_type"></a> [default\_worker\_pool\_machine\_type](#input\_default\_worker\_pool\_machine\_type) | The machine type for worker nodes.[Learn more](https://cloud.ibm.com/docs/openshift?topic=openshift-vpc-flavors) | `string` | `"bx2.8x32"` | no |
6767
| <a name="input_default_worker_pool_operating_system"></a> [default\_worker\_pool\_operating\_system](#input\_default\_worker\_pool\_operating\_system) | The operating system installed on the worker nodes. [Learn more](https://cloud.ibm.com/docs/openshift?topic=openshift-vpc-flavors) | `string` | `"RHEL_9_64"` | no |
68-
| <a name="input_default_worker_pool_secondary_storage"></a> [default\_worker\_pool\_secondary\_storage](#input\_default\_worker\_pool\_secondary\_storage) | The secondary storage attached to the worker nodes. Secondary storage is immutable and can't be changed after provisioning. | `string` | `null` | no |
6968
| <a name="input_default_worker_pool_workers_per_zone"></a> [default\_worker\_pool\_workers\_per\_zone](#input\_default\_worker\_pool\_workers\_per\_zone) | Number of worker nodes in each zone of the cluster. | `number` | `2` | no |
7069
| <a name="input_disable_outbound_traffic_protection"></a> [disable\_outbound\_traffic\_protection](#input\_disable\_outbound\_traffic\_protection) | Whether to allow public outbound access from the cluster workers. This is only applicable for OCP 4.15 and later. | `bool` | `false` | no |
7170
| <a name="input_disable_public_endpoint"></a> [disable\_public\_endpoint](#input\_disable\_public\_endpoint) | Whether access to the public service endpoint is disabled when the cluster is created. Does not affect existing clusters. You can't disable a public endpoint on an existing cluster, so you can't convert a public cluster to a private cluster. To change a public endpoint to private, create another cluster with this input set to `true`. | `bool` | `true` | no |

solutions/fully-configurable/main.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ locals {
157157
operating_system = var.default_worker_pool_operating_system
158158
labels = var.default_worker_pool_labels
159159
minSize = var.default_pool_minimum_number_of_nodes
160-
secondary_storage = var.default_worker_pool_secondary_storage
161160
maxSize = var.default_pool_maximum_number_of_nodes
162161
enableAutoscaling = var.enable_autoscaling_for_default_pool
163162
boot_volume_encryption_kms_config = {

solutions/fully-configurable/variables.tf

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ variable "default_worker_pool_machine_type" {
126126
type = string
127127
description = "The machine type for worker nodes.[Learn more](https://cloud.ibm.com/docs/openshift?topic=openshift-vpc-flavors)"
128128
default = "bx2.8x32"
129+
validation {
130+
condition = length(regexall("^[a-z0-9]+(?:\\.[a-z0-9]+)*\\.\\d+x\\d+(?:\\.[a-z0-9]+)?$", var.default_worker_pool_machine_type)) > 0
131+
error_message = "Invalid value provided for the machine type."
132+
}
129133
}
130134

131135
variable "default_worker_pool_workers_per_zone" {
@@ -146,13 +150,6 @@ variable "default_worker_pool_labels" {
146150
default = {}
147151
}
148152

149-
variable "default_worker_pool_secondary_storage" {
150-
type = string
151-
description = "The secondary storage attached to the worker nodes. Secondary storage is immutable and can't be changed after provisioning."
152-
default = null
153-
nullable = true
154-
}
155-
156153
variable "enable_autoscaling_for_default_pool" {
157154
type = bool
158155
description = "Set `true` to enable automatic scaling of worker based on workload demand."

variables.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,15 @@ variable "worker_pools" {
116116
])
117117
error_message = "Invalid operating system for the given OCP version. Ensure the OS is compatible with the OCP version. Supported compatible OCP version and OS are v4.14: (REDHAT_8_64); v4.15: (REDHAT_8_64, RHCOS) ; v4.16 and v4.17: (REDHAT_8_64, RHCOS, RHEL_9_64)"
118118
}
119+
120+
validation {
121+
condition = alltrue([
122+
for pool in var.worker_pools :
123+
length(regexall("^[a-z0-9]+(?:\\.[a-z0-9]+)*\\.\\d+x\\d+(?:\\.[a-z0-9]+)?$", pool.machine_type)) > 0
124+
])
125+
error_message = "Invalid value provided for one or more machine type."
126+
}
127+
119128
}
120129

121130
variable "worker_pools_taints" {

0 commit comments

Comments
 (0)