e2e tests for RemoveFailedPods strategy

Fix priority class default
This commit is contained in:
Amir Alavi
2021-09-28 10:54:50 -04:00
parent 8e1da96082
commit 41fca2ed61
5 changed files with 184 additions and 37 deletions
+3 -1
View File
@@ -90,7 +90,9 @@ func validateAndParseRemoveFailedPodsParams(
params *api.StrategyParameters,
) (*validatedFailedPodsStrategyParams, error) {
if params == nil {
return &validatedFailedPodsStrategyParams{}, nil
return &validatedFailedPodsStrategyParams{
ValidatedStrategyParams: validation.DefaultValidatedStrategyParams(),
}, nil
}
strategyParams, err := validation.ValidateAndParseStrategyParams(ctx, client, params)
@@ -22,20 +22,22 @@ type ValidatedStrategyParams struct {
NodeFit bool
}
func DefaultValidatedStrategyParams() ValidatedStrategyParams {
return ValidatedStrategyParams{ThresholdPriority: utils.SystemCriticalPriority}
}
func ValidateAndParseStrategyParams(
ctx context.Context,
client clientset.Interface,
params *api.StrategyParameters,
) (*ValidatedStrategyParams, error) {
var includedNamespaces, excludedNamespaces sets.String
if params == nil {
return &ValidatedStrategyParams{
IncludedNamespaces: includedNamespaces,
ExcludedNamespaces: excludedNamespaces,
}, nil
defaultValidatedStrategyParams := DefaultValidatedStrategyParams()
return &defaultValidatedStrategyParams, nil
}
// At most one of include/exclude can be set
var includedNamespaces, excludedNamespaces sets.String
if params.Namespaces != nil && len(params.Namespaces.Include) > 0 && len(params.Namespaces.Exclude) > 0 {
return nil, fmt.Errorf("only one of Include/Exclude namespaces can be set")
}