Created
August 29, 2023 14:04
-
-
Save cdoan1/884e44d15bd265f17468cd7830c02940 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
node=${1} | |
list=$(oc get hc -A --sort-by=.metadata.creationTimestamp -ojson \ | |
| jq -r '.items[] | select(.metadata.name | contains("sdq")) | .metadata.name,.metadata.creationTimestamp,.metadata.namespace') | |
ma=($list) | |
for ((i=0;i<${#ma[@]};i+=3)) | |
do | |
NAME=${ma[i]} | |
NS=${ma[i+2]}-${ma[i]} | |
P1=$(oc get pods -n $NS -o wide | grep -v Running | grep $node | awk '{print $1}') | |
for P2 in $P1 | |
do | |
oc delete pod $P2 -n $NS | |
done | |
for n in openshift-oauth-apiserver kube-apiserver openshift-apiserver oauth-openshift | |
do | |
oc scale deployment $n -n $NS --replicas=0 | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
oc scale statefulset ovnkube-master -n $NS --replicas=0 || true