This commit is contained in:
zeaslity
2024-10-30 16:30:51 +08:00
commit 437acbeb63
3363 changed files with 653948 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
#!/bin/bash
#all_cmii_name_space=(uavcloud-test uavcloud-feature uavcloud-uat uavcloud-dev uavcloud-devflight uavcloud-devoperation)
all_cmii_name_space=(uavcloud-test uavcloud-feature uavcloud-dev uavcloud-devflight uavcloud-devoperation)
echo ""
for name_space in "${all_cmii_name_space[@]}"; do
echo "[NAMESPACE] - start to deal with namespace [$name_space]"
if ! kubectl get ns "$name_space"; then
echo "[NAMESPACE] - namespace of [$name_space] not exists !"
echo ""
continue
fi
echo ""
kubectl get pods --namespace="${name_space}" --sort-by='.status.containerStatuses[].restartCount' | awk '$4 > 30 {print $1} ' | sed 's/-[a-z0-9]\{9,10\}-[a-z0-9]\{5\}$//' | xargs -I {} kubectl scale -n "${name_space}" --replicas=0 deployment {}
echo ""
done