Created
October 28, 2020 20:43
-
-
Save jcpowermac/9246a8030afe8af15cc2e913d88ca3fb to your computer and use it in GitHub Desktop.
chaos
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| export KUBECONFIG=/projects/installer-testing/vsphere-ipi/auth/kubeconfig | |
| SECRET_PATH=/tmp | |
| oc extract secret/vsphere-creds -n kube-system --to=${SECRET_PATH} | |
| WORKSPACE="$(oc get cm cloud-provider-config -n openshift-config -o jsonpath='{.data.config}' | head -n 10 | tomljson | jq '.Workspace')" | |
| export GOVC_INSECURE=1 | |
| export GOVC_URL="$(echo ${WORKSPACE} | jq '.server' | tr -d '"')" | |
| export GOVC_DATACENTER="$(echo ${WORKSPACE} | jq '.datacenter' | tr -d '"' )" | |
| export GOVC_DATASTORE="$(echo ${WORKSPACE} | jq '.["default-datastore"]' | tr -d '"')" | |
| export GOVC_USERNAME="$(<$SECRET_PATH/${GOVC_URL}.username)" | |
| export GOVC_PASSWORD="$(<$SECRET_PATH/${GOVC_URL}.password)" | |
| function migrate() { | |
| HOSTS=($(govc ls -t HostSystem "/${GOVC_DATACENTER}/host/*")) | |
| HOSTCOUNT="${#HOSTS[@]}" | |
| NODES=$(oc get node -o jsonpath='{.items[*].metadata.name}' -l node-role.kubernetes.io/worker) | |
| for N in ${NODES} | |
| do | |
| loc=$((RANDOM % ${HOSTCOUNT})) | |
| host=${HOSTS[$loc]} | |
| echo "array: ${loc} host: ${host}" | |
| govc vm.migrate -host $host ${N} | |
| done | |
| } | |
| function random_migrate() { | |
| while true; do | |
| migrate | |
| sleep $((30+RANDOM % 60)) | |
| done | |
| } | |
| random_migrate & | |
| openshift-tests run openshift/conformance/parallel -o /projects/output/e2e.log | |
| # no more migrating.. | |
| kill $(jobs -p) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment