Plugin/Kubernetes: Service and Endpoint Indexing (#1149)

* indexing

* corrections
This commit is contained in:
Sandeep Rajan 2017-10-17 21:30:54 -04:00 committed by John Belamaric
parent 0c63248a0e
commit b6b05eae8f
10 changed files with 501 additions and 26 deletions

View file

@ -9,8 +9,10 @@ import (
type APIConnFederationTest struct{}
func (APIConnFederationTest) Run() { return }
func (APIConnFederationTest) Stop() error { return nil }
func (APIConnFederationTest) Run() { return }
func (APIConnFederationTest) Stop() error { return nil }
func (APIConnFederationTest) SvcIndexReverse(string) []*api.Service { return nil }
func (APIConnFederationTest) EpIndexReverse(string) []*api.Endpoints { return nil }
func (APIConnFederationTest) PodIndex(string) []*api.Pod {
a := []*api.Pod{{
@ -24,6 +26,49 @@ func (APIConnFederationTest) PodIndex(string) []*api.Pod {
return a
}
func (APIConnFederationTest) SvcIndex(string) []*api.Service {
svcs := []*api.Service{
{
ObjectMeta: meta.ObjectMeta{
Name: "svc1",
Namespace: "testns",
},
Spec: api.ServiceSpec{
ClusterIP: "10.0.0.1",
Ports: []api.ServicePort{{
Name: "http",
Protocol: "tcp",
Port: 80,
}},
},
},
{
ObjectMeta: meta.ObjectMeta{
Name: "hdls1",
Namespace: "testns",
},
Spec: api.ServiceSpec{
ClusterIP: api.ClusterIPNone,
},
},
{
ObjectMeta: meta.ObjectMeta{
Name: "external",
Namespace: "testns",
},
Spec: api.ServiceSpec{
ExternalName: "ext.interwebs.test",
Ports: []api.ServicePort{{
Name: "http",
Protocol: "tcp",
Port: 80,
}},
},
},
}
return svcs
}
func (APIConnFederationTest) ServiceList() []*api.Service {
svcs := []*api.Service{
{
@ -67,6 +112,35 @@ func (APIConnFederationTest) ServiceList() []*api.Service {
return svcs
}
func (APIConnFederationTest) EpIndex(string) []*api.Endpoints {
eps := []*api.Endpoints{
{
Subsets: []api.EndpointSubset{
{
Addresses: []api.EndpointAddress{
{
IP: "172.0.0.1",
Hostname: "ep1a",
},
},
Ports: []api.EndpointPort{
{
Port: 80,
Protocol: "tcp",
Name: "http",
},
},
},
},
ObjectMeta: meta.ObjectMeta{
Name: "svc1",
Namespace: "testns",
},
},
}
return eps
}
func (APIConnFederationTest) EndpointsList() []*api.Endpoints {
eps := []*api.Endpoints{
{