File tree Expand file tree Collapse file tree 2 files changed +43
-8
lines changed
kubernetes/cmsweb/scripts Expand file tree Collapse file tree 2 files changed +43
-8
lines changed Original file line number Diff line number Diff line change 33# Define the target namespace in the new cluster
44target_namespace=" dbs"
55
6+ # Fetch the tag from command prompt
7+ tag=$1
8+
69# Mapping of service names to their full image tags
710declare -A service_image_tags=(
811 [" check-metric" ]=" registry.cern.ch/cmsweb/check-metric:20220404-stable"
9- [" dbs2go-global-m" ]=" registry.cern.ch/cmsweb/dbs2go:v00.06.42 -stable"
10- [" dbs2go-global-migration" ]=" registry.cern.ch/cmsweb/dbs2go:v00.06.42 -stable"
11- [" dbs2go-global-r" ]=" registry.cern.ch/cmsweb/dbs2go:v00.06.42 -stable"
12- [" dbs2go-global-w" ]=" registry.cern.ch/cmsweb/dbs2go:v00.06.43 -stable"
13- [" dbs2go-phys03-m" ]=" registry.cern.ch/cmsweb/dbs2go:v00.06.42 -stable"
14- [" dbs2go-phys03-migration" ]=" registry.cern.ch/cmsweb/dbs2go:v00.06.42 -stable"
15- [" dbs2go-phys03-r" ]=" registry.cern.ch/cmsweb/dbs2go:v00.06.42 -stable"
16- [" dbs2go-phys03-w" ]=" registry.cern.ch/cmsweb/dbs2go:v00.06.43 -stable"
12+ [" dbs2go-global-m" ]=" registry.cern.ch/cmsweb/dbs2go:${tag :- v00.06.44 -stable} "
13+ [" dbs2go-global-migration" ]=" registry.cern.ch/cmsweb/dbs2go:${tag :- v00.06.44 -stable} "
14+ [" dbs2go-global-r" ]=" registry.cern.ch/cmsweb/dbs2go:${tag :- v00.06.44 -stable} "
15+ [" dbs2go-global-w" ]=" registry.cern.ch/cmsweb/dbs2go:${tag :- v00.06.44 -stable} "
16+ [" dbs2go-phys03-m" ]=" registry.cern.ch/cmsweb/dbs2go:${tag :- v00.06.44 -stable} "
17+ [" dbs2go-phys03-migration" ]=" registry.cern.ch/cmsweb/dbs2go:${tag :- v00.06.44 -stable} "
18+ [" dbs2go-phys03-r" ]=" registry.cern.ch/cmsweb/dbs2go:${tag :- v00.06.44 -stable} "
19+ [" dbs2go-phys03-w" ]=" registry.cern.ch/cmsweb/dbs2go:${tag :- v00.06.44 -stable} "
1720)
1821
1922# Loop through the service names and their full image tags
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # Scales down all DBS deployments in the current K8 cluster for a given interval of time in sec.
4+ # If no interval has been provided, scales down all of them and exits
5+
6+ interval=$1
7+
8+ # Build a list of all current replicas in each deployment:
9+ deployList=` kubectl -n dbs get deploy | grep dbs2go | awk ' {print $1":"$3}' `
10+ echo $deployList
11+
12+ # Scale down all deployments:
13+ for depl in $deployList
14+ do
15+ repl=${depl#*: } ; depl=${depl%:* } ;
16+ echo Scaling down: ${depl} :0
17+ kubectl -n dbs scale deploy $depl --replicas=0
18+ done
19+
20+ # Exit here if no interval has been provided
21+ [[ -z $interval ]] && exit 0
22+
23+ # Wait before scaling up again:
24+ while [[ $interval -ne 0 ]]; do echo $interval ; sleep 1; let " interval--" ; done
25+
26+ # Scale up again to the original number of replicas
27+ for depl in $deployList
28+ do
29+ repl=${depl#*: } ; depl=${depl%:* } ;
30+ echo Scaling up: ${depl} :$repl
31+ kubectl -n dbs scale deploy $depl --replicas=$repl
32+ done
You can’t perform that action at this time.
0 commit comments