Skip to content

Commit

Permalink
scale the machineset
Browse files Browse the repository at this point in the history
Scale the machineset to the desired count before running kube-burner.

run.sh accepts the number of workers to scale for each avaialability
zone in region as env variable. Currently this patch is hard coded to
support us-west-2 region with 4 avaialaility zones.
For example, if user wants to scale US_WEST_2A to 143 nodes and
US_WEST_2B to 188 nodes, pass them to run.sh like below

US_WEST_2A=143 US_WEST_2B=188 WORKLOAD=node-desnity-cni ./run.sh
  • Loading branch information
venkataanil committed Oct 30, 2023
1 parent e67478a commit 4f08d18
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions workloads/kube-burner-ocp-wrapper/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ GC=${GC:-true}
EXTRA_FLAGS=${EXTRA_FLAGS:-}
UUID=${UUID:-$(uuidgen)}
KUBE_DIR=${KUBE_DIR:-/tmp}
US_WEST_2A=${US_WEST_2A:-}
US_WEST_2B=${US_WEST_2B:-}
US_WEST_2C=${US_WEST_2C:-}
US_WEST_2D=${US_WEST_2D:-}

download_binary(){
KUBE_BURNER_URL=https://github.com/cloud-bulldozer/kube-burner/releases/download/v${KUBE_BURNER_VERSION}/kube-burner-V${KUBE_BURNER_VERSION}-linux-x86_64.tar.gz
Expand Down Expand Up @@ -116,6 +120,31 @@ fi
# Capture the exit code of the run, but don't exit the script if it fails.
set +e

# scale machineset
for machineset_name in $(oc get -n openshift-machine-api machineset --no-headers -o custom-columns=":.metadata.name" | grep -i worker); do
region=$(oc get -n openshift-machine-api machineset --no-headers -o custom-columns=":.spec.template.spec.providerSpec.value.placement.availabilityZone" $machineset_name)
# region will be of the form us-west-2a. We need to match it to user provided var i.e replae "-" with '_' and then convert it to upper case.
# For example us-west-2a will be converted to US_WEST_2A.
region_var=$(echo "$region" | tr '-' '_' | tr '[:lower:]' '[:upper:]')
# desired_replicas will be the value stored in US_WEST_2A (if povided by user)
desired_replicas=${!region_var}
if [[ "${desired_replicas}" != "" ]]; then
echo "scale the ${machineset_name} to ${desired_replicas}"
oc scale -n openshift-machine-api machineset "$machineset_name" --replicas="${desired_replicas}"
# wait for 1 hour
for ((i = 1; i <= 720; i++)); do
available_replicas=$(oc get -n openshift-machine-api -o template machineset "$machineset_name" --template={{.status.availableReplicas}})
if [ "$available_replicas" -eq "$desired_replicas" ]; then
echo "Desired number of replicas ($desired_replicas) reached."
break
fi
sleep 5
done

fi
done


# Label workers with ovnic. Metrics from only these workers are pulled.
# node-desnity-cni on 500 nodes runs for 2 hours 15 minutes. Scraping metrics from 500 nodes for the duration of 2 hours 15 minutes is overkill.
# So we scrape from only 10 worker nodes if the worker node count is more than 120.
Expand Down

0 comments on commit 4f08d18

Please sign in to comment.