mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-01 18:58:18 +00:00
Feat: unify the status handle when return in bindingCycle (#112103)
Signed-off-by: kerthcet <kerthcet@gmail.com> Signed-off-by: kerthcet <kerthcet@gmail.com>
This commit is contained in:
@@ -1003,8 +1003,13 @@ func (f *frameworkImpl) RunPreBindPlugins(ctx context.Context, state *framework.
|
||||
for _, pl := range f.preBindPlugins {
|
||||
status = f.runPreBindPlugin(ctx, pl, state, pod, nodeName)
|
||||
if !status.IsSuccess() {
|
||||
if status.IsUnschedulable() {
|
||||
klog.V(4).InfoS("Pod rejected by PreBind plugin", "pod", klog.KObj(pod), "node", nodeName, "plugin", pl.Name(), "status", status.Message())
|
||||
status.SetFailedPlugin(pl.Name())
|
||||
return status
|
||||
}
|
||||
err := status.AsError()
|
||||
klog.ErrorS(err, "Failed running PreBind plugin", "plugin", pl.Name(), "pod", klog.KObj(pod))
|
||||
klog.ErrorS(err, "Failed running PreBind plugin", "plugin", pl.Name(), "pod", klog.KObj(pod), "node", nodeName)
|
||||
return framework.AsStatus(fmt.Errorf("running PreBind plugin %q: %w", pl.Name(), err))
|
||||
}
|
||||
}
|
||||
@@ -1030,15 +1035,20 @@ func (f *frameworkImpl) RunBindPlugins(ctx context.Context, state *framework.Cyc
|
||||
if len(f.bindPlugins) == 0 {
|
||||
return framework.NewStatus(framework.Skip, "")
|
||||
}
|
||||
for _, bp := range f.bindPlugins {
|
||||
status = f.runBindPlugin(ctx, bp, state, pod, nodeName)
|
||||
for _, pl := range f.bindPlugins {
|
||||
status = f.runBindPlugin(ctx, pl, state, pod, nodeName)
|
||||
if status.IsSkip() {
|
||||
continue
|
||||
}
|
||||
if !status.IsSuccess() {
|
||||
if status.IsUnschedulable() {
|
||||
klog.V(4).InfoS("Pod rejected by Bind plugin", "pod", klog.KObj(pod), "node", nodeName, "plugin", pl.Name(), "status", status.Message())
|
||||
status.SetFailedPlugin(pl.Name())
|
||||
return status
|
||||
}
|
||||
err := status.AsError()
|
||||
klog.ErrorS(err, "Failed running Bind plugin", "plugin", bp.Name(), "pod", klog.KObj(pod))
|
||||
return framework.AsStatus(fmt.Errorf("running Bind plugin %q: %w", bp.Name(), err))
|
||||
klog.ErrorS(err, "Failed running Bind plugin", "plugin", pl.Name(), "pod", klog.KObj(pod), "node", nodeName)
|
||||
return framework.AsStatus(fmt.Errorf("running Bind plugin %q: %w", pl.Name(), err))
|
||||
}
|
||||
return status
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user