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

OCPBUGS-32016: Wait for sriov-operator Pods to be running #51417

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -59,23 +59,46 @@ wait_for_sriov_pods() {
fi
}

wait_for_webhook() {
wait_for_operator_webhook() {
# Even if the pods are ready, we need to wait for the webhook server to be
# actually started, which usually takes a few seconds.
for _ in $(seq 1 30); do
WEBHOOK_NAME=$(oc get validatingwebhookconfigurations.admissionregistration.k8s.io sriov-operator-webhook-config -o jsonpath='{.metadata.name}')
if [ "${WEBHOOK_NAME}" == "sriov-operator-webhook-config" ]; then
WEBHOOK_READY=true
OPERATOR_CURRENT_NUMBER=$(oc get DaemonSet operator-webhook -n openshift-sriov-network-operator -o jsonpath='{.status.numberReady}')
OPERATOR_DESIRED_NUMBER=$(oc get DaemonSet operator-webhook -n openshift-sriov-network-operator -o jsonpath='{.status.desiredNumberScheduled}')
if [ "${OPERATOR_CURRENT_NUMBER}" == "${OPERATOR_DESIRED_NUMBER}" ]; then
OPERATOR_WEBHOOK_READY=true
break
fi
echo "Waiting for webhook pods to be running"
echo "Waiting for operator webhook pods to be running"
oc get DaemonSet operator-webhook -n openshift-sriov-network-operator
sleep 2
done

if [ -n "${WEBHOOK_READY:-}" ] ; then
echo "webhook started succesfully"
if [ -n "${OPERATOR_WEBHOOK_READY:-}" ] ; then
echo "operator webhook started succesfully"
else
echo "webhook did not start succesfully"
echo "operator webhook did not start succesfully"
exit 1
fi
}

wait_for_injector_webhook() {
for _ in $(seq 1 30); do
INJECTOR_CURRENT_NUMBER=$(oc get DaemonSet network-resources-injector -n openshift-sriov-network-operator -o jsonpath='{.status.numberReady}')
INJECTOR_DESIRED_NUMBER=$(oc get DaemonSet network-resources-injector -n openshift-sriov-network-operator -o jsonpath='{.status.desiredNumberScheduled}')
if [ "${INJECTOR_CURRENT_NUMBER}" == "${INJECTOR_DESIRED_NUMBER}" ]; then
INJECTOR_WEBHOOK_READY=true
break
fi
echo "Waiting for injector webhook pods to be running"
oc get DaemonSet network-resources-injector -n openshift-sriov-network-operator
sleep 2
done

if [ -n "${INJECTOR_WEBHOOK_READY:-}" ] ; then
echo "injector webhook started succesfully"
else
echo "injector webhook did not start succesfully"
exit 1
fi
}
Expand Down Expand Up @@ -155,7 +178,12 @@ create_default_sriov_operator_config

WEBHOOK_ENABLED=$(oc get sriovoperatorconfig/default -n openshift-sriov-network-operator -o jsonpath='{.spec.enableOperatorWebhook}')
if [ "${WEBHOOK_ENABLED}" == true ]; then
wait_for_webhook
wait_for_operator_webhook
fi

WEBHOOK_ENABLED=$(oc get sriovoperatorconfig/default -n openshift-sriov-network-operator -o jsonpath='{.spec.enableInjector}')
if [ "${WEBHOOK_ENABLED}" == true ]; then
wait_for_injector_webhook
fi

if [[ "${OPENSTACK_SRIOV_NETWORK}" == *"mellanox"* ]]; then
Expand Down