Skip to content

Commit

Permalink
option to restore to original replica count after ScaledObject's dele…
Browse files Browse the repository at this point in the history
…tion

Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>
  • Loading branch information
Zbynek Roubalik committed Aug 7, 2020
1 parent be8625a commit c51486a
Showing 1 changed file with 23 additions and 7 deletions.
30 changes: 23 additions & 7 deletions content/docs/2.0/concepts/scaling-deployments.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -129,15 +130,31 @@ 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
```

**`restoreToOriginalReplicaCount:`**

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:
Expand All @@ -146,7 +163,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.
Expand Down

0 comments on commit c51486a

Please sign in to comment.