From 8dd711ea808290692eb0442ffa045707cd967631 Mon Sep 17 00:00:00 2001 From: yongruilin Date: Fri, 13 Feb 2026 22:50:16 +0000 Subject: [PATCH] address feedback: pass HPAScaleToZero option when already in use --- pkg/registry/autoscaling/horizontalpodautoscaler/strategy.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/registry/autoscaling/horizontalpodautoscaler/strategy.go b/pkg/registry/autoscaling/horizontalpodautoscaler/strategy.go index 5b3aa968b57..a10f3fa49c5 100644 --- a/pkg/registry/autoscaling/horizontalpodautoscaler/strategy.go +++ b/pkg/registry/autoscaling/horizontalpodautoscaler/strategy.go @@ -115,7 +115,8 @@ func (autoscalerStrategy) ValidateUpdate(ctx context.Context, obj, old runtime.O opts := validationOptionsForHorizontalPodAutoscaler(newHPA, oldHPA) errs := validation.ValidateHorizontalPodAutoscalerUpdate(newHPA, oldHPA, opts) var options []string - if utilfeature.DefaultFeatureGate.Enabled(features.HPAScaleToZero) { + oldHasZeroMinReplicas := oldHPA.Spec.MinReplicas != nil && *oldHPA.Spec.MinReplicas == 0 + if utilfeature.DefaultFeatureGate.Enabled(features.HPAScaleToZero) || oldHasZeroMinReplicas { options = append(options, "HPAScaleToZero") } return rest.ValidateDeclarativelyWithMigrationChecks(ctx, legacyscheme.Scheme, newHPA, oldHPA, errs, operation.Update, rest.WithOptions(options))