Skip to content

Commit 7a32ae9

Browse files
nupurg-ibmNupur Goyal
andauthored
Updating cra-config file and adding few other p1 test cases (#164)
Co-authored-by: Nupur Goyal <nupurgoyal@Nupurs-MacBook-Pro.local>
1 parent 137b004 commit 7a32ae9

File tree

16 files changed

+367
-91
lines changed

16 files changed

+367
-91
lines changed

cra-config.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
11
# More info about this file at https://github.com/terraform-ibm-modules/common-pipeline-assets/blob/main/.github/workflows/terraform-test-pipeline.md#cra-config-yaml
22
version: "v1"
3-
CRA_TARGETS: []
3+
CRA_TARGETS:
4+
- CRA_TARGET: "solutions/hpc"
5+
CRA_IGNORE_RULES_FILE: "cra-tf-validate-ignore-rules.json"
6+
PROFILE_ID: "1c13d739-e09e-4bf4-8715-dd82e4498041" # SCC profile ID (currently set to CIS IBM Cloud Foundations Benchmark 1.0.0 profile).
7+
CRA_ENVIRONMENT_VARIABLES:
8+
TF_VAR_cluster_id: "HPC-LSF-1"
9+
TF_VAR_reservation_id: "Contract-IBM-WES-DA"
10+
TF_VAR_bastion_ssh_keys: "[\"geretain-hpc\"]"
11+
TF_VAR_compute_ssh_keys: "[\"geretain-hpc\"]"
12+
TF_VAR_remote_allowed_ips: "[\"49.207.216.50\"]"

ibm_catalog.json

Lines changed: 68 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@
5151
"authority": "scc-v3",
5252
"profiles": [
5353
{
54-
"profile_name": "IBM Cloud Framework for Financial Services",
55-
"profile_version": "1.6.0"
54+
"profile_name": "CIS IBM Cloud Foundations Benchmark",
55+
"profile_version": "1.0.0"
5656
}
5757
]
5858
},
@@ -110,6 +110,55 @@
110110
{
111111
"key": "cluster_prefix"
112112
},
113+
{
114+
"key": "observability_atracker_on_cos_enable"
115+
},
116+
{
117+
"key": "observability_monitoring_enable"
118+
},
119+
{
120+
"key": "observability_monitoring_on_compute_nodes_enable"
121+
},
122+
{
123+
"key": "observability_monitoring_plan",
124+
"default_value": "graduated-tier",
125+
"options": [
126+
{
127+
"displayname": "graduated-tier",
128+
"value": "graduated-tier"
129+
},
130+
{
131+
"displayname": "lite",
132+
"value": "lite"
133+
}
134+
]
135+
},
136+
{
137+
"key": "scc_enable"
138+
},
139+
{
140+
"key": "scc_profile"
141+
},
142+
{
143+
"key": "scc_profile_version"
144+
},
145+
{
146+
"key": "scc_location"
147+
},
148+
{
149+
"key": "scc_event_notification_plan",
150+
"default_value": "lite",
151+
"options": [
152+
{
153+
"displayname": "lite",
154+
"value": "lite"
155+
},
156+
{
157+
"displayname": "standard",
158+
"value": "standard"
159+
}
160+
]
161+
},
113162
{
114163
"key": "vpc_cidr"
115164
},
@@ -147,7 +196,19 @@
147196
"key": "login_image_name"
148197
},
149198
{
150-
"key": "custom_file_shares"
199+
"key": "custom_file_shares",
200+
"type": "array",
201+
"default_value": "[\n {\n \"mount_path\": \"/mnt/vpcstorage/tools\",\n \"size\": 100,\n \"iops\": 2000\n },\n {\n \"mount_path\": \"/mnt/vpcstorage/data\",\n \"size\": 100,\n \"iops\": 6000\n },\n {\n \"mount_path\": \"/mnt/scale/tools\",\n \"nfs_share\": \"\"\n }\n]\n",
202+
"display_name": "JSON",
203+
"required": false,
204+
"custom_config": {
205+
"type": "json_editor",
206+
"grouping": "deployment",
207+
"original_grouping": "deployment",
208+
"config_constraints": {
209+
"type": "mixed"
210+
}
211+
}
151212
},
152213
{
153214
"key": "storage_security_group_id"
@@ -167,29 +228,6 @@
167228
{
168229
"key": "cos_instance_name"
169230
},
170-
{
171-
"key": "observability_atracker_on_cos_enable"
172-
},
173-
{
174-
"key": "observability_monitoring_enable"
175-
},
176-
{
177-
"key": "observability_monitoring_on_compute_nodes_enable"
178-
},
179-
{
180-
"key": "observability_monitoring_plan",
181-
"default_value": "graduated-tier",
182-
"options": [
183-
{
184-
"displayname": "graduated-tier",
185-
"value": "graduated-tier"
186-
},
187-
{
188-
"displayname": "lite",
189-
"value": "lite"
190-
}
191-
]
192-
},
193231
{
194232
"key": "enable_vpc_flow_logs"
195233
},
@@ -205,32 +243,6 @@
205243
{
206244
"key": "kms_key_name"
207245
},
208-
{
209-
"key": "scc_enable"
210-
},
211-
{
212-
"key": "scc_profile"
213-
},
214-
{
215-
"key": "scc_profile_version"
216-
},
217-
{
218-
"key": "scc_location"
219-
},
220-
{
221-
"key": "scc_event_notification_plan",
222-
"default_value": "lite",
223-
"options": [
224-
{
225-
"displayname": "lite",
226-
"value": "lite"
227-
},
228-
{
229-
"displayname": "standard",
230-
"value": "standard"
231-
}
232-
]
233-
},
234246
{
235247
"key": "hyperthreading_enabled"
236248
},
@@ -273,6 +285,9 @@
273285
{
274286
"key": "skip_iam_authorization_policy"
275287
},
288+
{
289+
"key": "skip_iam_share_authorization_policy"
290+
},
276291
{
277292
"key": "existing_certificate_instance"
278293
},
@@ -373,7 +388,7 @@
373388
"description": "Yes"
374389
},
375390
{
376-
"title": "Simplifies risk management and demonstrates regulatory compliance with Financial Services",
391+
"title": "Simplifies risk management and demonstrates regulatory compliance with CIS IBM Cloud Foundations Benchmark Services",
377392
"description": "Yes"
378393
},
379394
{

modules/landing_zone_vsi/configuration_steps/configure_management_vsi.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,7 @@ EOF
390390

391391
# 7. Create resource template for ibmcloudhpc templates
392392
# Define the output JSON file path
393+
393394
ibmcloudhpc_templates="$LSF_RC_IBMCLOUDHPC_CONF/ibmcloudhpc_templates.json"
394395

395396
# Initialize an empty JSON string
@@ -400,6 +401,11 @@ for region in "eu-de" "us-east" "us-south"; do
400401
if [ "$region" = "$regionName" ]; then
401402
# Loop through the core counts
402403
for i in 2 4 8 16 32 48 64 96 128 176; do
404+
if [ "$i" -gt 128 ] && [ "$region" != "us-south" ]; then
405+
# Skip creating templates with more than 128 cores for non us-south regions
406+
continue
407+
fi
408+
403409
ncores=$((i / 2))
404410
if [ "$region" = "eu-de" ] || [ "$region" = "us-east" ]; then
405411
family="mx2"
@@ -430,6 +436,11 @@ for region in "eu-de" "us-east" "us-south"; do
430436
# Split the family string into an array and iterate over it
431437
IFS=',' read -ra families <<< "$family"
432438
for fam in "${families[@]}"; do
439+
# Check if the core count is valid for the family
440+
if [ "$fam" = "mx2" ] && [ "$i" -gt 128 ]; then
441+
continue
442+
fi
443+
433444
templateId="Template-${cluster_prefix}-$((1000+i))-$fam" # Add family to templateId
434445
if [ "$fam" = "mx2" ]; then
435446
maxmem_val="$maxmem_mx2" # Use mx2 specific maxmem value

modules/landing_zone_vsi/image_map.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
locals {
22
image_region_map = {
3-
"hpcaas-lsf10-rhel88-v6" = {
4-
"us-east" = "r014-7c8ff827-42f9-4e52-8ac5-0cabfa83cc08"
5-
"eu-de" = "r010-ef5c9c76-88c9-461a-9ea9-ae3483b12463"
6-
"us-south" = "r006-56948288-f03a-452f-a4e8-13c9523e5aac"
3+
"hpcaas-lsf10-rhel88-v7" = {
4+
"us-east" = "r014-68a7ad8a-c513-418e-a30c-9a04ce0a144a"
5+
"eu-de" = "r010-b392ff76-fb8c-4b0f-9fef-fba89eb3ee5b"
6+
"us-south" = "r006-86f207dd-7029-4705-9222-0f5499387734"
77
},
88
"hpcaas-lsf10-rhel88-compute-v5" = {
99
"us-east" = "r014-deb34fb1-edbf-464c-9af3-7efa2efcff3f"

modules/observability_instance/outputs.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,8 @@ output "cloud_monitoring_prws_url" {
2525
value = "https://ingest.prws.${var.location}.monitoring.cloud.ibm.com/prometheus/remote/write"
2626
description = "IBM Cloud Monitoring Prometheus Remote Write ingestion url"
2727
}
28+
29+
output "cloud_monitoring_url" {
30+
value = var.cloud_monitoring_provision ? "https://cloud.ibm.com/observe/embedded-view/monitoring/${module.observability_instance.cloud_monitoring_guid}" : null
31+
description = "IBM Cloud Monitoring URL"
32+
}

solutions/hpc/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@
111111
| <a name="input_login_image_name"></a> [login\_image\_name](#input\_login\_image\_name) | Name of the custom image that you want to use to create virtual server instances in your IBM Cloud account to deploy the IBM Cloud HPC cluster login node. By default, the solution uses a RHEL 8-8 OS image with additional software packages mentioned [here](https://cloud.ibm.com/docs/ibm-spectrum-lsf#create-custom-image). The solution also offers, Ubuntu 22-04 OS base image (hpcaas-lsf10-ubuntu2204-compute-v4). If you would like to include your application-specific binary files, follow the instructions in [ Planning for custom images ](https://cloud.ibm.com/docs/vpc?topic=vpc-planning-custom-images) to create your own custom image and use that to build the IBM Cloud HPC cluster through this offering. | `string` | `"hpcaas-lsf10-rhel88-compute-v5"` | no |
112112
| <a name="input_login_node_instance_type"></a> [login\_node\_instance\_type](#input\_login\_node\_instance\_type) | Specify the virtual server instance profile type to be used to create the login node for the IBM Cloud HPC cluster. For choices on profile types, see [Instance profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles). | `string` | `"bx2-2x8"` | no |
113113
| <a name="input_login_subnet_id"></a> [login\_subnet\_id](#input\_login\_subnet\_id) | Provide the list of existing subnet ID under the existing VPC, where the login/bastion server will be provisioned. One subnet id is required as input value for the creation of login node and bastion in the same zone as the management nodes. Note: Provide a different subnet id for login\_subnet\_id, do not overlap or provide the same subnet id that was already provided for cluster\_subnet\_ids. | `string` | `null` | no |
114-
| <a name="input_management_image_name"></a> [management\_image\_name](#input\_management\_image\_name) | Name of the custom image that you want to use to create virtual server instances in your IBM Cloud account to deploy the IBM Cloud HPC cluster management nodes. By default, the solution uses a RHEL88 base image with additional software packages mentioned [here](https://cloud.ibm.com/docs/ibm-spectrum-lsf#create-custom-image). If you would like to include your application-specific binary files, follow the instructions in [ Planning for custom images ](https://cloud.ibm.com/docs/vpc?topic=vpc-planning-custom-images) to create your own custom image and use that to build the IBM Cloud HPC cluster through this offering. | `string` | `"hpcaas-lsf10-rhel88-v6"` | no |
114+
| <a name="input_management_image_name"></a> [management\_image\_name](#input\_management\_image\_name) | Name of the custom image that you want to use to create virtual server instances in your IBM Cloud account to deploy the IBM Cloud HPC cluster management nodes. By default, the solution uses a RHEL88 base image with additional software packages mentioned [here](https://cloud.ibm.com/docs/ibm-spectrum-lsf#create-custom-image). If you would like to include your application-specific binary files, follow the instructions in [ Planning for custom images ](https://cloud.ibm.com/docs/vpc?topic=vpc-planning-custom-images) to create your own custom image and use that to build the IBM Cloud HPC cluster through this offering. | `string` | `"hpcaas-lsf10-rhel88-v7"` | no |
115115
| <a name="input_management_node_count"></a> [management\_node\_count](#input\_management\_node\_count) | Number of management nodes. This is the total number of management nodes. Enter a value between 1 and 10. | `number` | `3` | no |
116116
| <a name="input_management_node_instance_type"></a> [management\_node\_instance\_type](#input\_management\_node\_instance\_type) | Specify the virtual server instance profile type to be used to create the management nodes for the IBM Cloud HPC cluster. For choices on profile types, see [Instance profiles](https://cloud.ibm.com/docs/vpc?topic=vpc-profiles). | `string` | `"bx2-16x64"` | no |
117117
| <a name="input_observability_atracker_on_cos_enable"></a> [observability\_atracker\_on\_cos\_enable](#input\_observability\_atracker\_on\_cos\_enable) | Enable Activity tracker service instance connected to Cloud Object Storage (COS). All the events will be stored into COS so that customers can connect to it and read those events or ingest them in their system. | `bool` | `true` | no |

solutions/hpc/locals.tf

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,12 +232,11 @@ locals {
232232

233233
# locals needed for ssh connection
234234
locals {
235-
ssh_forward_host = (var.app_center_high_availability ? "pac.${var.dns_domain_name.compute}" : "localhost")
236-
ssh_forwards = "-L 8443:${local.ssh_forward_host}:8443 -L 6080:${local.ssh_forward_host}:6080"
235+
ssh_forward_host = (var.app_center_high_availability ? "pac.${var.dns_domain_name.compute}" : local.management_private_ip)
236+
ssh_forwards = "-L 8443:${local.ssh_forward_host}:8443 -L 6080:${local.ssh_forward_host}:6080 -L 8444:${local.ssh_forward_host}:8444"
237237
ssh_jump_host = local.bastion_instance_public_ip != null ? local.bastion_instance_public_ip : var.enable_fip ? module.bootstrap.bastion_fip[0] : module.bootstrap.bastion_primary_ip
238238
ssh_jump_option = "-J ubuntu@${local.ssh_jump_host}"
239-
ssh_host = var.app_center_high_availability ? local.login_private_ips[0] : local.management_private_ip
240-
ssh_cmd = "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ServerAliveInterval=5 -o ServerAliveCountMax=1 ${local.ssh_forwards} ${local.ssh_jump_option} lsfadmin@${local.ssh_host}"
239+
ssh_cmd = "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ServerAliveInterval=5 -o ServerAliveCountMax=1 ${local.ssh_forwards} ${local.ssh_jump_option} lsfadmin@${join(",", local.login_private_ips)}"
241240
}
242241

243242
# Existing bastion Variables

solutions/hpc/outputs.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,8 @@ output "ldap_ips" {
8787
description = "LDAP nodes have these IPs:"
8888
value = local.print_extra_outputs ? local.ldap_private_ips : null
8989
}
90+
91+
output "cloud_monitoring_url" {
92+
value = var.observability_monitoring_enable ? module.cloud_monitoring_instance_creation.cloud_monitoring_url : null
93+
description = "IBM Cloud Monitoring URL"
94+
}

solutions/hpc/variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ variable "login_node_instance_type" {
176176
}
177177
variable "management_image_name" {
178178
type = string
179-
default = "hpcaas-lsf10-rhel88-v6"
179+
default = "hpcaas-lsf10-rhel88-v7"
180180
description = "Name of the custom image that you want to use to create virtual server instances in your IBM Cloud account to deploy the IBM Cloud HPC cluster management nodes. By default, the solution uses a RHEL88 base image with additional software packages mentioned [here](https://cloud.ibm.com/docs/ibm-spectrum-lsf#create-custom-image). If you would like to include your application-specific binary files, follow the instructions in [ Planning for custom images ](https://cloud.ibm.com/docs/vpc?topic=vpc-planning-custom-images) to create your own custom image and use that to build the IBM Cloud HPC cluster through this offering."
181181

182182
}

tests/common_utils/utils.go

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"bufio"
55
"bytes"
66
"context"
7+
"encoding/json"
78
"errors"
89
"fmt"
910
"math/rand"
@@ -17,7 +18,7 @@ import (
1718
"testing"
1819
"time"
1920

20-
"github.com/IBM/go-sdk-core/core"
21+
"github.com/IBM/go-sdk-core/v5/core"
2122
"github.com/IBM/secrets-manager-go-sdk/secretsmanagerv2"
2223
"github.com/stretchr/testify/assert"
2324
"github.com/terraform-ibm-modules/ibmcloud-terratest-wrapper/testhelper"
@@ -723,3 +724,44 @@ func GetDnsCustomResolverIds(outputs map[string]interface{}) (string, string) {
723724
}
724725
return instanceId, customResolverId
725726
}
727+
728+
// Configuration struct matches the structure of your JSON data
729+
type Configuration struct {
730+
ClusterID string `json:"ClusterID"`
731+
ReservationID string `json:"ReservationID"`
732+
ClusterPrefixName string `json:"ClusterPrefixName"`
733+
ResourceGroup string `json:"ResourceGroup"`
734+
KeyManagement string `json:"KeyManagement"`
735+
DnsDomainName string `json:"DnsDomainName"`
736+
Zones string `json:"Zones"`
737+
HyperthreadingEnabled bool `json:"HyperthreadingEnabled"`
738+
BastionIP string `json:"bastionIP"`
739+
ManagementNodeIPList []string `json:"managementNodeIPList"`
740+
LoginNodeIP string `json:"loginNodeIP"`
741+
LdapServerIP string `json:"LdapServerIP"`
742+
LdapDomain string `json:"LdapDomain"`
743+
LdapAdminPassword string `json:"LdapAdminPassword"`
744+
LdapUserName string `json:"LdapUserName"`
745+
LdapUserPassword string `json:"LdapUserPassword"`
746+
AppCenterEnabledOrNot string `json:"APPCenterEnabledOrNot"`
747+
SshKeyPath string `json:"ssh_key_path"`
748+
}
749+
750+
// ParseConfig reads a JSON file from the given file path and parses it into a Configuration struct
751+
func ParseConfig(filePath string) (*Configuration, error) {
752+
// Read the entire content of the file
753+
byteValue, err := os.ReadFile(filePath)
754+
if err != nil {
755+
return nil, fmt.Errorf("error reading file %s: %w", filePath, err)
756+
}
757+
758+
// Unmarshal the JSON data into the Configuration struct
759+
var config Configuration
760+
err = json.Unmarshal(byteValue, &config)
761+
if err != nil {
762+
return nil, fmt.Errorf("error parsing JSON from file %s: %w", filePath, err)
763+
}
764+
765+
// Return the configuration struct and nil error on success
766+
return &config, nil
767+
}

0 commit comments

Comments
 (0)