From 2f7e9788c014243a03c46b63aa9222d935b60dfa Mon Sep 17 00:00:00 2001 From: Kensei Nakada Date: Fri, 13 Oct 2023 18:44:07 +0900 Subject: [PATCH] don't update HPA spec if off --- pkg/hpa/service.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/hpa/service.go b/pkg/hpa/service.go index 9bfd1237..eabcff65 100644 --- a/pkg/hpa/service.go +++ b/pkg/hpa/service.go @@ -423,6 +423,11 @@ func (c *Service) ChangeHPAFromTortoiseRecommendation(tortoise *autoscalingv1bet } func (c *Service) UpdateHPASpecFromTortoiseAutoscalingPolicy(ctx context.Context, tortoise *autoscalingv1beta2.Tortoise, dm *v1.Deployment, now time.Time) (*autoscalingv1beta2.Tortoise, error) { + if tortoise.Spec.UpdateMode == autoscalingv1beta2.UpdateModeOff { + // When UpdateMode is Off, we don't update HPA. + return tortoise, nil + } + if !HasHorizontal(tortoise) { err := c.DeleteHPACreatedByTortoise(ctx, tortoise) if err != nil && !apierrors.IsNotFound(err) {