Skip to content

Commit 196d953

Browse files
authored
Merge pull request #8649 from k8s-infra-cherrypick-robot/cherry-pick-8622-to-vpa-release-1.4
[vpa-release-1.4] bug: cache InPlaceOrRecreate feature flag to avoid repeated checks
2 parents d4319b2 + 28c673d commit 196d953

File tree

1 file changed

+3
-1
lines changed
  • vertical-pod-autoscaler/pkg/updater/logic

1 file changed

+3
-1
lines changed

vertical-pod-autoscaler/pkg/updater/logic/updater.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ func (u *updater) RunOnce(ctx context.Context) {
158158

159159
vpas := make([]*vpa_api_util.VpaWithSelector, 0)
160160

161+
inPlaceFeatureEnable := features.Enabled(features.InPlaceOrRecreate)
162+
161163
for _, vpa := range vpaList {
162164
if slices.Contains(u.ignoredNamespaces, vpa.Namespace) {
163165
klog.V(3).InfoS("Skipping VPA object in ignored namespace", "vpa", klog.KObj(vpa), "namespace", vpa.Namespace)
@@ -248,7 +250,7 @@ func (u *updater) RunOnce(ctx context.Context) {
248250
podsForEviction := make([]*apiv1.Pod, 0)
249251
updateMode := vpa_api_util.GetUpdateMode(vpa)
250252

251-
if updateMode == vpa_types.UpdateModeInPlaceOrRecreate && features.Enabled(features.InPlaceOrRecreate) {
253+
if updateMode == vpa_types.UpdateModeInPlaceOrRecreate && inPlaceFeatureEnable {
252254
podsForInPlace = u.getPodsUpdateOrder(filterNonInPlaceUpdatablePods(livePods, inPlaceLimiter), vpa)
253255
inPlaceUpdatablePodsCounter.Add(vpaSize, len(podsForInPlace))
254256
} else {

0 commit comments

Comments
 (0)