Skip to content

Commit

Permalink
add empty check on ChangeHPAFromTortoiseRecommendation (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
sanposhiho authored Apr 8, 2023
1 parent 8e26c1d commit 7487da3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/hpa/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ func (c *Service) GetHPAOnTortoise(ctx context.Context, tortoise *autoscalingv1a
}

func (c *Service) ChangeHPAFromTortoiseRecommendation(tortoise *autoscalingv1alpha1.Tortoise, hpa *v2.HorizontalPodAutoscaler, now time.Time) (*v2.HorizontalPodAutoscaler, *autoscalingv1alpha1.Tortoise, error) {
if tortoise.Status.Recommendations.Horizontal == nil {
return hpa, nil, nil
}
for _, t := range tortoise.Status.Recommendations.Horizontal.TargetUtilizations {
for k, r := range t.TargetUtilization {
if err := updateHPATargetValue(hpa, t.ContainerName, k, r); err != nil {
Expand Down

0 comments on commit 7487da3

Please sign in to comment.