From 5154b4525bc29271f291726d81190cc96356b40d Mon Sep 17 00:00:00 2001 From: "aashiq.jacob@ibm.com" Date: Tue, 8 Oct 2024 11:17:55 +0530 Subject: [PATCH 1/4] fix: add terraform failure if reset api key fails to create api key --- scripts/reset_iks_api_key.sh | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/scripts/reset_iks_api_key.sh b/scripts/reset_iks_api_key.sh index 6aae0c02..7e0eebc4 100755 --- a/scripts/reset_iks_api_key.sh +++ b/scripts/reset_iks_api_key.sh @@ -54,14 +54,25 @@ if [ "${reset}" == true ]; then if [ "$PRIVATE_ENV" = true ]; then if [ "$CLUSTER_ENDPOINT" == "private" ] || [ "$CLUSTER_ENDPOINT" == "default" ]; then RESET_URL="https://private.$REGION.containers.cloud.ibm.com/v1/keys" - curl -H "accept: application/json" -H "Authorization: $IAM_TOKEN" -H "X-Auth-Resource-Group: $RESOURCE_GROUP_ID" -X POST "$RESET_URL" + result=$(curl -i -H "accept: application/json" -H "Authorization: 5$IAM_TOKEN" -H "X-Auth-Resource-Group: $RESOURCE_GROUP_ID" -X POST "$RESET_URL" 2>/dev/null) + status_code=$(echo "$result" | head -n 1 | cut -d$' ' -f2) elif [ "$CLUSTER_ENDPOINT" == "vpe" ]; then RESET_URL="https://api.$REGION.containers.cloud.ibm.com/v1/keys" - curl -H "accept: application/json" -H "Authorization: $IAM_TOKEN" -H "X-Auth-Resource-Group: $RESOURCE_GROUP_ID" -X POST "$RESET_URL" + result=$(curl -i -H "accept: application/json" -H "Authorization: 5$IAM_TOKEN" -H "X-Auth-Resource-Group: $RESOURCE_GROUP_ID" -X POST "$RESET_URL" 2>/dev/null) + status_code=$(echo "$result" | head -n 1 | cut -d$' ' -f2) fi else RESET_URL="https://containers.cloud.ibm.com/global/v1/keys" - curl -H "accept: application/json" -H "X-Region: $REGION" -H "Authorization: $IAM_TOKEN" -H "X-Auth-Resource-Group: $RESOURCE_GROUP_ID" -X POST "$RESET_URL" -d '' + result=$(curl -i -H "accept: application/json" -H "X-Region: $REGION" -H "Authorization: 5$IAM_TOKEN" -H "X-Auth-Resource-Group: $RESOURCE_GROUP_ID" -X POST "$RESET_URL" -d '' 2>/dev/null) + status_code=$(echo "$result" | head -n 1 | cut -d$' ' -f2) + fi + + if [ "${status_code}" == "204" ]; then + echo "The IAM API key is successfully reset." + else + echo "ERROR:: FAILED TO RESET THE IAM API KEY" + echo "$result" + exit 1 fi # sleep for 10 secs to allow the new key to be replicated across backend DB instances before attempting to create cluster sleep 10 From fe0e045f4b94fc318afbbc5b69e17bd9f9fcc945 Mon Sep 17 00:00:00 2001 From: "aashiq.jacob@ibm.com" Date: Wed, 9 Oct 2024 10:13:15 +0530 Subject: [PATCH 2/4] update --- scripts/reset_iks_api_key.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/reset_iks_api_key.sh b/scripts/reset_iks_api_key.sh index 7e0eebc4..0935581e 100755 --- a/scripts/reset_iks_api_key.sh +++ b/scripts/reset_iks_api_key.sh @@ -54,16 +54,16 @@ if [ "${reset}" == true ]; then if [ "$PRIVATE_ENV" = true ]; then if [ "$CLUSTER_ENDPOINT" == "private" ] || [ "$CLUSTER_ENDPOINT" == "default" ]; then RESET_URL="https://private.$REGION.containers.cloud.ibm.com/v1/keys" - result=$(curl -i -H "accept: application/json" -H "Authorization: 5$IAM_TOKEN" -H "X-Auth-Resource-Group: $RESOURCE_GROUP_ID" -X POST "$RESET_URL" 2>/dev/null) + result=$(curl -i -H "accept: application/json" -H "Authorization: $IAM_TOKEN" -H "X-Auth-Resource-Group: $RESOURCE_GROUP_ID" -X POST "$RESET_URL" 2>/dev/null) status_code=$(echo "$result" | head -n 1 | cut -d$' ' -f2) elif [ "$CLUSTER_ENDPOINT" == "vpe" ]; then RESET_URL="https://api.$REGION.containers.cloud.ibm.com/v1/keys" - result=$(curl -i -H "accept: application/json" -H "Authorization: 5$IAM_TOKEN" -H "X-Auth-Resource-Group: $RESOURCE_GROUP_ID" -X POST "$RESET_URL" 2>/dev/null) + result=$(curl -i -H "accept: application/json" -H "Authorization: $IAM_TOKEN" -H "X-Auth-Resource-Group: $RESOURCE_GROUP_ID" -X POST "$RESET_URL" 2>/dev/null) status_code=$(echo "$result" | head -n 1 | cut -d$' ' -f2) fi else RESET_URL="https://containers.cloud.ibm.com/global/v1/keys" - result=$(curl -i -H "accept: application/json" -H "X-Region: $REGION" -H "Authorization: 5$IAM_TOKEN" -H "X-Auth-Resource-Group: $RESOURCE_GROUP_ID" -X POST "$RESET_URL" -d '' 2>/dev/null) + result=$(curl -i -H "accept: application/json" -H "X-Region: $REGION" -H "Authorization: $IAM_TOKEN" -H "X-Auth-Resource-Group: $RESOURCE_GROUP_ID" -X POST "$RESET_URL" -d '' 2>/dev/null) status_code=$(echo "$result" | head -n 1 | cut -d$' ' -f2) fi From ed6d3cca71daf53bf9042e6f957c46874b1ed9ba Mon Sep 17 00:00:00 2001 From: Aashiq-J <122446118+Aashiq-J@users.noreply.github.com> Date: Thu, 10 Oct 2024 09:14:04 +0530 Subject: [PATCH 3/4] Update main.tf --- examples/advanced/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/advanced/main.tf b/examples/advanced/main.tf index 50139935..3992db30 100644 --- a/examples/advanced/main.tf +++ b/examples/advanced/main.tf @@ -169,7 +169,7 @@ module "ocp_base" { # Enable if using worker autoscaling. Stops Terraform managing worker count. ignore_worker_pool_size_changes = true addons = { - "cluster-autoscaler" = "1.2.0" + "cluster-autoscaler" = "1.2.1" } kms_config = { instance_id = module.kp_all_inclusive.kms_guid From 76e26c8921488d48ed66ae78351f4b8d3dc6f6f5 Mon Sep 17 00:00:00 2001 From: "aashiq.jacob@ibm.com" Date: Tue, 15 Oct 2024 14:01:29 +0530 Subject: [PATCH 4/4] SKIP UPGRADE TEST