-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(2896): Add toggle keda plugin (#2897)
* feat(2896): Add toggle keda plugin Also update formating of plugins readme table and fix links Signed-off-by: SamoKopecky <[email protected]> * chore: Fix table formating Signed-off-by: SamoKopecky <[email protected]> --------- Signed-off-by: SamoKopecky <[email protected]>
- Loading branch information
1 parent
42bc8fc
commit f139a57
Showing
2 changed files
with
42 additions
and
12 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
plugins: | ||
toggle-keda: | ||
shortCut: Ctrl-N | ||
override: false | ||
overwriteOutput: true | ||
confirm: false | ||
dangerous: true | ||
description: Toggle autoscaling on keda scaledobject | ||
scopes: | ||
- scaledobjects | ||
command: bash | ||
background: true | ||
args: | ||
- -c | ||
- | | ||
ANNOTATION="autoscaling.keda.sh/paused-replicas" | ||
if kubectl get scaledobject $NAME -n $NAMESPACE -o yaml | grep -q "$ANNOTATION: \"0\""; then | ||
# If annotation found, remove it | ||
kubectl annotate scaledobject $NAME "$ANNOTATION"- -n $NAMESPACE --context $CONTEXT >/dev/null && echo "Keda autoscaling for $NAME enabled" | ||
else | ||
# If annotation not found, add it | ||
kubectl annotate scaledobject $NAME "$ANNOTATION"=0 -n $NAMESPACE --context $CONTEXT >/dev/null && echo "Keda autoscaling for $NAME disabled" | ||
fi | ||