Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable validation-webhook daemonset for managed clusters #361

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
31 changes: 30 additions & 1 deletion workloads/kube-burner-ocp-wrapper/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,32 @@ EXTRA_FLAGS=${EXTRA_FLAGS:-}
UUID=$(uuidgen)
KUBE_DIR=${KUBE_DIR:-/tmp}

check_managed_cluster() {
status=$(oc get infrastructure/cluster -o=jsonpath='{.status.platformStatus.*.resourceTags[0]}')
if [[ $status =~ managed ]]; then
echo "Detected a Managed Cluster"
managed=true
fi
}

remove_managed_webhook_validation() {
echo "Disabling validation-webhook for Managed cluster"
oc patch -n openshift-validation-webhook daemonset validation-webhook -p '{"spec": {"template": {"spec": {"nodeSelector": {"non-existing": "true"}}}}}'

}

add_managed_webhook_validation() {
echo "Enabling validation-webhook for Managed cluster"
oc patch -n openshift-validation-webhook daemonset validation-webhook --type json -p '[{ "op": "remove", "path": "/spec/template/spec/nodeSelector" }]'
}

download_binary(){
KUBE_BURNER_URL=https://github.com/cloud-bulldozer/kube-burner/releases/download/v${KUBE_BURNER_VERSION}/kube-burner-${KUBE_BURNER_VERSION}-Linux-x86_64.tar.gz
curl -sS -L ${KUBE_BURNER_URL} | tar -xzC ${KUBE_DIR}/ kube-burner
}

check_managed_cluster
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes on this file are not required as I stated in my comment


hypershift(){
echo "HyperShift detected"
# Get hosted cluster ID and name
Expand Down Expand Up @@ -96,5 +117,13 @@ EOF
)
curl -k -sS -X POST -H "Content-type: application/json" ${ES_SERVER}/ripsaw-kube-burner/_doc -d "${METADATA}" -o /dev/null

if [[ $managed == true ]]; then
remove_managed_webhook_validation
fi

echo $cmd
exec $cmd
$cmd

if [[ $managed == true ]]; then
add_managed_webhook_validation
fi
19 changes: 19 additions & 0 deletions workloads/kube-burner/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,25 @@ run_workload() {
gen_metadata ${WORKLOAD} ${start_date} $(date +%s%3N)
}

check_managed_cluster() {
status=$(oc get infrastructure/cluster -o=jsonpath='{.status.platformStatus.*.resourceTags[0]}')
if [[ $status =~ managed ]]; then
log "Detected a Managed Cluster"
managed=true
fi
}

remove_managed_webhook_validation() {
log "Disabling validation-webhook for Managed cluster"
oc patch -n openshift-validation-webhook daemonset validation-webhook -p '{"spec": {"template": {"spec": {"nodeSelector": {"non-existing": "true"}}}}}'

}

add_managed_webhook_validation() {
log "Enabling validation-webhook for Managed cluster"
oc patch -n openshift-validation-webhook daemonset validation-webhook --type json -p '[{ "op": "remove", "path": "/spec/template/spec/nodeSelector" }]'
}

find_running_pods_num() {
pod_count=0
# The next statement outputs something similar to:
Expand Down
10 changes: 10 additions & 0 deletions workloads/kube-burner/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
. ../../utils/compare.sh

label=""

check_managed_cluster
if [[ $managed == true ]]; then
remove_managed_webhook_validation
fi

case ${WORKLOAD} in
cluster-density)
WORKLOAD_TEMPLATE=workloads/cluster-density/cluster-density.yml
Expand Down Expand Up @@ -163,6 +169,10 @@ else
run_workload
fi

if [[ $managed == true ]]; then
add_managed_webhook_validation
fi

if [[ ${CLEANUP_WHEN_FINISH} == "true" ]]; then
cleanup
if [[ ${WORKLOAD} == node-density* || ${WORKLOAD} == pod-density-heavy ]]; then
Expand Down