|
1 | 1 | #!/bin/bash |
2 | 2 |
|
| 3 | +#### Global vars |
| 4 | +# vsi_images hashmap contains the list of valid vsi-images that can be used within fleets |
| 5 | +# The fleet sandbox can be setup on regions with a valid vsi-image, only. |
| 6 | +declare -A vsi_images |
| 7 | +vsi_images["eu-de"]=r010-e7b25759-7857-455a-aec0-904b65c3c4cb |
| 8 | +vsi_images["eu-gb"]=r018-31655c46-96e7-4d38-b61a-2ab1b66b9bbd |
| 9 | +vsi_images["us-east"]=r014-b7f47448-72db-4012-b018-bb120518b078 |
| 10 | + |
3 | 11 | # Env vars |
4 | 12 | CLEANUP_ON_ERROR=${CLEANUP_ON_ERROR:=false} |
5 | 13 | CLEANUP_ON_SUCCESS=${CLEANUP_ON_SUCCESS:=false} |
@@ -32,6 +40,13 @@ sysdig_key_name="${NAME_PREFIX}--sysdig-key" |
32 | 40 | SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) |
33 | 41 | source ${SCRIPT_DIR}/common.sh |
34 | 42 |
|
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | + |
35 | 50 | # Clean up previous run |
36 | 51 | function clean() { |
37 | 52 | ( |
@@ -146,6 +161,14 @@ echo "Please note: This script will install various IBM Cloud resources within t |
146 | 161 | print_msg "\nChecking prerequisites ..." |
147 | 162 | check_prerequisites |
148 | 163 |
|
| 164 | +# checking if a there is a valid vsi-image in the region available |
| 165 | +vsi_image_id=${vsi_images[${REGION}]} |
| 166 | + |
| 167 | +if [[ $vsi_image_id == "" || $vsi_image_id == null ]]; then |
| 168 | + echo " Fleet sandbox setup is currently not supported in region ($region), exiting setup... " |
| 169 | + exit -1 |
| 170 | +fi |
| 171 | + |
149 | 172 | # Ensure that latest versions of used IBM Cloud ClI is installed |
150 | 173 | print_msg "\nPulling latest IBM Cloud CLI release ..." |
151 | 174 | ibmcloud update --force |
@@ -409,16 +432,15 @@ ibmcloud ce secret create --name fleet-registry-secret --format registry --serve |
409 | 432 |
|
410 | 433 | # using the common base VSI image "jwe-ubuntu24-gpu" enabled for GPU and including podman and s3fs |
411 | 434 | print_msg "\nCreating a Code Engine configmap 'fleet-vpc-config' to access the new VPC ..." |
412 | | -# retrieve the best fitting ubuntu vsi base image by selection from available image list |
413 | | -vsi-image-id=$(ibmcloud is images --output JSON|jq -r 'first( .[]|select(.name | startswith("ibm-ubuntu-24")) ) | .id') |
| 435 | + |
414 | 436 | print_msg "\nSelected the ubuntu-24 vsi image for fleets with the image-id = $vsi-image-id" |
415 | 437 | ibmcloud ce configmap create --name fleet-vpc-config \ |
416 | 438 | --from-literal NETWORK_ZONE="${REGION}-1" \ |
417 | 439 | --from-literal SSH_SECRET_NAME="fleet-ssh-secret" \ |
418 | 440 | --from-literal VPC_ID="$(ibmcloud is vpc ${vpc_name} --output json | jq -r '.id')" \ |
419 | 441 | --from-literal SUBNET_ID="$(ibmcloud is subnet ${vpc_name}-subnet --output json | jq -r '.id')" \ |
420 | 442 | --from-literal SECURITY_GROUP_ID="$(ibmcloud is security-group ${vpc_name}-group --output json | jq -r '.id')" \ |
421 | | ---from-literal VSI_IMAGE_ID="$vsi-image-id" \ |
| 443 | +--from-literal VSI_IMAGE_ID="$vsi_image_id" \ |
422 | 444 | --from-literal VSI_PREFERRED_PROFILE="cx2-2x4" |
423 | 445 |
|
424 | 446 | # alternative to fetch the latest stock image: |
|
0 commit comments