@@ -123,7 +123,7 @@ func setDefaultEvictor(profile api.DeschedulerProfile, client clientset.Interfac
123123 idx = 0
124124 }
125125
126- thresholdPriority , err := utils .GetPriorityFromStrategyParams (context .TODO (), client , defaultevictorPluginConfig .Args .(* defaultevictor.DefaultEvictorArgs ).PriorityThreshold )
126+ thresholdPriority , err := utils .GetPriorityValueFromPriorityThreshold (context .TODO (), client , defaultevictorPluginConfig .Args .(* defaultevictor.DefaultEvictorArgs ).PriorityThreshold )
127127 if err != nil {
128128 klog .Error (err , "Failed to get threshold priority from args" )
129129 }
@@ -137,36 +137,25 @@ func validateDeschedulerConfiguration(in api.DeschedulerPolicy, registry pluginr
137137 for _ , profile := range in .Profiles {
138138 for _ , pluginConfig := range profile .PluginConfigs {
139139 if _ , ok := registry [pluginConfig .Name ]; ok {
140+ if _ , ok := registry [pluginConfig .Name ]; ! ok {
141+ errorsInProfiles = fmt .Errorf ("%w: %s" , errorsInProfiles , fmt .Sprintf ("in profile %s: plugin %s in pluginConfig not registered" , profile .Name , pluginConfig .Name ))
142+ continue
143+ }
144+
140145 pluginUtilities := registry [pluginConfig .Name ]
141- if pluginUtilities .PluginArgValidator != nil {
142- err := pluginUtilities .PluginArgValidator (pluginConfig .Args )
143- errorsInProfiles = setErrorsInProfiles (err , profile .Name , errorsInProfiles )
146+ if pluginUtilities .PluginArgValidator == nil {
147+ continue
148+ }
149+ err := pluginUtilities .PluginArgValidator (pluginConfig .Args )
150+ if err != nil {
151+ if errorsInProfiles == nil {
152+ errorsInProfiles = fmt .Errorf ("in profile %s: %s" , profile .Name , err .Error ())
153+ } else {
154+ errorsInProfiles = fmt .Errorf ("%w: %s" , errorsInProfiles , fmt .Sprintf ("in profile %s: %s" , profile .Name , err .Error ()))
155+ }
144156 }
145157 }
146158 }
147159 }
148- if errorsInProfiles != nil {
149- return errorsInProfiles
150- }
151- return nil
152- }
153-
154- func setErrorsInProfiles (err error , profileName string , errorsInProfiles error ) error {
155- if err != nil {
156- if errorsInProfiles == nil {
157- errorsInProfiles = fmt .Errorf ("in profile %s: %s" , profileName , err .Error ())
158- } else {
159- errorsInProfiles = fmt .Errorf ("%w: %s" , errorsInProfiles , fmt .Sprintf ("in profile %s: %s" , profileName , err .Error ()))
160- }
161- }
162160 return errorsInProfiles
163161}
164-
165- func hasPluginConfigsWithSameName (newPluginConfig api.PluginConfig , pluginConfigs []api.PluginConfig ) bool {
166- for _ , pluginConfig := range pluginConfigs {
167- if newPluginConfig .Name == pluginConfig .Name {
168- return true
169- }
170- }
171- return false
172- }
0 commit comments