Skip to content

Commit

Permalink
don't update HPA spec if off (#188)
Browse files Browse the repository at this point in the history
  • Loading branch information
sanposhiho authored Oct 13, 2023
1 parent d443cdf commit 70b2e6d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/hpa/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,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) {
Expand Down

0 comments on commit 70b2e6d

Please sign in to comment.