mirror of
https://github.com/kubernetes-sigs/descheduler.git
synced 2026-01-26 21:31:18 +01:00
When checking for node limit getting exceeded the pod eviction never fails. Thus, ignoring the metric reporting when a pod fails to be evicted due to node limit constrains. The error also allows plugin to react on other limits getting exceeded. E.g. the limit on the number of pods evicted per namespace.
52 lines
1.4 KiB
Go
52 lines
1.4 KiB
Go
package fake
|
|
|
|
import (
|
|
"context"
|
|
|
|
v1 "k8s.io/api/core/v1"
|
|
"k8s.io/client-go/informers"
|
|
clientset "k8s.io/client-go/kubernetes"
|
|
|
|
"sigs.k8s.io/descheduler/pkg/descheduler/evictions"
|
|
podutil "sigs.k8s.io/descheduler/pkg/descheduler/pod"
|
|
frameworktypes "sigs.k8s.io/descheduler/pkg/framework/types"
|
|
)
|
|
|
|
type HandleImpl struct {
|
|
ClientsetImpl clientset.Interface
|
|
GetPodsAssignedToNodeFuncImpl podutil.GetPodsAssignedToNodeFunc
|
|
SharedInformerFactoryImpl informers.SharedInformerFactory
|
|
EvictorFilterImpl frameworktypes.EvictorPlugin
|
|
PodEvictorImpl *evictions.PodEvictor
|
|
}
|
|
|
|
var _ frameworktypes.Handle = &HandleImpl{}
|
|
|
|
func (hi *HandleImpl) ClientSet() clientset.Interface {
|
|
return hi.ClientsetImpl
|
|
}
|
|
|
|
func (hi *HandleImpl) GetPodsAssignedToNodeFunc() podutil.GetPodsAssignedToNodeFunc {
|
|
return hi.GetPodsAssignedToNodeFuncImpl
|
|
}
|
|
|
|
func (hi *HandleImpl) SharedInformerFactory() informers.SharedInformerFactory {
|
|
return hi.SharedInformerFactoryImpl
|
|
}
|
|
|
|
func (hi *HandleImpl) Evictor() frameworktypes.Evictor {
|
|
return hi
|
|
}
|
|
|
|
func (hi *HandleImpl) Filter(pod *v1.Pod) bool {
|
|
return hi.EvictorFilterImpl.Filter(pod)
|
|
}
|
|
|
|
func (hi *HandleImpl) PreEvictionFilter(pod *v1.Pod) bool {
|
|
return hi.EvictorFilterImpl.PreEvictionFilter(pod)
|
|
}
|
|
|
|
func (hi *HandleImpl) Evict(ctx context.Context, pod *v1.Pod, opts evictions.EvictOptions) error {
|
|
return hi.PodEvictorImpl.EvictPod(ctx, pod, opts)
|
|
}
|