=initial commit
This commit is contained in:
commit
520a20479e
6 changed files with 206 additions and 0 deletions
35
stop-all-chrats.sh
Executable file
35
stop-all-chrats.sh
Executable file
|
@ -0,0 +1,35 @@
|
|||
#! /usr/bin/env bash
|
||||
set -e
|
||||
|
||||
get_charts() {
|
||||
midclt call chart.release.query | jq -r '.[] | select( .status != "STOPPED" ) | .id'
|
||||
}
|
||||
|
||||
stop_chart() {
|
||||
local CHART="${1}"
|
||||
printf 'Stopping charts: %s... ' "$CHART"
|
||||
midclt call chart.release.scale "$CHART" '{"replica_count": 0}'
|
||||
printf '\n'
|
||||
}
|
||||
|
||||
stop_all_charts() {
|
||||
get_charts | while read chart; do
|
||||
[[ -n "$chart" ]] || continue
|
||||
stop_chart "$chart"
|
||||
done
|
||||
}
|
||||
|
||||
count_unfinished_jobs() {
|
||||
midclt call core.get_jobs | jq -r '.[] | select( .time_finished == null )' | wc -l
|
||||
}
|
||||
|
||||
while [[ "$( get_charts | wc -l )" -gt 0 ]]; do
|
||||
stop_all_charts
|
||||
|
||||
while [[ "$( count_unfinished_jobs )" -gt 0 ]]; do
|
||||
printf '.'
|
||||
sleep 2
|
||||
done
|
||||
printf '\n'
|
||||
done
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue