Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions pkg/recommendation/recommender/hpa/recommend.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"encoding/json"
"fmt"
"math"
"strconv"
"time"

"github.com/montanaflynn/stats"
Expand Down Expand Up @@ -241,18 +240,13 @@ func (rr *HPARecommender) minMaxMedians(predictionTs []*common.TimeSeries) (floa

// checkFluctuation check if the time series fluctuation is reach to replicas.fluctuation-threshold
func (rr *HPARecommender) checkFluctuation(medianMin, medianMax float64) error {
fluctuationThreshold, err := strconv.ParseFloat(rr.Config["fluctuation-threshold"], 64)
if err != nil {
return err
}

if medianMin == 0 {
medianMin = 0.1 // use a small value to continue calculate
}

fluctuation := medianMax / medianMin
if fluctuation < fluctuationThreshold {
return fmt.Errorf("target cpu fluctuation %f is under replicas.fluctuation-threshold %f. ", fluctuation, fluctuationThreshold)
if fluctuation < rr.FluctuationThreshold {
return fmt.Errorf("target cpu fluctuation %f is under replicas.fluctuation-threshold %f. ", fluctuation, rr.FluctuationThreshold)
}

return nil
Expand Down