-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kube/aks: add restart.sh to restart all the pods
Add a basic restart.sh script to restart all the pipeline pods. Signed-off-by: Guillaume Tucker <[email protected]>
- Loading branch information
1 parent
fbbe3c9
commit 6c4947b
Showing
1 changed file
with
64 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#!/bin/bash | ||
# | ||
# SPDX-License-Identifier: LGPL-2.1-or-later | ||
# | ||
# Copyright (C) 2023 Collabora Limited | ||
# Author: Guillaume Tucker <[email protected]> | ||
|
||
set -e | ||
|
||
first="\ | ||
tarball \ | ||
timeout \ | ||
monitor \ | ||
scheduler-k8s \ | ||
scheduler-lava \ | ||
" | ||
|
||
second="\ | ||
trigger \ | ||
" | ||
|
||
stop_pods() { | ||
local pods=$(\ | ||
kubectl get pods -o name \ | ||
| while read line; do | ||
echo $line | cut -d\/ -f2 | ||
done \ | ||
) | ||
|
||
for pod in $pods; do | ||
echo "* Stopping: $pod" | ||
kubectl delete pod $pod --wait=false | ||
done | ||
|
||
for pod in $pods; do | ||
echo "* Waiting to stop: $pod" | ||
kubectl wait --for=delete pod $pod | ||
done | ||
|
||
return 0 | ||
} | ||
|
||
start() { | ||
local items=$1 | ||
|
||
for item in $items; do | ||
echo "* Applying $item" | ||
kubectl apply -f "$item".yaml --wait=false | ||
done | ||
|
||
for item in $items; do | ||
echo "* Waiting to start: $item" | ||
kubectl wait --for=condition=Ready --timeout=1200s pod $item | ||
done | ||
|
||
return 0 | ||
} | ||
|
||
stop_pods | ||
start "$first" | ||
start "$second" | ||
kubectl get pods | ||
|
||
exit 0 |