Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Commit

Permalink
Refactor start_app function to pull replicas only when necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
Heavybullets8 committed Dec 23, 2023
1 parent 7da4af9 commit 0922d0c
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions utils/start_app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ start_app(){
# Check if app is a cnpg instance, or an operator instance
output=$(check_filtered_apps "$app_name")

replicas=$(pull_replicas "$app_name")
if [[ -z "$replicas" || "$replicas" == "null" ]]; then
return 1
fi

if [[ $output == *"${app_name},stopAll-"* ]]; then
ix_apps_pool=$(get_apps_pool)
if [[ -z "$ix_apps_pool" ]]; then
Expand All @@ -39,12 +34,14 @@ start_app(){
"/mnt/$ix_apps_pool/ix-applications/releases/$app_name/charts/$latest_version" \
--kubeconfig "/etc/rancher/k3s/k3s.yaml" \
--reuse-values \
--set replicaCount="$replicas" \
--set global.stopAll=false > /dev/null 2>&1; then
return 1
fi

else
replicas=$(pull_replicas "$app_name")
if [[ -z "$replicas" || "$replicas" == "null" ]]; then
return 1
fi
if ! cli -c 'app chart_release scale release_name='\""$app_name"\"\ 'scale_options={"replica_count": '"$replicas}" > /dev/null 2>&1; then
return 1
fi
Expand Down

0 comments on commit 0922d0c

Please sign in to comment.