Commit 7e1e5184 authored by k8s-merge-robot's avatar k8s-merge-robot Committed by GitHub

Merge pull request #29618 from aveshagarwal/master-rhbz-1357825

Automatic merge from submit-queue Fix kubelet to not accept negative eviction (hard, soft) thresholds @kubernetes/rh-cluster-infra @derekwaynecarr
parents cdca508d cb7766de
......@@ -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,
......
......@@ -83,6 +83,22 @@ func TestParseThresholdConfig(t *testing.T) {
expectErr: true,
expectThresholds: []Threshold{},
},
"hard-signal-negative": {
evictionHard: "memory.available<-150Mi",
evictionSoft: "",
evictionSoftGracePeriod: "",
evictionMinReclaim: "",
expectErr: true,
expectThresholds: []Threshold{},
},
"soft-signal-negative": {
evictionHard: "",
evictionSoft: "memory.available<-150Mi",
evictionSoftGracePeriod: "",
evictionMinReclaim: "",
expectErr: true,
expectThresholds: []Threshold{},
},
"duplicate-signal": {
evictionHard: "memory.available<150Mi,memory.available<100Mi",
evictionSoft: "",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment