Skip to content

Instantly share code, notes, and snippets.

View gertd's full-sized avatar

Gert Drapers gertd

View GitHub Profile
@gertd
gertd / cleanup-jobpods.sh
Last active October 3, 2016 20:35
Cleanup pods created by jobs
#!/bin/bash
PKG_OK=$(dpkg-query -W --showformat='${Status}\n' jq|grep "install ok installed")
if [ "" == "$PKG_OK" ]; then
sudo apt-get --force-yes --yes install jq
fi
kubectl get pods --all-namespaces --show-all --output=json |\
jq -r '.items[] | select(.metadata.labels.rmJobType == "preflight") | select(.status.phase == "Failed") | .metadata.namespace, .metadata.name ' |\
xargs -n2 > pods.txt
@gertd
gertd / proxy-fix.sh
Last active September 24, 2016 22:31
Fix proxy DNS settings
#!/bin/bash
sudo apt-get install jq --assume-yes
# get namespace
PROXY_NS=$(kubectl get pods --all-namespaces --show-all --output=json | jq -r '.items[] | select(.metadata.name | contains("hsc-proxy")) | .metadata.namespace ' )
# get pod name
PROXY_POD=$(kubectl get pods --all-namespaces --show-all --output=json | jq -r '.items[] | select(.metadata.name | contains("hsc-proxy")) | .metadata.name ' )
echo Current state of /etc/resolv.conf on $PROXY_NS/$PROXY_POD