Skip to content

Commit 863ce97

Browse files
authored
Merge pull request kubernetes#90295 from tanjunchen/pkg/scheduler/framework/plugins/-20200420
pkg/scheduler/framework/plugins/:fix unconsistent comments and make log more clear
2 parents 429aefa + 0e38ba0 commit 863ce97

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

pkg/scheduler/framework/plugins/defaultpodtopologyspread/default_pod_topology_spread.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ func (pl *DefaultPodTopologySpread) Score(ctx context.Context, state *framework.
9797
}
9898

9999
// NormalizeScore invoked after scoring all nodes.
100-
// For this plugin, it calculates the source of each node
100+
// For this plugin, it calculates the score of each node
101101
// based on the number of existing matching pods on the node
102102
// where zone information is included on the nodes, it favors nodes
103103
// in zones with fewer existing matching pods.
@@ -116,7 +116,7 @@ func (pl *DefaultPodTopologySpread) NormalizeScore(ctx context.Context, state *f
116116
}
117117
nodeInfo, err := pl.handle.SnapshotSharedLister().NodeInfos().Get(scores[i].Name)
118118
if err != nil {
119-
return framework.NewStatus(framework.Error, err.Error())
119+
return framework.NewStatus(framework.Error, fmt.Sprintf("getting node %q from Snapshot: %v", scores[i].Name, err))
120120
}
121121
zoneID := utilnode.GetZoneKey(nodeInfo.Node())
122122
if zoneID == "" {
@@ -147,7 +147,7 @@ func (pl *DefaultPodTopologySpread) NormalizeScore(ctx context.Context, state *f
147147
if haveZones {
148148
nodeInfo, err := pl.handle.SnapshotSharedLister().NodeInfos().Get(scores[i].Name)
149149
if err != nil {
150-
return framework.NewStatus(framework.Error, err.Error())
150+
return framework.NewStatus(framework.Error, fmt.Sprintf("getting node %q from Snapshot: %v", scores[i].Name, err))
151151
}
152152

153153
zoneID := utilnode.GetZoneKey(nodeInfo.Node())

pkg/scheduler/framework/plugins/examples/prebind/prebind.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ package prebind
1818

1919
import (
2020
"context"
21-
"fmt"
22-
2321
v1 "k8s.io/api/core/v1"
2422
"k8s.io/apimachinery/pkg/runtime"
2523
framework "k8s.io/kubernetes/pkg/scheduler/framework/v1alpha1"
@@ -42,7 +40,7 @@ func (sr StatelessPreBindExample) Name() string {
4240
// PreBind is the functions invoked by the framework at "prebind" extension point.
4341
func (sr StatelessPreBindExample) PreBind(ctx context.Context, state *framework.CycleState, pod *v1.Pod, nodeName string) *framework.Status {
4442
if pod == nil {
45-
return framework.NewStatus(framework.Error, fmt.Sprintf("pod cannot be nil"))
43+
return framework.NewStatus(framework.Error, "pod cannot be nil")
4644
}
4745
if pod.Namespace != "foo" {
4846
return framework.NewStatus(framework.Unschedulable, "only pods from 'foo' namespace are allowed")

0 commit comments

Comments
 (0)