Skip to content

Commit

Permalink
kube/aks: add restart.sh to restart all the pods
Browse files Browse the repository at this point in the history
Add a basic restart.sh script to restart all the pipeline pods.

Signed-off-by: Guillaume Tucker <[email protected]>
  • Loading branch information
gctucker authored and nuclearcat committed Nov 1, 2023
1 parent fbbe3c9 commit 6c4947b
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions kube/aks/restart.sh
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

0 comments on commit 6c4947b

Please sign in to comment.