pkg/scheduler/framework/:fix unconsistent comments and make log more clear

This commit is contained in:
tanjunchen 2020-04-24 11:17:11 +08:00
parent aef471ec3c
commit 0e38ba0ef6
2 changed files with 4 additions and 6 deletions

View File

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

View File

@ -18,8 +18,6 @@ package prebind
import (
"context"
"fmt"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
framework "k8s.io/kubernetes/pkg/scheduler/framework/v1alpha1"
@ -42,7 +40,7 @@ func (sr StatelessPreBindExample) Name() string {
// PreBind is the functions invoked by the framework at "prebind" extension point.
func (sr StatelessPreBindExample) PreBind(ctx context.Context, state *framework.CycleState, pod *v1.Pod, nodeName string) *framework.Status {
if pod == nil {
return framework.NewStatus(framework.Error, fmt.Sprintf("pod cannot be nil"))
return framework.NewStatus(framework.Error, "pod cannot be nil")
}
if pod.Namespace != "foo" {
return framework.NewStatus(framework.Unschedulable, "only pods from 'foo' namespace are allowed")