mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-04 23:17:50 +00:00
Kubelet#GetNode now uses GetNodeInfo instead of List
Both GetNode and the cache.ListWatch listfunc in the kubelet package call List unnecessary. GetNodeInfo is sufficient for GetNode and makes looping through a list of nodes to check for a matching name unnecessary. resolves #13476
This commit is contained in:
@@ -18,7 +18,6 @@ package kubelet
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
@@ -966,7 +965,12 @@ type testNodeLister struct {
|
||||
}
|
||||
|
||||
func (ls testNodeLister) GetNodeInfo(id string) (*api.Node, error) {
|
||||
return nil, errors.New("not implemented")
|
||||
for _, node := range ls.nodes {
|
||||
if node.Name == id {
|
||||
return &node, nil
|
||||
}
|
||||
}
|
||||
return nil, fmt.Errorf("Node with name: %s does not exist", id)
|
||||
}
|
||||
|
||||
func (ls testNodeLister) List() (api.NodeList, error) {
|
||||
|
||||
Reference in New Issue
Block a user