Skip to content

Commit

Permalink
change: improve message and fail sooner on failure to provision dbaas (
Browse files Browse the repository at this point in the history
  • Loading branch information
shreddedbacon authored Jan 24, 2024
1 parent 2c257c9 commit dbd45d2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
9 changes: 7 additions & 2 deletions legacy/scripts/exec-kubectl-mariadb-dbaas.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
#!/bin/bash

# The operator can sometimes take a bit, wait until the details are available
# We added a timeout of 10 minutes (120 retries) before exit
# We added a timeout of 5 minutes (60 retries) before exit
OPERATOR_COUNTER=1
OPERATOR_TIMEOUT=180
OPERATOR_TIMEOUT=60
# use the secret name from the consumer to prevent credential clash
until kubectl -n ${NAMESPACE} get mariadbconsumer/${SERVICE_NAME} -o yaml | shyaml get-value spec.consumer.database
do
if [ $OPERATOR_COUNTER -lt $OPERATOR_TIMEOUT ]; then
consumer_failed=$(kubectl -n ${NAMESPACE} get mariadbconsumer/${SERVICE_NAME} -o json | jq -r '.metadata.annotations."dbaas.amazee.io/failed"')
if [ "${consumer_failed}" == "true" ]; then
echo "Failed to provision a database. Contact your support team to investigate."
exit 1
fi
let OPERATOR_COUNTER=OPERATOR_COUNTER+1
echo "Service for ${SERVICE_NAME} not available yet, waiting for 5 secs"
sleep 5
Expand Down
9 changes: 7 additions & 2 deletions legacy/scripts/exec-kubectl-mongodb-dbaas.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
#!/bin/bash

# The operator can sometimes take a bit, wait until the details are available
# We added a timeout of 10 minutes (120 retries) before exit
# We added a timeout of 5 minutes (60 retries) before exit
OPERATOR_COUNTER=1
OPERATOR_TIMEOUT=180
OPERATOR_TIMEOUT=60
# use the secret name from the consumer to prevent credential clash
until kubectl -n ${NAMESPACE} get mongodbconsumer/${SERVICE_NAME} -o yaml | shyaml get-value spec.consumer.database
do
if [ $OPERATOR_COUNTER -lt $OPERATOR_TIMEOUT ]; then
consumer_failed=$(kubectl -n ${NAMESPACE} get mongodbconsumer/${SERVICE_NAME} -o json | jq -r '.metadata.annotations."dbaas.amazee.io/failed"')
if [ "${consumer_failed}" == "true" ]; then
echo "Failed to provision a database. Contact your support team to investigate."
exit 1
fi
let OPERATOR_COUNTER=OPERATOR_COUNTER+1
echo "Service for ${SERVICE_NAME} not available yet, waiting for 5 secs"
sleep 5
Expand Down
9 changes: 7 additions & 2 deletions legacy/scripts/exec-kubectl-postgres-dbaas.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
#!/bin/bash

# The operator can sometimes take a bit, wait until the details are available
# We added a timeout of 10 minutes (120 retries) before exit
# We added a timeout of 5 minutes (60 retries) before exit
OPERATOR_COUNTER=1
OPERATOR_TIMEOUT=180
OPERATOR_TIMEOUT=60
# use the secret name from the consumer to prevent credential clash
until kubectl -n ${NAMESPACE} get postgresqlconsumer/${SERVICE_NAME} -o yaml | shyaml get-value spec.consumer.database
do
if [ $OPERATOR_COUNTER -lt $OPERATOR_TIMEOUT ]; then
consumer_failed=$(kubectl -n ${NAMESPACE} get postgresqlconsumer/${SERVICE_NAME} -o json | jq -r '.metadata.annotations."dbaas.amazee.io/failed"')
if [ "${consumer_failed}" == "true" ]; then
echo "Failed to provision a database. Contact your support team to investigate."
exit 1
fi
let OPERATOR_COUNTER=OPERATOR_COUNTER+1
echo "Service for ${SERVICE_NAME} not available yet, waiting for 5 secs"
sleep 5
Expand Down

0 comments on commit dbd45d2

Please sign in to comment.