Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge from CTDS #49

Merged
merged 2 commits into from
Jan 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions doc/scaling.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,13 @@ gen3 scaling apply rule '{ "key": "fence", "value": { "strategy": "pin", "num":
### gen3 scaling replicas serviceName count

Set the replicas on the given service's deployment to the specified count.


### gen3 scaling update deploymentName min max (optional targetCpu)

Update horizontal pod autoscaling rules on the fly.

Ex:
```
gen3 scaling update fence 1 2 50
```
11 changes: 11 additions & 0 deletions gen3/bin/ecr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,14 @@ gen3_ecr_describe_image() {
aws ecr describe-images --repository-name ${repoName} --image-ids imageTag=${tagName}
}

# Create a new repository in AWS ECR
#
# @param repoName
gen3_ecr_create_repo() {
local repoName="gen3/$1"
aws ecr create-repository --repository-name ${repoName} --image-scanning-configuration scanOnPush=true
}


# main -----------------------

Expand Down Expand Up @@ -231,6 +239,9 @@ if [[ -z "$GEN3_SOURCE_ONLY" ]]; then
"quay-sync")
gen3_ecr_quay_sync "$@"
;;
"create-repository")
gen3_ecr_create_repo "$@"
;;
"dh-quay")
gen3_dh_quay_sync "$@"
;;
Expand Down
18 changes: 18 additions & 0 deletions gen3/bin/scaling.sh
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,21 @@ scaling_apply_all() {
done
}

update_rules() {
if [[ $# -lt 3 ]]; then
gen3_log_err "use: update deployment-name min max (optional) targetCpu"
return 1
fi
local deploymentName="$1-deployment"
local min="$2"
local max="$3"
if [[ -z $4 ]]; then
g3kubectl apply -f - <<<"$(scaling_hpa_template "$deploymentName" "$min" "$max" "40")"
else
g3kubectl apply -f - <<<"$(scaling_hpa_template "$deploymentName" "$min" "$max" "$4")"
fi
}

#
# CLI processor
#
Expand Down Expand Up @@ -238,6 +253,9 @@ scaling_cli() {
"replicas")
scaling_replicas "$@"
;;
"update")
update_rules "$@"
;;
*)
gen3_log_err "unknown scaling sub-command: $command"
gen3 help scaling
Expand Down