13799455c2
Remove git and jq dependency in most scripts, allowing to run them on latest atomic images, or even distribute Kolla in the form of tarball. The only remainings of git dependency are in the git pre-commit hook, and in the image build scripts. We can remove the latter one and have the scripts running in degraded mode if we really want to. I opted for a python based approach to finding the top-level directory for portability, ensuring consistent result on Linux and BSD, including OSX. Change-Id: I987174032d11b2e9d6a993c563b5dc877c15dd2d
19 lines
575 B
Bash
Executable File
19 lines
575 B
Bash
Executable File
#!/bin/bash
|
|
|
|
REAL_PATH=$(python -c "import os,sys;print os.path.realpath('$0')")
|
|
cd "$(dirname "$REAL_PATH")/.."
|
|
|
|
UUID_REGEX="[a-f0-9]{8}(-[a-f0-9]{4}){3}-[a-f0-9]{12}"
|
|
|
|
pods=$(kubectl get pods -o template -t '{{range .items}}{{.id}} {{end}}')
|
|
for pod in $pods; do
|
|
if [[ $pod =~ $UUID_REGEX ]]; then
|
|
# Stopping a k8s replicationController doesn't delete the associated
|
|
# pods, which names are UUIDs.
|
|
# Assuming all pods named by UUID are leftover replication pods.
|
|
kubectl delete pod $pod
|
|
else
|
|
kubectl delete -f "k8s/pod/${pod}-pod.yaml" 2>/dev/null
|
|
fi
|
|
done
|