kubernetes: Improve namespace usage (#4767)
* Use GetByKey instead of List in GetNamespaceByName. * Add ToNamespace to reduce memory for namespace cache. Signed-off-by: Mat Lowery <mlowery@ebay.com>
This commit is contained in:
parent
8ff7c4b834
commit
9d5b8cd13d
9 changed files with 100 additions and 47 deletions
|
@ -2,6 +2,7 @@ package kubernetes
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net"
|
||||
"testing"
|
||||
|
||||
|
@ -91,8 +92,8 @@ func (APIConnTest) EpIndexReverse(ip string) []*object.Endpoints {
|
|||
func (APIConnTest) GetNodeByName(ctx context.Context, name string) (*api.Node, error) {
|
||||
return &api.Node{}, nil
|
||||
}
|
||||
func (APIConnTest) GetNamespaceByName(name string) (*api.Namespace, error) {
|
||||
return &api.Namespace{}, nil
|
||||
func (APIConnTest) GetNamespaceByName(name string) (*object.Namespace, error) {
|
||||
return nil, fmt.Errorf("namespace not found")
|
||||
}
|
||||
|
||||
func TestNsAddrs(t *testing.T) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue