#!/bin/bash set -x set -o errexit set -o nounset set -o pipefail TARGET=${TARGET:-OVNKubernetes} # Check if the OVN_SDN_MIGRATION_TIMEOUT environment variable is set and is equal to "0s" if [ -n "$OVN_SDN_MIGRATION_TIMEOUT" ] && [ "$OVN_SDN_MIGRATION_TIMEOUT" = "0s" ]; then unset OVN_SDN_MIGRATION_TIMEOUT fi co_timeout=${OVN_SDN_MIGRATION_TIMEOUT:-1200s} timeout "$co_timeout" bash < /dev/null do echo "migration field is not cleaned by CNO" sleep 3 done EOT # Change network to target network in Network.operator.openshift.io the CR to trigger machine config update by MCO. oc patch Network.operator.openshift.io cluster --type='merge' --patch "{\"spec\":{\"migration\":{\"networkType\":\"${TARGET}\"}}}" # Wait until MCO starts applying new machine config to nodes mco_timeout=${OVN_SDN_MIGRATION_TIMEOUT:-300s} oc wait mcp --all --for='condition=UPDATING=True' --timeout="$mco_timeout" # Wait until MCO finishes its work or it reaches the 45min timeout mcp_timeout=${OVN_SDN_MIGRATION_TIMEOUT:-2700s} timeout "$mcp_timeout" bash <