gfazioli
11/20/2017 - 11:56 AM

EasyWP Check

Usage: easywpchk 64566

#!/bin/bash

# Delete all kubernetes resources for a specific app
# usage
# $ kubedelete 1562

echo "========================================================================="
echo "Deleting Kubernetes Resources for..."
printf '%x\n' $1
echo "========================================================================="


kubectl delete rc rc-$(printf '%x\n' $1) --force --grace-period=0
kubectl delete pod `kubectl get pod | grep rc-$(printf '%x\n' $1)- | awk '{print $1}'` --force --grace-period=0
kubectl delete svc svc-$(printf '%x\n' $1) --force --grace-period=0
kubectl delete ingress ingress-$(printf '%x\n' $1) --force --grace-period=0
kubectl delete secret secret-$(printf '%x\n' $1) --force --grace-period=0
kubectl delete pv rc-$(printf '%x\n' $1) --force --grace-period=0
kubectl delete pvc rc-$(printf '%x\n' $1) --force --grace-period=0
#!/bin/bash

# usage
# $ easywpchk 1562

echo "========================================================================="
echo "Resources rc, pods, svc"
printf '%x\n' $1
echo "========================================================================="

kubectl get rc,pods,svc -l webapp=$(kubectl get rc rc-$(printf '%x\n' $1) --label-columns=webapp | awk 'FNR==2{print $6}') --label-columns=webapp


echo ""
echo "========================================================================="
echo "Ingress"
echo "======================================================================kubedelete==="

kubectl get ingress ingress-$(printf '%x\n' $1)

echo ""
echo "========================================================================="
echo "Secret"
echo "========================================================================="

kubectl get secret secret-$(printf '%x\n' $1)


echo ""
echo "========================================================================="
echo "PV"
echo "========================================================================="

kubectl get pv rc-$(printf '%x\n' $1)

echo ""
echo "========================================================================="
echo "PVC"
echo "========================================================================="
kubectl get pvc rc-$(printf '%x\n' $1)