Skip to content

Commit

Permalink
Fix label selector to get confluence sts too
Browse files Browse the repository at this point in the history
  • Loading branch information
Yevhen Ivantsov committed Oct 11, 2024
1 parent e3092b9 commit de6105d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion scripts/scale.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,18 @@ PRODUCT=$1
DESIRED_REPLICAS=$2

# check if this is the initial release and exit
STS=$(kubectl get sts -l=app.kubernetes.io/instance="${PRODUCT}" -n "${NAMESPACE}" -o jsonpath='{.items[*].metadata.name}')
STS=$(kubectl get sts -l=app.kubernetes.io/name="${PRODUCT}" -n "${NAMESPACE}" -o jsonpath='{.items[*].metadata.name}')
if [ -z "$STS" ]; then
log "No StatefulSets found"
exit 0
fi

# get existing sts replicas
STS_REPLICAS=$(kubectl get sts $STS -n "${NAMESPACE}" -ojsonpath='{.spec.replicas}')
if [ -z "${STS_REPLICAS}" ]; then
log "Failed to get StatefulSets replicas"
exit 0
fi
# Check if DESIRED_REPLICAS is less than STS_REPLICAS and manually scale down
# before Terraform attempts destroying local-home PVC, PV and EBS vol
if [ "${DESIRED_REPLICAS}" -lt "${STS_REPLICAS}" ]; then
Expand Down

0 comments on commit de6105d

Please sign in to comment.