Fix kubelet to not accept negative eviction (hard, soft) thresholds

and add unit tests
This commit is contained in:
Avesh Agarwal
2016-07-26 11:39:30 -04:00
parent 03fe6b962c
commit cb7766de19
2 changed files with 20 additions and 0 deletions

View File

@@ -157,6 +157,10 @@ func parseThresholdStatement(statement string) (Threshold, error) {
if err != nil {
return Threshold{}, err
}
if quantity.Sign() < 0 {
return Threshold{}, fmt.Errorf("eviction threshold %v cannot be negative: %s", signal, &quantity)
}
return Threshold{
Signal: signal,
Operator: operator,