-
Notifications
You must be signed in to change notification settings - Fork 4.3k
AEP: VPA native sidecar support #8905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jklaw90
wants to merge
2
commits into
kubernetes:master
Choose a base branch
from
jklaw90:AEP-8905-native-sidecar-support
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+109
−0
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
82 changes: 82 additions & 0 deletions
82
vertical-pod-autoscaler/enhancements/8905-native-sidecar-support/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| # KEP-8905: Native Sidecar Support | ||
|
|
||
| <!-- toc --> | ||
| - [Summary](#summary) | ||
| - [Goals](#goals) | ||
| - [Non-Goals](#non-goals) | ||
| - [Proposal](#proposal) | ||
| - [Design Details](#design-details) | ||
| - [Recommendations](#recommendations) | ||
| - [Update / Admission](#update--admission) | ||
| - [Test Plan](#test-plan) | ||
| - [Upgrade / Downgrade Strategy](#upgrade--downgrade-strategy) | ||
| - [Alternatives](#alternatives) | ||
| <!-- /toc --> | ||
|
|
||
| ## Summary | ||
|
|
||
| This proposal adds support for native sidecar containers (init containers with `restartPolicy: Always`) in Vertical Pod Autoscaler. | ||
|
|
||
| Kubernetes 1.28 introduced native sidecar containers. These are init containers that start before the main containers and continue running during the lifecycle of the Pod. VPA currently supports standard containers and regular init containers, but it should also support recommending resources for these new native sidecar containers to ensure they are right-sized. | ||
| Addresses [issue #7229](https://github.com/kubernetes/autoscaler/issues/7229) | ||
|
|
||
| ### Goals | ||
|
|
||
| - Allow VPA Recommender to generate resource recommendations for native sidecar containers. | ||
| - Ensure VPA Updater and Admission Controller can apply recommendations to native sidecar containers. | ||
|
|
||
| ### Non-Goals | ||
|
|
||
| - Support for sidecar containers in Kubernetes versions older than 1.28. | ||
|
|
||
| ## Proposal | ||
|
|
||
| The proposal is to introduce a new feature gate `NativeSidecar` in VPA. When enabled, VPA components will recognize and handle native sidecar containers. | ||
|
|
||
| ## Design Details | ||
|
|
||
| ### Recommendations | ||
|
|
||
| The Recommender component identifies native sidecar containers by examining init containers with `restartPolicy: Always` in the `SpecClient`. These containers are assigned the `ContainerTypeInitSidecar` type. | ||
|
|
||
| When the `NativeSidecar` feature gate is enabled, the `ClusterFeeder` processes native sidecars similarly to standard containers: | ||
| - They are stored in a separate `InitSidecarsContainers` map in the pod state | ||
| - Resource usage samples are collected and aggregated for recommendations | ||
| - Recommendations are generated using the same logic as standard containers | ||
|
|
||
| The VPA custom resource definition remains unchanged. Native sidecar recommendations are included in the `containerRecommendations` array alongside standard container recommendations, using the unique container name to identify them. | ||
|
|
||
| ### Update / Admission | ||
|
|
||
| Both Updater and Admission Controller components retrieve recommendations for init containers (including native sidecars) separately from standard containers using `GetContainersResourcesForPod`. | ||
| The patch generation logic is updated to target `/spec/initContainers` for native sidecar containers, while normal containers will continue to update `/spec/containers`. | ||
|
|
||
| ### Test Plan | ||
|
|
||
| The following test scenarios will be added to e2e tests. | ||
|
|
||
| - Admission applies recommendations to native sidecars. | ||
| - Updater will update sidecar container resources in-place or evict. | ||
| - Admission will patch sidecar container resources. | ||
| - When the feature gate `NativeSidecar` is false VPA components will not modify native sidecars. | ||
|
|
||
| ### Upgrade / Downgrade Strategy | ||
|
|
||
| #### Upgrade | ||
|
|
||
| On upgrade of the VPA to 1.6.0 (tentative release version), nothing will change, | ||
| VPAs will continue to work as before. | ||
|
|
||
| Users can use the new `NativeSidecar` by enabling the alpha Feature Gate (which defaults to disabled) | ||
| by passing `--feature-gates=NativeSidecar=true` to the VPA components. | ||
|
|
||
| #### Downgrade | ||
|
|
||
| On downgrade of VPA from 1.6.0 (tentative release version), nothing will change. | ||
| VPAs will continue to work as previously. Checkpoints may contain sidecar resource information until updated, but updater and admission will modify sidecar resources. | ||
|
|
||
| ## Alternatives | ||
|
|
||
| ### Treat as Standard Containers | ||
|
|
||
| We could treat them as standard containers, but they are technically init containers in the Pod spec, so the patch path would be incorrect (`/spec/containers` vs `/spec/initContainers`). | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Personally, I would prefer to include the updated code snippets in the AEP so users can clearly understand what this change looks like.