diff --git a/pkg/client/cache/listers.go b/pkg/client/cache/listers.go index 67d11232a60..29e58597c29 100644 --- a/pkg/client/cache/listers.go +++ b/pkg/client/cache/listers.go @@ -122,7 +122,7 @@ func (s *StoreToPodLister) Exists(pod *api.Pod) (bool, error) { // NodeConditionPredicate is a function that indicates whether the given node's conditions meet // some set of criteria defined by the function. -type NodeConditionPredicate func(node api.Node) bool +type NodeConditionPredicate func(node *api.Node) bool // StoreToNodeLister makes a Store have the List method of the client.NodeInterface // The Store must contain (only) Nodes. @@ -153,9 +153,9 @@ type storeToNodeConditionLister struct { // List returns a list of nodes that match the conditions defined by the predicate functions in the storeToNodeConditionLister. func (s storeToNodeConditionLister) List() (nodes api.NodeList, err error) { for _, m := range s.store.List() { - node := *m.(*api.Node) + node := m.(*api.Node) if s.predicate(node) { - nodes.Items = append(nodes.Items, node) + nodes.Items = append(nodes.Items, *node) } else { glog.V(5).Infof("Node %s matches none of the conditions", node.Name) } diff --git a/pkg/client/cache/listers_test.go b/pkg/client/cache/listers_test.go index 2a01eab0709..a95e9ed96ec 100644 --- a/pkg/client/cache/listers_test.go +++ b/pkg/client/cache/listers_test.go @@ -97,7 +97,7 @@ func TestStoreToNodeConditionLister(t *testing.T) { store.Add(n) } - predicate := func(node api.Node) bool { + predicate := func(node *api.Node) bool { for _, cond := range node.Status.Conditions { if cond.Type == api.NodeOutOfDisk && cond.Status == api.ConditionTrue { return false diff --git a/pkg/controller/service/servicecontroller.go b/pkg/controller/service/servicecontroller.go index 630a5b980d7..6165cdae2e4 100644 --- a/pkg/controller/service/servicecontroller.go +++ b/pkg/controller/service/servicecontroller.go @@ -641,7 +641,7 @@ func hostsFromNodeList(list *api.NodeList) []string { } func getNodeConditionPredicate() cache.NodeConditionPredicate { - return func(node api.Node) bool { + return func(node *api.Node) bool { // We add the master to the node list, but its unschedulable. So we use this to filter // the master. // TODO: Use a node annotation to indicate the master diff --git a/pkg/controller/service/servicecontroller_test.go b/pkg/controller/service/servicecontroller_test.go index 69ccb77e98c..e8276a62244 100644 --- a/pkg/controller/service/servicecontroller_test.go +++ b/pkg/controller/service/servicecontroller_test.go @@ -319,7 +319,7 @@ func TestGetNodeConditionPredicate(t *testing.T) { } pred := getNodeConditionPredicate() for _, test := range tests { - accept := pred(test.node) + accept := pred(&test.node) if accept != test.expectAccept { t.Errorf("Test failed for %s, expected %v, saw %v", test.name, test.expectAccept, accept) } diff --git a/plugin/pkg/scheduler/factory/factory.go b/plugin/pkg/scheduler/factory/factory.go index 5bd5286632e..da909e35a50 100644 --- a/plugin/pkg/scheduler/factory/factory.go +++ b/plugin/pkg/scheduler/factory/factory.go @@ -432,7 +432,7 @@ func (f *ConfigFactory) responsibleForPod(pod *api.Pod) bool { } func getNodeConditionPredicate() cache.NodeConditionPredicate { - return func(node api.Node) bool { + return func(node *api.Node) bool { for _, cond := range node.Status.Conditions { // We consider the node for scheduling only when its: // - NodeReady condition status is ConditionTrue, diff --git a/plugin/pkg/scheduler/factory/factory_test.go b/plugin/pkg/scheduler/factory/factory_test.go index 7dad6f91718..689a5befc81 100644 --- a/plugin/pkg/scheduler/factory/factory_test.go +++ b/plugin/pkg/scheduler/factory/factory_test.go @@ -464,7 +464,7 @@ func TestNodeConditionPredicate(t *testing.T) { nodeNames := []string{} for _, node := range nodeList.Items { - if nodeFunc(node) { + if nodeFunc(&node) { nodeNames = append(nodeNames, node.Name) } }