Skip to content

Commit a4748ee

Browse files
committed
adding feature flag NativeSidecar
1 parent 9d0ae5e commit a4748ee

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

vertical-pod-autoscaler/docs/flags.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This document is auto-generated from the flag definitions in the VPA admission-c
1414
| `address` | string | ":8944" | The address to expose Prometheus metrics. |
1515
| `alsologtostderr` | | | log to standard error as well as files (no effect when -logtostderr=true) |
1616
| `client-ca-file` | string | "/etc/tls-certs/caCert.pem" | Path to CA PEM file. |
17-
| `feature-gates` | mapStringBool | | A set of key=value pairs that describe feature gates for alpha/experimental features. Options are:<br>AllAlpha=true\|false (ALPHA - default=false)<br>AllBeta=true\|false (BETA - default=false)<br>InPlaceOrRecreate=true\|false (BETA - default=true) |
17+
| `feature-gates` | mapStringBool | | A set of key=value pairs that describe feature gates for alpha/experimental features. Options are:<br>AllAlpha=true\|false (ALPHA - default=false)<br>AllBeta=true\|false (BETA - default=false)<br>InPlaceOrRecreate=true\|false (BETA - default=true)<br>NativeSidecar=true\|false (ALPHA - default=false) |
1818
| `ignored-vpa-object-namespaces` | string | | A comma-separated list of namespaces to ignore when searching for VPA objects. Leave empty to avoid ignoring any namespaces. These namespaces will not be cleaned by the garbage collector. |
1919
| `kube-api-burst` | float | 100 | QPS burst limit when making requests to Kubernetes apiserver |
2020
| `kube-api-qps` | float | 50 | QPS limit when making requests to Kubernetes apiserver |
@@ -68,7 +68,7 @@ This document is auto-generated from the flag definitions in the VPA recommender
6868
| `cpu-integer-post-processor-enabled` | | | Enable the cpu-integer recommendation post processor. The post processor will round up CPU recommendations to a whole CPU for pods which were opted in by setting an appropriate label on VPA object (experimental) |
6969
| `external-metrics-cpu-metric` | string | | ALPHA. Metric to use with external metrics provider for CPU usage. |
7070
| `external-metrics-memory-metric` | string | | ALPHA. Metric to use with external metrics provider for memory usage. |
71-
| `feature-gates` | mapStringBool | | A set of key=value pairs that describe feature gates for alpha/experimental features. Options are:<br>AllAlpha=true\|false (ALPHA - default=false)<br>AllBeta=true\|false (BETA - default=false)<br>InPlaceOrRecreate=true\|false (BETA - default=true) |
71+
| `feature-gates` | mapStringBool | | A set of key=value pairs that describe feature gates for alpha/experimental features. Options are:<br>AllAlpha=true\|false (ALPHA - default=false)<br>AllBeta=true\|false (BETA - default=false)<br>InPlaceOrRecreate=true\|false (BETA - default=true)<br>NativeSidecar=true\|false (ALPHA - default=false) |
7272
| `history-length` | string | "8d" | How much time back prometheus have to be queried to get historical metrics |
7373
| `history-resolution` | string | "1h" | Resolution at which Prometheus is queried for historical metrics |
7474
| `humanize-memory` | | | DEPRECATED: Convert memory values in recommendations to the highest appropriate SI unit with up to 2 decimal places for better readability. This flag is deprecated and will be removed in a future version. Use --round-memory-bytes instead. |
@@ -144,7 +144,7 @@ This document is auto-generated from the flag definitions in the VPA updater cod
144144
| `eviction-rate-burst` | int | 1 | Burst of pods that can be evicted. |
145145
| `eviction-rate-limit` | float | | Number of pods that can be evicted per seconds. A rate limit set to 0 or -1 will disable<br>the rate limiter. (default -1) |
146146
| `eviction-tolerance` | float | 0.5 | Fraction of replica count that can be evicted for update, if more than one pod can be evicted. |
147-
| `feature-gates` | mapStringBool | | A set of key=value pairs that describe feature gates for alpha/experimental features. Options are:<br>AllAlpha=true\|false (ALPHA - default=false)<br>AllBeta=true\|false (BETA - default=false)<br>InPlaceOrRecreate=true\|false (BETA - default=true) |
147+
| `feature-gates` | mapStringBool | | A set of key=value pairs that describe feature gates for alpha/experimental features. Options are:<br>AllAlpha=true\|false (ALPHA - default=false)<br>AllBeta=true\|false (BETA - default=false)<br>InPlaceOrRecreate=true\|false (BETA - default=true)<br>NativeSidecar=true\|false (ALPHA - default=false) |
148148
| `ignored-vpa-object-namespaces` | string | | A comma-separated list of namespaces to ignore when searching for VPA objects. Leave empty to avoid ignoring any namespaces. These namespaces will not be cleaned by the garbage collector. |
149149
| `in-recommendation-bounds-eviction-lifetime-threshold` | | 12h0m0s | duration Pods that live for at least that long can be evicted even if their request is within the [MinRecommended...MaxRecommended] range |
150150
| `kube-api-burst` | float | 100 | QPS burst limit when making requests to Kubernetes apiserver |

vertical-pod-autoscaler/pkg/features/features.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ const (
4848
// InPlaceOrRecreate enables the InPlaceOrRecreate update mode to be used.
4949
// Requires KEP-1287 InPlacePodVerticalScaling feature-gate to be enabled on the cluster.
5050
InPlaceOrRecreate featuregate.Feature = "InPlaceOrRecreate"
51+
52+
// NativeSidecar enables support for native sidecars in VPA
53+
NativeSidecar featuregate.Feature = "NativeSidecar"
5154
)
5255

5356
// MutableFeatureGate is a mutable, versioned, global FeatureGate.

vertical-pod-autoscaler/pkg/features/versioned_features.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,7 @@ var defaultVersionedFeatureGates = map[featuregate.Feature]featuregate.Versioned
3131
{Version: version.MustParse("1.4"), Default: false, PreRelease: featuregate.Alpha},
3232
{Version: version.MustParse("1.5"), Default: true, PreRelease: featuregate.Beta},
3333
},
34+
NativeSidecar: {
35+
{Version: version.MustParse("1.5"), Default: false, PreRelease: featuregate.Alpha},
36+
},
3437
}

vertical-pod-autoscaler/pkg/recommender/input/cluster_feeder.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import (
3737
vpa_types "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1"
3838
vpa_api "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling.k8s.io/v1"
3939
vpa_lister "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/client/listers/autoscaling.k8s.io/v1"
40+
"k8s.io/autoscaler/vertical-pod-autoscaler/pkg/features"
4041
"k8s.io/autoscaler/vertical-pod-autoscaler/pkg/recommender/input/history"
4142
"k8s.io/autoscaler/vertical-pod-autoscaler/pkg/recommender/input/metrics"
4243
"k8s.io/autoscaler/vertical-pod-autoscaler/pkg/recommender/input/oom"
@@ -492,7 +493,7 @@ func (feeder *clusterStateFeeder) LoadPods() {
492493
}
493494
}
494495
for _, initContainer := range pod.InitContainers {
495-
if initContainer.ContainerType == model.ContainerTypeInitSidecar {
496+
if features.Enabled(features.NativeSidecar) && initContainer.ContainerType == model.ContainerTypeInitSidecar {
496497
if err = feeder.clusterState.AddOrUpdateContainer(initContainer.ID, initContainer.Request, initContainer.ContainerType); err != nil {
497498
klog.V(0).InfoS("Failed to add initContainer", "container", initContainer.ID, "error", err)
498499
}

0 commit comments

Comments
 (0)