Skip to content

Commit 8fbcaa1

Browse files
committed
Check for empty pull-secrets
1 parent 8cc0ad1 commit 8fbcaa1

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

hack/lib/catalogsource.bash

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,8 @@ function install_catalogsource {
9191
# updating machine config pools takes a while.
9292
create_image_content_source_policy "$index_image" "$registry_redhat_io" "$registry_quay" "$tmpfile"
9393
[ -n "$OPENSHIFT_CI" ] && cat "$tmpfile"
94-
if oc apply -f "$tmpfile"; then
94+
# See: https://github.com/kubernetes/kubernetes/issues/52577#issuecomment-2516606002
95+
if LANG=C oc apply -f "$tmpfile" | grep -v unchanged; then
9596
echo "Wait for machineconfigpool update to start"
9697
timeout 120 "[[ True != \$(oc get machineconfigpool --no-headers=true '-o=custom-columns=UPDATING:.status.conditions[?(@.type==\"Updating\")].status' | uniq) ]]"
9798
echo "Wait until all machineconfigpools are updated"
@@ -115,8 +116,11 @@ EOF
115116
# Ensure the Index pod is created with the right pull secret. The Pod's service account needs
116117
# to be linked with the right pull secret before creating the Pod. This is to prevent race conditions.
117118
timeout 120 "[[ \$(oc -n $OLM_NAMESPACE get pods -l olm.catalogSource=serverless-operator --no-headers | wc -l) != 1 ]]"
118-
index_pod=$(oc -n "$OLM_NAMESPACE" get pods -l olm.catalogSource=serverless-operator -oname)
119-
if ! oc -n "$OLM_NAMESPACE" get "$index_pod" -ojsonpath='{.spec.imagePullSecrets}' | grep dockercfg &>/dev/null; then
119+
120+
# check if pull secrets are present, see: https://unix.stackexchange.com/a/388462
121+
# shellcheck disable=SC2266
122+
if oc -n "$OLM_NAMESPACE" get pod -l olm.catalogSource=serverless-operator -ojsonpath='{.items[].spec.imagePullSecrets}' | [ ! -t 0 ]; then
123+
# wait until they have dockercfg one
120124
timeout 120 "[[ \$(oc -n $OLM_NAMESPACE get sa serverless-operator -ojsonpath='{.imagePullSecrets}' | grep -c dockercfg) == 0 ]]"
121125
oc -n "$OLM_NAMESPACE" delete pods -l olm.catalogSource=serverless-operator
122126
fi

0 commit comments

Comments
 (0)