Skip to content

Commit ff3c751

Browse files
committed
wrap errors in taint-toleration plugin
1 parent c8ebc8a commit ff3c751

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pkg/scheduler/framework/plugins/tainttoleration/taint_toleration.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func (pl *TaintToleration) Name() string {
5353
// Filter invoked at the filter extension point.
5454
func (pl *TaintToleration) Filter(ctx context.Context, state *framework.CycleState, pod *v1.Pod, nodeInfo *framework.NodeInfo) *framework.Status {
5555
if nodeInfo == nil || nodeInfo.Node() == nil {
56-
return framework.NewStatus(framework.Error, "invalid nodeInfo")
56+
return framework.AsStatus(fmt.Errorf("invalid nodeInfo"))
5757
}
5858

5959
filterPredicate := func(t *v1.Taint) bool {
@@ -138,13 +138,13 @@ func countIntolerableTaintsPreferNoSchedule(taints []v1.Taint, tolerations []v1.
138138
func (pl *TaintToleration) Score(ctx context.Context, state *framework.CycleState, pod *v1.Pod, nodeName string) (int64, *framework.Status) {
139139
nodeInfo, err := pl.handle.SnapshotSharedLister().NodeInfos().Get(nodeName)
140140
if err != nil || nodeInfo.Node() == nil {
141-
return 0, framework.NewStatus(framework.Error, fmt.Sprintf("getting node %q from Snapshot: %v", nodeName, err))
141+
return 0, framework.AsStatus(fmt.Errorf("getting node %q from Snapshot: %w", nodeName, err))
142142
}
143143
node := nodeInfo.Node()
144144

145145
s, err := getPreScoreState(state)
146146
if err != nil {
147-
return 0, framework.NewStatus(framework.Error, err.Error())
147+
return 0, framework.AsStatus(err)
148148
}
149149

150150
score := int64(countIntolerableTaintsPreferNoSchedule(node.Spec.Taints, s.tolerationsPreferNoSchedule))

0 commit comments

Comments
 (0)