|
| 1 | +# KEP-8905: Native Sidecar Support |
| 2 | + |
| 3 | +<!-- toc --> |
| 4 | +- [Summary](#summary) |
| 5 | +- [Motivation](#motivation) |
| 6 | + - [Goals](#goals) |
| 7 | + - [Non-Goals](#non-goals) |
| 8 | +- [Proposal](#proposal) |
| 9 | +- [Design Details](#design-details) |
| 10 | + - [Test Plan](#test-plan) |
| 11 | +- [Implementation History](#implementation-history) |
| 12 | +- [Alternatives](#alternatives) |
| 13 | +<!-- /toc --> |
| 14 | + |
| 15 | +## Summary |
| 16 | + |
| 17 | +This proposal adds support for native sidecar containers (init containers with `restartPolicy: Always`) in Vertical Pod Autoscaler. |
| 18 | + |
| 19 | +## Motivation |
| 20 | + |
| 21 | +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. |
| 22 | +Addresses [issue #7229](https://github.com/kubernetes/autoscaler/issues/7229) |
| 23 | + |
| 24 | +### Goals |
| 25 | + |
| 26 | +- Allow VPA Recommender to generate resource recommendations for native sidecar containers. |
| 27 | +- Ensure VPA Updater and Admission Controller can apply recommendations to native sidecar containers. |
| 28 | + |
| 29 | +### Non-Goals |
| 30 | + |
| 31 | +- Support for sidecar containers in Kubernetes versions older than 1.28. |
| 32 | + |
| 33 | +## Proposal |
| 34 | + |
| 35 | +The proposal is to introduce a new feature gate `NativeSidecar` in VPA. When enabled, VPA components will recognize and handle native sidecar containers. |
| 36 | + |
| 37 | +- **Recommender**: Will identify init containers with `restartPolicy: Always` as `InitSidecar` type and generate recommendations for them. |
| 38 | +- **Updater/Admission Controller**: Will be able to patch resource requirements for these containers. |
| 39 | + |
| 40 | +## Design Details |
| 41 | + |
| 42 | +- A new container type `ContainerTypeInitSidecar` is introduced in the internal model to represent native sidecars. |
| 43 | +- The `ClusterFeeder` in Recommender is updated to ingest these containers when the `NativeSidecar` feature gate is enabled. |
| 44 | +- The patch generation logic is updated to target `/spec/initContainers` for `InitSidecar` type containers. |
| 45 | + |
| 46 | +### Test Plan |
| 47 | + |
| 48 | +- Add E2E tests to verify that VPA generates recommendations for native sidecar containers and that they are correctly applied. |
| 49 | +- Verify that VPA ignores native sidecars when the feature gate is disabled. |
| 50 | + |
| 51 | +## Alternatives |
| 52 | + |
| 53 | +### Treat as Standard Containers |
| 54 | + |
| 55 | +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`). |
0 commit comments