Skip to content

Commit 43266b2

Browse files
authored
Merge pull request #8622 from omerap12/cache-inplace-flag
bug: cache InPlaceOrRecreate feature flag to avoid repeated checks
2 parents 9cc61fa + 548348c commit 43266b2

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
@@ -164,6 +164,8 @@ func (u *updater) RunOnce(ctx context.Context) {
164164

165165
vpas := make([]*vpa_api_util.VpaWithSelector, 0)
166166

167+
inPlaceFeatureEnable := features.Enabled(features.InPlaceOrRecreate)
168+
167169
for _, vpa := range vpaList {
168170
if slices.Contains(u.ignoredNamespaces, vpa.Namespace) {
169171
klog.V(3).InfoS("Skipping VPA object in ignored namespace", "vpa", klog.KObj(vpa), "namespace", vpa.Namespace)
@@ -258,7 +260,7 @@ func (u *updater) RunOnce(ctx context.Context) {
258260
podsForInPlace := make([]*apiv1.Pod, 0)
259261
podsForEviction := make([]*apiv1.Pod, 0)
260262

261-
if updateMode == vpa_types.UpdateModeInPlaceOrRecreate && features.Enabled(features.InPlaceOrRecreate) {
263+
if updateMode == vpa_types.UpdateModeInPlaceOrRecreate && inPlaceFeatureEnable {
262264
podsForInPlace = u.getPodsUpdateOrder(filterNonInPlaceUpdatablePods(livePods, inPlaceLimiter), vpa)
263265
inPlaceUpdatablePodsCounter.Add(vpaSize, len(podsForInPlace))
264266
} else {

0 commit comments

Comments
 (0)