Merge pull request #97321 from shawnhanx/master

Change the upper limit of evictionthreshold from 10000% to 100%
This commit is contained in:
Kubernetes Prow Robot 2021-02-09 10:25:13 -08:00 committed by GitHub
commit 3ad19200ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -203,7 +203,8 @@ func parseThresholdStatement(signal evictionapi.Signal, val string) (*evictionap
if percentage < 0 {
return nil, fmt.Errorf("eviction percentage threshold %v must be >= 0%%: %s", signal, val)
}
if percentage > 100 {
// percentage is a float and should not be greater than 1 (100%)
if percentage > 1 {
return nil, fmt.Errorf("eviction percentage threshold %v must be <= 100%%: %s", signal, val)
}
return &evictionapi.Threshold{

View File

@ -387,6 +387,15 @@ func TestParseThresholdConfig(t *testing.T) {
expectErr: true,
expectThresholds: []evictionapi.Threshold{},
},
"hard-signal-percentage-greater-than-100%": {
allocatableConfig: []string{},
evictionHard: map[string]string{"memory.available": "150%"},
evictionSoft: map[string]string{},
evictionSoftGracePeriod: map[string]string{},
evictionMinReclaim: map[string]string{},
expectErr: true,
expectThresholds: []evictionapi.Threshold{},
},
"soft-signal-negative": {
allocatableConfig: []string{},
evictionHard: map[string]string{},