Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions experimental/serverless-fleets/init-fleet-sandbox
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#!/bin/bash

#### Global vars
# vsi_images hashmap contains the list of valid vsi-images that can be used within fleets
# The fleet sandbox can be setup on regions with a valid vsi-image, only.
declare -A vsi_images
vsi_images["eu-de"]=r010-e7b25759-7857-455a-aec0-904b65c3c4cb
vsi_images["eu-gb"]=r018-31655c46-96e7-4d38-b61a-2ab1b66b9bbd
vsi_images["us-east"]=r014-b7f47448-72db-4012-b018-bb120518b078

# Env vars
CLEANUP_ON_ERROR=${CLEANUP_ON_ERROR:=false}
CLEANUP_ON_SUCCESS=${CLEANUP_ON_SUCCESS:=false}
Expand Down Expand Up @@ -146,6 +154,14 @@ echo "Please note: This script will install various IBM Cloud resources within t
print_msg "\nChecking prerequisites ..."
check_prerequisites

# checking if a there is a valid vsi-image in the region available
vsi_image_id=${vsi_images[${REGION}]}

if [[ $vsi_image_id == "" || $vsi_image_id == null ]]; then
echo " Fleet sandbox setup is currently not supported in region ($region), exiting setup... "
exit -1
fi

# Ensure that latest versions of used IBM Cloud ClI is installed
print_msg "\nPulling latest IBM Cloud CLI release ..."
ibmcloud update --force
Expand Down Expand Up @@ -409,16 +425,15 @@ ibmcloud ce secret create --name fleet-registry-secret --format registry --serve

# using the common base VSI image "jwe-ubuntu24-gpu" enabled for GPU and including podman and s3fs
print_msg "\nCreating a Code Engine configmap 'fleet-vpc-config' to access the new VPC ..."
# retrieve the best fitting ubuntu vsi base image by selection from available image list
vsi-image-id=$(ibmcloud is images --output JSON|jq -r 'first( .[]|select(.name | startswith("ibm-ubuntu-24")) ) | .id')

print_msg "\nSelected the ubuntu-24 vsi image for fleets with the image-id = $vsi-image-id"
ibmcloud ce configmap create --name fleet-vpc-config \
--from-literal NETWORK_ZONE="${REGION}-1" \
--from-literal SSH_SECRET_NAME="fleet-ssh-secret" \
--from-literal VPC_ID="$(ibmcloud is vpc ${vpc_name} --output json | jq -r '.id')" \
--from-literal SUBNET_ID="$(ibmcloud is subnet ${vpc_name}-subnet --output json | jq -r '.id')" \
--from-literal SECURITY_GROUP_ID="$(ibmcloud is security-group ${vpc_name}-group --output json | jq -r '.id')" \
--from-literal VSI_IMAGE_ID="$vsi-image-id" \
--from-literal VSI_IMAGE_ID="$vsi_image_id" \
--from-literal VSI_PREFERRED_PROFILE="cx2-2x4"

# alternative to fetch the latest stock image:
Expand Down