From aebd29ce1285302c27ad6695da4e421fec377adc Mon Sep 17 00:00:00 2001 From: D056267 Date: Tue, 21 Nov 2023 16:48:25 +0100 Subject: [PATCH 1/3] btp-operator module --- code/setup/btp-setup-automator/btpsa-deployment.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/code/setup/btp-setup-automator/btpsa-deployment.sh b/code/setup/btp-setup-automator/btpsa-deployment.sh index f8a3e43..7701cdb 100644 --- a/code/setup/btp-setup-automator/btpsa-deployment.sh +++ b/code/setup/btp-setup-automator/btpsa-deployment.sh @@ -86,6 +86,19 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then log "####################################################################################################" echo "" + log "Step 3.1 - Enable BTP Operator" + if [ "$DRY_RUN" = false ]; then + curl -Lo kyma.tar.gz "https://github.com/kyma-project/cli/releases/download/$(curl -s https://api.github.com/repos/kyma-project/cli/releases/latest | grep tag_name | cut -d '"' -f 4)/kyma_Linux_x86_64.tar.gz" \ + && mkdir kyma-release && tar -C kyma-release -zxvf kyma.tar.gz && chmod +x kyma-release/kyma && sudo mv kyma-release/kyma /usr/local/bin \ + && rm -rf kyma-release kyma.tar.gz + + kyma alpha enable module btp-operator --channel regular --kyma-name default --wait + else + log "Skipped for Dry Run" + fi + + echo + log "Step 2.1 - Create Namepaces" kubectl create namespace integration || true kubectl create namespace backend || true From 6dbfc7f9f0df612bba8c58fa0740c71ed98f5e10 Mon Sep 17 00:00:00 2001 From: D056267 Date: Tue, 21 Nov 2023 16:53:56 +0100 Subject: [PATCH 2/3] removing dry run --- code/setup/btp-setup-automator/btpsa-deployment.sh | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/code/setup/btp-setup-automator/btpsa-deployment.sh b/code/setup/btp-setup-automator/btpsa-deployment.sh index 7701cdb..e776b47 100644 --- a/code/setup/btp-setup-automator/btpsa-deployment.sh +++ b/code/setup/btp-setup-automator/btpsa-deployment.sh @@ -87,15 +87,11 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then echo "" log "Step 3.1 - Enable BTP Operator" - if [ "$DRY_RUN" = false ]; then - curl -Lo kyma.tar.gz "https://github.com/kyma-project/cli/releases/download/$(curl -s https://api.github.com/repos/kyma-project/cli/releases/latest | grep tag_name | cut -d '"' -f 4)/kyma_Linux_x86_64.tar.gz" \ - && mkdir kyma-release && tar -C kyma-release -zxvf kyma.tar.gz && chmod +x kyma-release/kyma && sudo mv kyma-release/kyma /usr/local/bin \ - && rm -rf kyma-release kyma.tar.gz - - kyma alpha enable module btp-operator --channel regular --kyma-name default --wait - else - log "Skipped for Dry Run" - fi + curl -Lo kyma.tar.gz "https://github.com/kyma-project/cli/releases/download/$(curl -s https://api.github.com/repos/kyma-project/cli/releases/latest | grep tag_name | cut -d '"' -f 4)/kyma_Linux_x86_64.tar.gz" \ + && mkdir kyma-release && tar -C kyma-release -zxvf kyma.tar.gz && chmod +x kyma-release/kyma && sudo mv kyma-release/kyma /usr/local/bin \ + && rm -rf kyma-release kyma.tar.gz + + kyma alpha enable module btp-operator --channel regular --kyma-name default --wait echo From 58878d981bf7e6785a8dcee5027d21b268a3b0be Mon Sep 17 00:00:00 2001 From: D056267 Date: Wed, 22 Nov 2023 08:51:47 +0100 Subject: [PATCH 3/3] adding loop to wait for btp operator --- .../btp-setup-automator/btpsa-deployment.sh | 22 ++++++++++++++++++ code/setup/easyfranchise-deployment.sh | 23 +++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/code/setup/btp-setup-automator/btpsa-deployment.sh b/code/setup/btp-setup-automator/btpsa-deployment.sh index e776b47..a1699c3 100644 --- a/code/setup/btp-setup-automator/btpsa-deployment.sh +++ b/code/setup/btp-setup-automator/btpsa-deployment.sh @@ -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" diff --git a/code/setup/easyfranchise-deployment.sh b/code/setup/easyfranchise-deployment.sh index 58cff5b..224c81e 100644 --- a/code/setup/easyfranchise-deployment.sh +++ b/code/setup/easyfranchise-deployment.sh @@ -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