Skip to content

Commit 04f6147

Browse files
omerap12soltysh
andauthored
Update AEP-8026: Allow per-VPA component configuration parameters (#8505)
* update AEP Signed-off-by: Omer Aplatony <[email protected]> * Revert to old configurations Signed-off-by: Omer Aplatony <[email protected]> * fixed typo Signed-off-by: Omer Aplatony <[email protected]> * Add more info Signed-off-by: Omer Aplatony <[email protected]> * Update vertical-pod-autoscaler/enhancements/8026-per-vpa-component-configuration/README.md Co-authored-by: Maciej Szulik <[email protected]> * Update AEP Signed-off-by: Omer Aplatony <[email protected]> --------- Signed-off-by: Omer Aplatony <[email protected]> Co-authored-by: Maciej Szulik <[email protected]>
1 parent 8f0c84a commit 04f6147

File tree

1 file changed

+96
-17
lines changed
  • vertical-pod-autoscaler/enhancements/8026-per-vpa-component-configuration

1 file changed

+96
-17
lines changed

vertical-pod-autoscaler/enhancements/8026-per-vpa-component-configuration/README.md

Lines changed: 96 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@
1010
- [Container Policy Parameters](#container-policy-parameters)
1111
- [Update Policy Parameters](#update-policy-parameters)
1212
- [Design Details](#design-details)
13+
- [Configuration Level Considerations](#configuration-level-considerations)
14+
- [Parameter Level Analysis](#parameter-level-analysis)
15+
- [Parameter Precedence: Per-VPA vs Global Configuration](#parameter-precedence-per-vpa-vs-global-configuration)
1316
- [API Changes](#api-changes)
17+
- [Parameter Coexistence and Global Configuration](#parameter-coexistence-and-global-configuration)
1418
- [Phase 1 (Current Proposal)](#phase-1-current-proposal)
1519
- [Future Extensions](#future-extensions)
1620
- [Feature Enablement and Rollback](#feature-enablement-and-rollback)
@@ -27,7 +31,7 @@
2731

2832
## Summary
2933

30-
Currently, VPA components (recommender, updater, admission controller) are configured through global flags. This makes it challenging to support different workloads with varying resource optimization needs within the same cluster. This proposal introduces the ability to specify configuration parameters at the individual VPA object level, allowing for workload-specific optimization strategies.
34+
Currently, VPA components (recommender, updater, admission controller) are configured through global flags. This makes it challenging to support different workloads with varying resource optimization needs within the same cluster. This proposal introduces the ability to specify configuration parameters at the individual VPA object level, allowing for workload-specific optimization strategies. The goal is not to introduce new configuration options but rather to make existing internal configurations accessible and customizable per VPA object.
3135

3236
## Motivation
3337

@@ -64,12 +68,12 @@ The configuration will be split into two sections: container-specific recommenda
6468
apiVersion: autoscaling.k8s.io/v1
6569
kind: VerticalPodAutoscaler
6670
metadata:
67-
name: oom-test-vpa
71+
name: simple-vpa
6872
spec:
6973
targetRef:
7074
apiVersion: apps/v1
7175
kind: Deployment
72-
name: oom-test
76+
name: my-app
7377
updatePolicy:
7478
updateMode: Auto
7579
evictAfterOOMThreshold: "5m"
@@ -85,19 +89,44 @@ spec:
8589
### Parameter Descriptions
8690
8791
#### Container Policy Parameters
88-
#### Container Policy Parameters
89-
* `oomBumpUpRatio` (Quantity):
90-
- Multiplier applied to memory recommendations after OOM events
91-
- Represented as a Quantity (e.g., "1.5")
92-
- Must be greater than or equal to 1
93-
- Setting to 1 effectively disables the OOM ratio-based increase
94-
- Controls how aggressively memory is increased after container crashes
95-
96-
* `oomMinBumpUp` (bytes):
97-
- Minimum absolute memory increase after OOM events
98-
- Setting to 0 effectively disables the OOM minimum increase
99-
- When both `oomBumpUpRatio` = 1 and `oomMinBumpUp` = 0, OOM-based memory increases are completely disabled
100-
- Ensures meaningful increases even for small containers
92+
93+
* `oomBumpUpRatio` and `oomMinBumpUp`:
94+
These parameters work together to determine memory increases after OOM events.
95+
The VPA selects the larger of:
96+
- The absolute increase specified by `oomMinBumpUp`
97+
- A relative increase calculated using `oomBumpUpRatio`
98+
- If both are unset or set to their neutral values (`oomBumpUpRatio = 1`, `oomMinBumpUp = 0`), OOM-based increases are disabled.
99+
100+
This ensures:
101+
- Small containers receive a guaranteed minimum bump (via `oomMinBumpUp`, e.g., +100MB).
102+
- Larger containers receive proportional scaling (via `oomBumpUpRatio`, e.g., ×1.5).
103+
104+
Implementation logic:
105+
106+
```golang
107+
memoryNeeded := ResourceAmountMax(
108+
memoryUsed + MemoryAmountFromBytes(GetAggregationsConfig().OOMMinBumpUp),
109+
ScaleResource(memoryUsed, GetAggregationsConfig().OOMBumpUpRatio)
110+
)
111+
```
112+
Example: with oomBumpUpRatio: "1.5" and oomMinBumpUp: 104857600 (100MB):
113+
- For a container using 50MB: max(50MB + 100MB, 50MB * 1.5) = 150MB
114+
- For a container using 1GB: max(1GB + 100MB, 1GB * 1.5) = 1.5GB
115+
116+
Note: Using a single field approach (e.g., a unified `oomBumpUp` field) would not provide sufficient flexibility for users who need both a minimum absolute increase and a proportional ratio.
117+
For example, if a user wants to ensure a minimum increase of 100MB while also applying a 1.5x ratio for larger containers, a single field cannot express this combined behavior. The current dual-field design allows users to specify both constraints independently, ensuring small containers get a guaranteed minimum bump while larger containers receive appropriate proportional scaling. This approach provides more precise control over memory recommendation adjustments after OOM events than a simplified single-field model could offer.
118+
119+
120+
- `oomBumpUpRatio` (Quantity):
121+
- Multiplier applied to memory recommendations after OOM events
122+
- Represented as a Quantity (e.g., "1.5")
123+
- Must be greater than or equal to 1
124+
- Setting to 1 effectively disables the OOM ratio-based increase
125+
- Controls how aggressively memory is increased after container crashes
126+
127+
- `oomMinBumpUp` (bytes):
128+
- Minimum absolute memory increase after OOM events
129+
- Setting to 0 effectively disables the OOM minimum increase
101130

102131
* `memoryAggregationInterval` (duration):
103132
- Time window for aggregating memory usage data
@@ -117,6 +146,55 @@ Each parameter can be configured independently, falling back to global defaults
117146

118147
## Design Details
119148

149+
### Configuration Level Considerations
150+
151+
When designing the configuration parameters, we analyzed each parameter to determine the most appropriate configuration level:
152+
153+
#### Parameter Level Analysis
154+
155+
1. **OOM-Related Parameters (`oomBumpUpRatio`, `oomMinBumpUp`)**
156+
- **Recommended Level**: Container-level
157+
- **Rationale**:
158+
- Different containers in the same pod may have different memory requirements and OOM patterns
159+
- Memory recommendations in VPA are already handled at container level
160+
- Consistent with how VPA handles other resource-related configurations
161+
- While these parameters are container-level, VPA-wide configuration can still be achieved using the wildcard container name "*"
162+
163+
2. **Memory Aggregation Parameters (`memoryAggregationInterval`, `memoryAggregationIntervalCount`)**
164+
- **Recommended Level**: Container-level
165+
- **Rationale**:
166+
- Different containers may have different memory usage patterns
167+
- Some containers might need faster reaction times to memory changes
168+
- Consistent with existing VPA container-level resource policies
169+
- While `memoryAggregationInterval` and `memoryAggregationIntervalCount` are container-level, VPA-wide configuration can still be achieved using the wildcard container name "*"
170+
171+
3. **Eviction Parameters (`evictAfterOOMThreshold`)**
172+
- **Recommended Level**: VPA-level
173+
- **Rationale**:
174+
- Eviction decisions affect the entire pod
175+
- Pod-level operation that shouldn't vary by container
176+
- Simpler operational model for pod lifecycle management
177+
- Consistent with how Kubernetes handles pod evictions
178+
179+
#### Parameter Precedence: Per-VPA vs Global Configuration
180+
181+
The per-VPA configuration parameters introduced in this proposal are designed to **override** the corresponding global flags when specified in a VPA object. If a parameter is not defined at the VPA level, the VPA components will fall back to using the value set via global flags.
182+
183+
This approach ensures backward compatibility and allows users to adopt per-VPA configuration incrementally, without requiring changes to existing setups. Users can continue relying on global defaults while gradually introducing workload-specific tuning where needed.
184+
185+
For example:
186+
- If `oomBumpUpRatio` is set in a VPA's `containerPolicy`, that value will be used for recommendations for that container.
187+
- If it is omitted, the global flag value (e.g., from the recommender component) will apply.
188+
189+
This override behavior applies to all parameters introduced in this AEP:
190+
- `oomBumpUpRatio`
191+
- `oomMinBumpUp`
192+
- `memoryAggregationInterval`
193+
- `memoryAggregationIntervalCount`
194+
- `evictAfterOOMThreshold`
195+
196+
Validation and error handling will ensure that invalid or conflicting values are caught early, either through CEL rules or admission controller logic.
197+
120198
### API Changes
121199

122200
#### Phase 1 (Current Proposal)
@@ -177,8 +255,8 @@ The `PerVPAConfig` feature requires VPA version 1.5.0 or higher. The feature is
177255
Initial validation rules (CEL):
178256
* `oomMinBumpUp` >= 0
179257
* `memoryAggregationInterval` > 0
180-
* `evictAfterOOMThreshold` > 0
181258
* `memoryAggregationIntervalCount` > 0
259+
* `evictAfterOOMThreshold` > 0
182260

183261
Validation via Admission Controller:
184262
Some components cann't be validated using Common Expression Language (CEL). This validation is performed within the admission controller.
@@ -201,6 +279,7 @@ E2E tests will be included to verify:
201279
## Implementation History
202280

203281
- 2025-04-12: Initial proposal
282+
- 2025-09-06: Specify `oomBumpUpRatio` and `oomMinBumpUp` as container-level parameters
204283
- Future: Additional parameters will be added based on user feedback and requirements
205284

206285
## Future Work

0 commit comments

Comments
 (0)