Skip to content

Commit

Permalink
adding loop to wait for btp operator
Browse files Browse the repository at this point in the history
  • Loading branch information
matthieupelatan committed Nov 22, 2023
1 parent 6dbfc7f commit 58878d9
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
22 changes: 22 additions & 0 deletions code/setup/btp-setup-automator/btpsa-deployment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,28 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then

kyma alpha enable module btp-operator --channel regular --kyma-name default --wait

# Wait for BTP Operator to be ready
BTP_OPERATOR_READY=0
MAX_RETRIES=30
RETRY_INTERVAL=10

for ((i=1; i<=MAX_RETRIES; i++)); do
if kubectl get pods -n kyma-system | grep -q 'btp-operator.*Running'; then
BTP_OPERATOR_READY=1
break
else
echo "Waiting for BTP Operator to be ready... retry $i/$MAX_RETRIES"
sleep $RETRY_INTERVAL
fi
done

if [ $BTP_OPERATOR_READY -eq 0 ]; then
echo "BTP Operator is not ready. Exiting..."
exit 1
else
echo "BTP Operator is ready."
fi

echo

log "Step 2.1 - Create Namepaces"
Expand Down
23 changes: 23 additions & 0 deletions code/setup/easyfranchise-deployment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,29 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then
&& rm -rf kyma-release kyma.tar.gz

kyma alpha enable module btp-operator --channel regular --kyma-name default --wait

# Wait for BTP Operator to be ready
BTP_OPERATOR_READY=0
MAX_RETRIES=30
RETRY_INTERVAL=10

for ((i=1; i<=MAX_RETRIES; i++)); do
if kubectl get pods -n kyma-system | grep -q 'btp-operator.*Running'; then
BTP_OPERATOR_READY=1
break
else
echo "Waiting for BTP Operator to be ready... retry $i/$MAX_RETRIES"
sleep $RETRY_INTERVAL
fi
done

if [ $BTP_OPERATOR_READY -eq 0 ]; then
echo "BTP Operator is not ready. Exiting..."
exit 1
else
echo "BTP Operator is ready."
fi

else
log "Skipped for Dry Run"
fi
Expand Down

0 comments on commit 58878d9

Please sign in to comment.