summaryrefslogtreecommitdiff
path: root/tools/stop-all-pods
blob: 2a2d7d3abec19ba4a7d5d888d658dfd4973d0372 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh

cd $(git rev-parse --show-toplevel)

# Delete the replication is not cleaning up its pods
# These pods need to be deleted according to their UUID
uuids=$(kubectl get pods -o json | jq '.[][].id' 2>/dev/null | grep -o -E '"[a-fA-F|0-9|\-]*' | cut -c 2- |  grep '\-')

for uuid in $uuids; do
    if [ $uuid ]; then
	kubectl delete pod $uuid
    fi
done

pods=$(kubectl get pods -o json| jq '.[][].id' 2>/dev/null)
# Removes quotes from jquery
pods=${pods//\"/}

for pod in $pods; do
    kubectl delete -f "k8s/pod/${pod}-pod.yaml" 2>/dev/null
done