From 281faaa492b4a6033856eb959a6d3eb62f87d2d3 Mon Sep 17 00:00:00 2001 From: Zbynek Roubalik Date: Fri, 7 Aug 2020 14:13:27 +0200 Subject: [PATCH] option to restore to original replica count after ScaledObject's deletion Signed-off-by: Zbynek Roubalik --- .../docs/2.0/concepts/scaling-deployments.md | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/content/docs/2.0/concepts/scaling-deployments.md b/content/docs/2.0/concepts/scaling-deployments.md index b3dad21e0..3f75c1409 100644 --- a/content/docs/2.0/concepts/scaling-deployments.md +++ b/content/docs/2.0/concepts/scaling-deployments.md @@ -48,9 +48,10 @@ spec: cooldownPeriod: 300 # Optional. Default: 300 seconds minReplicaCount: 0 # Optional. Default: 0 maxReplicaCount: 100 # Optional. Default: 100 - advanced: # Optional. Section to specify advanced options. - horizontalPodAutoscalerConfig: # Optional. If not set, KEDA won't scale based on resource utilization - resourceMetrics: + advanced: # Optional. Section to specify advanced options + restoreToOriginalReplicaCount: true/false # Optional. Default: false + horizontalPodAutoscalerConfig: # Optional. Section to specify HPA related options + resourceMetrics: # Optional. If not set, KEDA won't scale based on resource utilization - name: cpu/memory # Name of the metric to scale on target: type: value/ utilization/ averagevalue @@ -129,15 +130,29 @@ This setting is passed to the HPA definition that KEDA will create for a given r ```yaml advanced: - horizontalPodAutoscalerConfig: - resourceMetrics: + restoreToOriginalReplicaCount: true/false # Optional. Default: false +``` + +This property specifies whether the target resource (`Deployment`, `StatefulSet`,...) should be scaled back to original replicas count, after the `ScaledObject` is deleted. +Default behavior is to keep the replica count at the same number as it is in the moment of `ScaledObject's` deletion. + +For example a `Deployment` with `3 replicas` is created, then `ScaledObject` is created and the `Deployment` is scaled by KEDA to `10 replicas` based on the metrics. Then `ScaledObject` is deleted: + 1. if `restoreToOriginalReplicaCount = false` (default behavior) then `Deployment` replicas count is `10` + 2. if `restoreToOriginalReplicaCount = true` then `Deployment` replicas count is set back to `3` (the original value) + +--- + +```yaml +advanced: + horizontalPodAutoscalerConfig: # Optional. Section to specify HPA related options + resourceMetrics: # Optional. If not set, KEDA won't scale based on resource utilization - name: cpu/memory # Name of the metric to scale on target: type: value/ utilization/ averagevalue value: 60 # Optional averageValue: 40 # Optional averageUtilization: 50 # Optional - behavior: + behavior: # Optional. Use to modify HPA's scaling behavior scaleDown: stabilizationWindowSeconds: 300 policies: @@ -146,7 +161,6 @@ advanced: periodSeconds: 15 ``` - **`horizontalPodAutoscalerConfig:`** This section contains configuration that is the same as some parts of the standard HorizontalPodAutoscaler configuration. KEDA would feed properties from this section into a apropriate places into the HPA configuration. This way one can modify the HPA that is being created and managed by KEDA.