Skip to content

Commit 00ac0eb

Browse files
committed
Forbid setting a negative tolerance via validation.
1 parent 26e22a6 commit 00ac0eb

File tree

1 file changed

+13
-13
lines changed
  • keps/sig-autoscaling/4951-configurable-hpa-tolerance

1 file changed

+13
-13
lines changed

keps/sig-autoscaling/4951-configurable-hpa-tolerance/README.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -147,15 +147,15 @@ updates.
147147
HPAs define one (or more) metrics (e.g. CPU utilization) on which autoscaling is based. The number of replicas is derived from the ratio between the *expected* and *current* value of this metric ([Algorithm details][]).
148148

149149
For example, for a workload with 100 `currentReplicas` and a usage ratio
150-
(`currentMetricValue`/`desiredMetricValue`) of 1.07, the calculated `desiredReplicas`
150+
(`currentMetricValue`/`desiredMetricValue`) of 1.07, the calculated `desiredReplicas`
151151
would be 107 (100 * 1.07).
152152

153-
However, to avoid flapping, scaling actions are skipped if the usage ratio is approximately 1, within a
153+
However, to avoid flapping, scaling actions are skipped if the usage ratio is approximately 1, within a
154154
globally-configurable *tolerance*, set to 10% by default. In the example above, no scaling action would
155155
take place, since the ratio is within this tolerance.
156156

157-
This proposal adds a parameter to HPAs allowing users to configure this tolerance per HPA resource.
158-
For the example above, we could configure the tolerance in the workload's HPA to 5%, which would
157+
This proposal adds a parameter to HPAs allowing users to configure this tolerance per HPA resource.
158+
For the example above, we could configure the tolerance in the workload's HPA to 5%, which would
159159
allow the scale-up to 107 replicas to proceed.
160160

161161
[Horizontal Pod Autoscaler]: https://kubernetes.io/docs/tasks/run-application/horizontal-pod-autoscale/
@@ -201,11 +201,11 @@ We propose to add a new field to the existing [`HPAScalingRules`][] object:
201201

202202
- `tolerance`: (float) the minimum change (from 1.0) in the desired-to-actual metrics ratio for the horizontal pod autoscaler to consider scaling. Must be greater than or equal to 0.
203203

204-
The `tolerance` field is optional, and when not specified the HPA will continue to use the
205-
value of the global `--horizontal-pod-autoscaler-tolerance` as the tolerance for scaling
204+
The `tolerance` field is optional, and when not specified the HPA will continue to use the
205+
value of the global `--horizontal-pod-autoscaler-tolerance` as the tolerance for scaling
206206
calculations.
207207

208-
Since there are separate `HPAScalingRules` objects defined for an HPA's
208+
Since there are separate `HPAScalingRules` objects defined for an HPA's
209209
`spec.behavior.scaleUp` and `spec.behavior.scaleDown`, it is possible to specify different
210210
`tolerance` values for scaling up vs. scaling down.
211211

@@ -260,13 +260,13 @@ It will be replaced by:
260260
+ if (1.0-downTolerance) <= usageRatio && usageRatio <= (1.0+upTolerance) { /* ... */ }
261261
```
262262

263-
Since the added field is optional and it's omission results in no change to the existing
263+
Since the added field is optional and it's omission results in no change to the existing
264264
autoscaling behavior, this feature can be added to the current API
265265
version `pkg/apis/autoscaling/v2`.
266266

267267
The feature presented in this KEP only allows users to tune an existing parameter, and
268-
as such doesn't require any new HPA Events or modify any Status. A new error is
269-
emitted if a `tolerance` field is set to a negative value.
268+
as such doesn't require any new HPA Events or modify any Status. The validation logic
269+
will be updated to ensure that the `tolerance` field cannot be set to a negative value.
270270

271271
[replica_calculator.go]: https://github.com/kubernetes/kubernetes/blob/master/pkg/controller/podautoscaler/replica_calculator.go
272272

@@ -430,12 +430,12 @@ in back-to-back releases.
430430
### Upgrade / Downgrade Strategy
431431

432432
#### Upgrade
433-
Existing HPAs will continue to work as they do today, using the global `horizontal-pod-autoscaler-tolerance`
434-
value from the `kube-controller-manager`. Users can use the new feature by enabling the Feature
433+
Existing HPAs will continue to work as they do today, using the global `horizontal-pod-autoscaler-tolerance`
434+
value from the `kube-controller-manager`. Users can use the new feature by enabling the Feature
435435
Gate (alpha only) and setting the new `tolerance` field on an HPA.
436436

437437
#### Downgrade
438-
On downgrade, all HPAs will revert to using the global `horizontal-pod-autoscaler-tolerance`
438+
On downgrade, all HPAs will revert to using the global `horizontal-pod-autoscaler-tolerance`
439439
value from the `kube-controller-manager`, regardless of any configured `tolerance` value on the HPA
440440
itself.
441441

0 commit comments

Comments
 (0)