diff --git a/pkg/descheduler/controllers/migration/arbitrator/filter.go b/pkg/descheduler/controllers/migration/arbitrator/filter.go index 00bfb0cf5..63b256924 100644 --- a/pkg/descheduler/controllers/migration/arbitrator/filter.go +++ b/pkg/descheduler/controllers/migration/arbitrator/filter.go @@ -85,7 +85,6 @@ func NewFilter(args *deschedulerconfig.MigrationControllerArgs, handle framework client: options.Manager.GetClient(), args: args, controllerFinder: controllerFinder, - mu: sync.Mutex{}, clock: clock.RealClock{}, } if err := f.initFilters(args, handle); err != nil { diff --git a/pkg/descheduler/controllers/migration/controller.go b/pkg/descheduler/controllers/migration/controller.go index 88e4f3dc5..4955929fb 100644 --- a/pkg/descheduler/controllers/migration/controller.go +++ b/pkg/descheduler/controllers/migration/controller.go @@ -20,7 +20,6 @@ import ( "context" "fmt" "strconv" - "sync" "time" corev1 "k8s.io/api/core/v1" @@ -76,7 +75,6 @@ type Reconciler struct { assumedCache *assumedCache clock clock.Clock - lock sync.Mutex filter arbitrator.MigrationFilter } @@ -100,14 +98,12 @@ func New(args runtime.Object, handle framework.Handle) (framework.Plugin, error) return nil, err } - // New filter filter, arbitrationFilter, err := arbitrator.NewFilter(controllerArgs, handle) if err != nil { return nil, err } r.filter = filter - // New Arbitrator a, err := arbitrator.New(controllerArgs.ArbitrationArgs, arbitrator.Options{ Client: r.Client, EventRecorder: r.eventRecorder, @@ -928,3 +924,12 @@ func (r *Reconciler) updateCondition(ctx context.Context, job *sev1alpha1.PodMig } return nil } + +// Filter checks if a pod can be evicted +func (r *Reconciler) Filter(pod *corev1.Pod) bool { + return r.filter.Filter(pod) +} + +func (r *Reconciler) PreEvictionFilter(pod *corev1.Pod) bool { + return r.filter.PreEvictionFilter(pod) +} diff --git a/pkg/descheduler/controllers/migration/filter.go b/pkg/descheduler/controllers/migration/filter.go deleted file mode 100644 index 5b26324cf..000000000 --- a/pkg/descheduler/controllers/migration/filter.go +++ /dev/null @@ -1,30 +0,0 @@ -/* -Copyright 2022 The Koordinator Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package migration - -import ( - corev1 "k8s.io/api/core/v1" -) - -// Filter checks if a pod can be evicted -func (r *Reconciler) Filter(pod *corev1.Pod) bool { - return r.filter.Filter(pod) -} - -func (r *Reconciler) PreEvictionFilter(pod *corev1.Pod) bool { - return r.filter.PreEvictionFilter(pod) -}