优化代码
This commit is contained in:
21
998-常用脚本/备份脚本/关停全部的服务.sh
Normal file
21
998-常用脚本/备份脚本/关停全部的服务.sh
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
namespace=jxyd
|
||||
|
||||
# 优雅地处理Deployment缩容
|
||||
scale_deployments() {
|
||||
|
||||
echo "Scaling Deployments in namespace: $namespace"
|
||||
kubectl get deployments -n "$namespace" -o name |
|
||||
xargs -I {} kubectl scale --replicas=0 -n "$namespace" {}
|
||||
}
|
||||
|
||||
# 高效处理StatefulSet缩容
|
||||
scale_statefulsets() {
|
||||
echo "Scaling StatefulSets in namespace: $namespace"
|
||||
kubectl get statefulsets -n "$namespace" -o name |
|
||||
xargs -I {} kubectl scale --replicas=0 -n "$namespace" {}
|
||||
}
|
||||
|
||||
scale_deployments
|
||||
scale_statefulsets
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
namespace=jxyd
|
||||
namespace=jlyd
|
||||
|
||||
install_yq() {
|
||||
wget https://oss.demo.uavcmlc.com/cmlc-installation/downloadfile/amd/yq_linux_amd64 -O /usr/local/bin/yq
|
||||
@@ -44,9 +44,9 @@ backup_all_stateful_sets() {
|
||||
}
|
||||
|
||||
install_yq
|
||||
backup_all_deployment
|
||||
backup_all_service
|
||||
backup_all_stateful_sets
|
||||
# backup_all_deployment
|
||||
# backup_all_service
|
||||
# backup_all_stateful_sets
|
||||
backup_all_configmap
|
||||
|
||||
# https://github.com/mikefarah/yq/releases/download/v4.44.1/yq_linux_amd64
|
||||
|
||||
Reference in New Issue
Block a user