Skip to content

Commit

Permalink
Added the running rosa spots ability
Browse files Browse the repository at this point in the history
Signed-off-by: Thirumalesh Aaraveti <[email protected]>
  • Loading branch information
rsevilla87 authored and athiruma committed Aug 1, 2023
1 parent 426a748 commit a0e3a1b
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 4 deletions.
17 changes: 17 additions & 0 deletions dags/openshift_nightlies/config/install/rosa/ovn-small-spot.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"aws_profile": "",
"aws_access_key_id": "",
"aws_secret_access_key": "",
"aws_authentication_method": "sts",
"rosa_environment": "staging",
"rosa_cli_version": "container",
"ocm_environment": "stage",
"managed_channel_group": "nightly",
"managed_ocp_version": "latest",
"openshift_worker_count": 24,
"openshift_network_type": "OVNKubernetes",
"openshift_worker_instance_type": "m5.2xlarge",
"machineset_metadata_label_prefix": "machine.openshift.io",
"openshift_workload_node_instance_type": "m5.2xlarge",
"enable_spot_workers": true
}
24 changes: 21 additions & 3 deletions dags/openshift_nightlies/scripts/install/rosa.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,17 @@ _wait_for_nodes_ready(){
NODES_COUNT=$2
ALL_READY_ITERATIONS=4 #reduced extra buffers for hosted cp clusters
else
# Node count is number of workers + 3 infra
NODES_COUNT=$(($2+3))
if [ "$3" == "rosa-spots=true" ]; then
NODES_COUNT=$2
else
if [ "$SPOT_POOL_READY" == "true" ]; then
# Node count is number of workers pool + 3 infra + 3 default Nodes
NODES_COUNT=$(($2+3+3))
else
# Node count is number of workers + 3 infra
NODES_COUNT=$(($2+3))
fi
fi
fi
# 30 seconds per node, waiting for all nodes ready to finalize
while [ ${ITERATIONS} -le $((${NODES_COUNT}*5)) ] ; do
Expand Down Expand Up @@ -445,6 +454,7 @@ setup(){
export NETWORK_TYPE=$(cat ${json_file} | jq -r .openshift_network_type)
export ES_SERVER=$(cat ${json_file} | jq -r .es_server)
export HCP=$(cat ${json_file} | jq -r .rosa_hcp)
export ENABLE_SPOT_WORKERS=$(cat ${json_file} | jq -r .enable_spot_workers)
export UUID=$(uuidgen)
if [ $HCP == "true" ]; then
export STAGE_CONFIG=""
Expand Down Expand Up @@ -557,7 +567,15 @@ install(){
else
INSTALLATION_PARAMS="${INSTALLATION_PARAMS} --multi-az" # Multi AZ is default on hosted-cp cluster
fi
rosa create cluster --tags=User:${GITHUB_USERNAME} --cluster-name ${CLUSTER_NAME} --version "${ROSA_VERSION}" --channel-group=${MANAGED_CHANNEL_GROUP} --compute-machine-type ${COMPUTE_WORKERS_TYPE} --replicas ${COMPUTE_WORKERS_NUMBER} --network-type ${NETWORK_TYPE} ${INSTALLATION_PARAMS} ${ROSA_HCP_PARAMS}
if [ "$ENABLE_SPOT_WORKERS" == "true" ]; then
rosa create cluster --tags=User:${GITHUB_USERNAME} --cluster-name ${CLUSTER_NAME} --version "${ROSA_VERSION}" --channel-group=${MANAGED_CHANNEL_GROUP} --compute-machine-type ${COMPUTE_WORKERS_TYPE} --network-type ${NETWORK_TYPE} ${INSTALLATION_PARAMS} ${ROSA_HCP_PARAMS}
_wait_for_cluster_ready ${CLUSTER_NAME}
rosa create machinepool -c ${CLUSTER_NAME} --name="${CLUSTER_NAME}-spot-pool" --replicas=${COMPUTE_WORKERS_NUMBER} --instance-type="${COMPUTE_WORKERS_TYPE}" --labels="rosa-spots=true" --use-spot-instances
_wait_for_nodes_ready $CLUSTER_NAME $COMPUTE_WORKERS_NUMBER "rosa-spots=true"
export SPOT_POOL_READY=true
else
rosa create cluster --tags=User:${GITHUB_USERNAME} --cluster-name ${CLUSTER_NAME} --version "${ROSA_VERSION}" --channel-group=${MANAGED_CHANNEL_GROUP} --compute-machine-type ${COMPUTE_WORKERS_TYPE} --replicas ${COMPUTE_WORKERS_NUMBER} --network-type ${NETWORK_TYPE} ${INSTALLATION_PARAMS} ${ROSA_HCP_PARAMS}
fi
fi
postinstall
return 0
Expand Down
4 changes: 3 additions & 1 deletion dags/openshift_nightlies/tasks/install/rosa/defaults.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,7 @@
"staging_mgmt_provisioner_shards": "",
"aws_region": "us-west-2",
"oidc_config": "",
"extra_machinepool": []
"extra_machinepool": [],
"openshift_workload_node_instance_type": null,
"enable_spot_workers": false
}

0 comments on commit a0e3a1b

Please sign in to comment.