use keys (#2167)
This commit is contained in:
parent
8432f14207
commit
974ed086f2
13 changed files with 291 additions and 380 deletions
|
@ -11,18 +11,26 @@ import (
|
|||
|
||||
type APIConnTest struct{}
|
||||
|
||||
func (APIConnTest) HasSynced() bool { return true }
|
||||
func (APIConnTest) Run() { return }
|
||||
func (APIConnTest) Stop() error { return nil }
|
||||
func (APIConnTest) PodIndex(string) []*object.Pod { return nil }
|
||||
func (APIConnTest) SvcIndex(string) []*object.Service { return nil }
|
||||
func (APIConnTest) SvcIndexReverse(string) []*object.Service { return nil }
|
||||
func (APIConnTest) EpIndex(string) []*object.Endpoints { return nil }
|
||||
func (APIConnTest) EndpointsList() []*object.Endpoints { return nil }
|
||||
func (APIConnTest) Modified() int64 { return 0 }
|
||||
func (APIConnTest) SetWatchChan(watch.Chan) {}
|
||||
func (APIConnTest) Watch(string) error { return nil }
|
||||
func (APIConnTest) StopWatching(string) {}
|
||||
func (APIConnTest) HasSynced() bool { return true }
|
||||
func (APIConnTest) Run() { return }
|
||||
func (APIConnTest) Stop() error { return nil }
|
||||
func (APIConnTest) PodIndex(string) []*object.Pod { return nil }
|
||||
func (APIConnTest) SvcIndexReverse(string) *object.Service { return nil }
|
||||
func (APIConnTest) EpIndex(string) *object.Endpoints { return nil }
|
||||
func (APIConnTest) EndpointsList() []*object.Endpoints { return nil }
|
||||
func (APIConnTest) Modified() int64 { return 0 }
|
||||
func (APIConnTest) SetWatchChan(watch.Chan) {}
|
||||
func (APIConnTest) Watch(string) error { return nil }
|
||||
func (APIConnTest) StopWatching(string) {}
|
||||
|
||||
func (a APIConnTest) SvcIndex(key string) *object.Service {
|
||||
for _, s := range a.ServiceList() {
|
||||
if object.ServiceKey(s.Namespace, s.Name) == key {
|
||||
return s
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (APIConnTest) ServiceList() []*object.Service {
|
||||
svcs := []*object.Service{
|
||||
|
@ -35,23 +43,21 @@ func (APIConnTest) ServiceList() []*object.Service {
|
|||
return svcs
|
||||
}
|
||||
|
||||
func (APIConnTest) EpIndexReverse(string) []*object.Endpoints {
|
||||
eps := []*object.Endpoints{
|
||||
{
|
||||
Subsets: []object.EndpointSubset{
|
||||
{
|
||||
Addresses: []object.EndpointAddress{
|
||||
{
|
||||
IP: "127.0.0.1",
|
||||
},
|
||||
func (APIConnTest) EpIndexReverse(string) *object.Endpoints {
|
||||
eps := object.Endpoints{
|
||||
Subsets: []object.EndpointSubset{
|
||||
{
|
||||
Addresses: []object.EndpointAddress{
|
||||
{
|
||||
IP: "127.0.0.1",
|
||||
},
|
||||
},
|
||||
},
|
||||
Name: "dns-service",
|
||||
Namespace: "kube-system",
|
||||
},
|
||||
Name: "dns-service",
|
||||
Namespace: "kube-system",
|
||||
}
|
||||
return eps
|
||||
return &eps
|
||||
}
|
||||
|
||||
func (APIConnTest) GetNodeByName(name string) (*api.Node, error) { return &api.Node{}, nil }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue