Skip to content

Commit 9ec60fb

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

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

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)