Skip to content

Commit 4f390cb

Browse files
authored
Merge pull request kubernetes#2127 from arjunrn/update-container-resource-autoscaling
Updated container resource HPA KEP
2 parents b6349b8 + 2a253c7 commit 4f390cb

File tree

1 file changed

+15
-18
lines changed

1 file changed

+15
-18
lines changed

keps/sig-autoscaling/0001-container-resource-autoscaling.md

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ approvers:
1111
- "@josephburnett"
1212
- "@gjtempleton"
1313
creation-date: 2020-02-18
14-
last-updated: 2020-06-03
14+
last-updated: 2020-11-03
1515
status: implementable
1616
---
1717

@@ -77,7 +77,6 @@ a way to specify the target usage in a more fine grained manner.
7777
### Goals
7878

7979
- Make HPA scale based on individual container resources usage
80-
- Alias the resource metric source to pod resource metric source.
8180

8281
### Non-Goals
8382
- Configurable aggregation for containers resources in pods.
@@ -115,10 +114,8 @@ of the `application` container might be affected significantly. There is no way
115114
in the HPA to keep the utilization of the first container below a certain threshold. This also
116115
affects `memory` resource based autocaling scaling.
117116

118-
We propose that the following changes be made to the metric sources to address this problem:
119-
120-
1. A new metric source called `ContainerResourceMetricSource` be introduced with the following
121-
structure:
117+
We propose that the a new metric source called `ContainerResourceMetricSource` be introduced
118+
with the following structure:
122119

123120
```go
124121
type ContainerResourceMetricSource struct {
@@ -131,11 +128,6 @@ type ContainerResourceMetricSource struct {
131128
The only new field is `Container` which is the name of the container for which the resource
132129
usage should be tracked.
133130

134-
2. The `ResourceMetricSource` should be aliased to `PodResourceMetricSource`. It will work
135-
exactly as the original. The aliasing is done for the sake of consistency. Correspondingly,
136-
the `type` field for the metric source should be extended to support both `ContainerResource`
137-
and `PodResource` as values.
138-
139131
### User Stories
140132

141133
#### Multiple containers with different scaling thresholds
@@ -283,10 +275,14 @@ above the target.
283275

284276
### Risks and Mitigations
285277

286-
In order to keep backward compatibility with the existing API both `ResourceMetricSource` and
287-
`PodResourceMetricSource` will be supported. Existing HPAs will continue functioning like before.
288-
There will be no deprecation warning or internal migrations from `ResourceMetricSource` to
289-
`PodResourceMetricSource`.
278+
Since the new field `container` in the container resource metric source is not validated against the target it is
279+
possible that the user could specify an invalid value, i.e. a container name which is not part of the pod. The HPA
280+
controller would treat this as invalid configuration and prevent scale down. However scale up would still be possible
281+
based on recommendations from other metric sources.
282+
283+
A similar problem is possible when renaming container names in the HPA. To mitigate this the recommended procedure
284+
is to have both the old and new container names during the deployment. The old container name can be removed from
285+
the HPA when the migration is complete.
290286

291287

292288
## Design Details
@@ -312,8 +308,9 @@ criteria required because it will graduate when the original API graduates to `s
312308
For cluster upgrades the HPAs from the previous version will continue working as before. There
313309
is no change in behavior or flags which have to be enabled or disabled.
314310

315-
For clusters which have HPAs which use `ContainerResourceMetricSource` or `PodResourceMetricSource`
316-
a downgrade is possible after HPAs which use this new source have been modified to use
317-
`ResourceMetricSource` instead.
311+
A new feature gate `HPAContainerMetrics` is added in version 1.20 which is turned off by default.
312+
The new feature can only be used when this feature gate is enabled.
318313

319314
## Implementation History
315+
* 2020-04-03 Initial KEP merged
316+
* 2020-10-23 Implementation merged

0 commit comments

Comments
 (0)