mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-03 19:58:17 +00:00
Surface info of failed plugins during PerFilter and Filter
This commit is contained in:
@@ -431,12 +431,13 @@ func (f *frameworkImpl) RunPreFilterPlugins(ctx context.Context, state *framewor
|
||||
for _, pl := range f.preFilterPlugins {
|
||||
status = f.runPreFilterPlugin(ctx, pl, state, pod)
|
||||
if !status.IsSuccess() {
|
||||
status.SetFailedPlugin(pl.Name())
|
||||
if status.IsUnschedulable() {
|
||||
return status
|
||||
}
|
||||
err := status.AsError()
|
||||
klog.ErrorS(err, "Failed running PreFilter plugin", "plugin", pl.Name(), "pod", klog.KObj(pod))
|
||||
return framework.AsStatus(fmt.Errorf("running PreFilter plugin %q: %w", pl.Name(), err))
|
||||
return framework.AsStatus(fmt.Errorf("running PreFilter plugin %q: %w", pl.Name(), err)).WithFailedPlugin(pl.Name())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -540,9 +541,10 @@ func (f *frameworkImpl) RunFilterPlugins(
|
||||
if !pluginStatus.IsUnschedulable() {
|
||||
// Filter plugins are not supposed to return any status other than
|
||||
// Success or Unschedulable.
|
||||
errStatus := framework.AsStatus(fmt.Errorf("running %q filter plugin: %w", pl.Name(), pluginStatus.AsError()))
|
||||
errStatus := framework.AsStatus(fmt.Errorf("running %q filter plugin: %w", pl.Name(), pluginStatus.AsError())).WithFailedPlugin(pl.Name())
|
||||
return map[string]*framework.Status{pl.Name(): errStatus}
|
||||
}
|
||||
pluginStatus.SetFailedPlugin(pl.Name())
|
||||
statuses[pl.Name()] = pluginStatus
|
||||
if !f.runAllFilters {
|
||||
// Exit early if we don't need to run all filters.
|
||||
@@ -975,7 +977,8 @@ func (f *frameworkImpl) RunPermitPlugins(ctx context.Context, state *framework.C
|
||||
if status.IsUnschedulable() {
|
||||
msg := fmt.Sprintf("rejected pod %q by permit plugin %q: %v", pod.Name, pl.Name(), status.Message())
|
||||
klog.V(4).Infof(msg)
|
||||
return framework.NewStatus(status.Code(), msg)
|
||||
status.SetFailedPlugin(pl.Name())
|
||||
return status
|
||||
}
|
||||
if status.Code() == framework.Wait {
|
||||
// Not allowed to be greater than maxTimeout.
|
||||
@@ -987,7 +990,7 @@ func (f *frameworkImpl) RunPermitPlugins(ctx context.Context, state *framework.C
|
||||
} else {
|
||||
err := status.AsError()
|
||||
klog.ErrorS(err, "Failed running Permit plugin", "plugin", pl.Name(), "pod", klog.KObj(pod))
|
||||
return framework.AsStatus(fmt.Errorf("running Permit plugin %q: %w", pl.Name(), err))
|
||||
return framework.AsStatus(fmt.Errorf("running Permit plugin %q: %w", pl.Name(), err)).WithFailedPlugin(pl.Name())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1012,7 +1015,7 @@ func (f *frameworkImpl) runPermitPlugin(ctx context.Context, pl framework.Permit
|
||||
}
|
||||
|
||||
// WaitOnPermit will block, if the pod is a waiting pod, until the waiting pod is rejected or allowed.
|
||||
func (f *frameworkImpl) WaitOnPermit(ctx context.Context, pod *v1.Pod) (status *framework.Status) {
|
||||
func (f *frameworkImpl) WaitOnPermit(ctx context.Context, pod *v1.Pod) *framework.Status {
|
||||
waitingPod := f.waitingPods.get(pod.UID)
|
||||
if waitingPod == nil {
|
||||
return nil
|
||||
@@ -1028,11 +1031,12 @@ func (f *frameworkImpl) WaitOnPermit(ctx context.Context, pod *v1.Pod) (status *
|
||||
if s.IsUnschedulable() {
|
||||
msg := fmt.Sprintf("pod %q rejected while waiting on permit: %v", pod.Name, s.Message())
|
||||
klog.V(4).Infof(msg)
|
||||
return framework.NewStatus(s.Code(), msg)
|
||||
s.SetFailedPlugin(s.FailedPlugin())
|
||||
return s
|
||||
}
|
||||
err := s.AsError()
|
||||
klog.ErrorS(err, "Failed waiting on permit for pod", "pod", klog.KObj(pod))
|
||||
return framework.AsStatus(fmt.Errorf("waiting on permit for pod: %w", err))
|
||||
return framework.AsStatus(fmt.Errorf("waiting on permit for pod: %w", err)).WithFailedPlugin(s.FailedPlugin())
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1062,7 +1066,7 @@ func (f *frameworkImpl) GetWaitingPod(uid types.UID) framework.WaitingPod {
|
||||
func (f *frameworkImpl) RejectWaitingPod(uid types.UID) {
|
||||
waitingPod := f.waitingPods.get(uid)
|
||||
if waitingPod != nil {
|
||||
waitingPod.Reject("removed")
|
||||
waitingPod.Reject("", "removed")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user