From 0ca31e6d87e1ef6684e4936552c4d8bbff941f66 Mon Sep 17 00:00:00 2001 From: skordas Date: Fri, 13 May 2022 13:49:31 -0400 Subject: [PATCH 1/2] Getting machineset using additional label flag to ignore 'infra' nodes. --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index b8f968c3..6b4ebb96 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -71,14 +71,14 @@ pipeline { echo -e "\033[1m$(date "+%d-%m-%YT%H:%M:%S") ${@}\033[0m" } function scaleMachineSets(){ - scale_num=$(oc get --no-headers machinesets -A | awk '{print $2}' | wc -l | xargs) + scale_num=$(oc get --no-headers machinesets -A -l machine.openshift.io/cluster-api-cluster | awk '{print $2}' | wc -l | xargs) scale_size=$(($1/$scale_num)) set -x - for machineset in $(oc get --no-headers machinesets -A | awk '{print $2}'); do + for machineset in $(oc get --no-headers machinesets -A -l machine.openshift.io/cluster-api-cluster | awk '{print $2}'); do oc scale machinesets -n openshift-machine-api $machineset --replicas $scale_size done if [[ $(($1%$scale_num)) != 0 ]]; then - oc scale machinesets -n openshift-machine-api $(oc get --no-headers machinesets -A | awk '{print $2}' | head -1) --replicas $(($scale_size+$(($1%$scale_num)))) + oc scale machinesets -n openshift-machine-api $(oc get --no-headers machinesets -A -l machine.openshift.io/cluster-api-cluster | awk '{print $2}' | head -1) --replicas $(($scale_size+$(($1%$scale_num)))) fi set +x local retries=0 From 9f474af6d2fd317a5a5fd893574c118502776576 Mon Sep 17 00:00:00 2001 From: skordas Date: Mon, 16 May 2022 12:56:35 -0400 Subject: [PATCH 2/2] Getting machineset using flag to ignore 'infra' and `workload` nodes. --- Jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6b4ebb96..069e6186 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -71,14 +71,14 @@ pipeline { echo -e "\033[1m$(date "+%d-%m-%YT%H:%M:%S") ${@}\033[0m" } function scaleMachineSets(){ - scale_num=$(oc get --no-headers machinesets -A -l machine.openshift.io/cluster-api-cluster | awk '{print $2}' | wc -l | xargs) + scale_num=$(oc get --no-headers machinesets -A -l machine.openshift.io/cluster-api-machine-role!=infra,machine.openshift.io/cluster-api-machine-role!=workload | awk '{print $2}' | wc -l | xargs) scale_size=$(($1/$scale_num)) set -x - for machineset in $(oc get --no-headers machinesets -A -l machine.openshift.io/cluster-api-cluster | awk '{print $2}'); do + for machineset in $(oc get --no-headers machinesets -A -l machine.openshift.io/cluster-api-machine-role!=infra,machine.openshift.io/cluster-api-machine-role!=workload | awk '{print $2}'); do oc scale machinesets -n openshift-machine-api $machineset --replicas $scale_size done if [[ $(($1%$scale_num)) != 0 ]]; then - oc scale machinesets -n openshift-machine-api $(oc get --no-headers machinesets -A -l machine.openshift.io/cluster-api-cluster | awk '{print $2}' | head -1) --replicas $(($scale_size+$(($1%$scale_num)))) + oc scale machinesets -n openshift-machine-api $(oc get --no-headers machinesets -A -l machine.openshift.io/cluster-api-machine-role!=infra,machine.openshift.io/cluster-api-machine-role!=workload | awk '{print $2}' | head -1) --replicas $(($scale_size+$(($1%$scale_num)))) fi set +x local retries=0