diff options
author | 2017-10-17 21:30:54 -0400 | |
---|---|---|
committer | 2017-10-17 21:30:54 -0400 | |
commit | b6b05eae8f3d1c1413b0308bc8e9285ec0423a96 (patch) | |
tree | ddb3f0e3ad99827012306ee09f316b3ffd23581d /plugin/federation/kubernetes_api_test.go | |
parent | 0c63248a0eb927affeef701150e818ad92eac808 (diff) | |
download | coredns-b6b05eae8f3d1c1413b0308bc8e9285ec0423a96.tar.gz coredns-b6b05eae8f3d1c1413b0308bc8e9285ec0423a96.tar.zst coredns-b6b05eae8f3d1c1413b0308bc8e9285ec0423a96.zip |
Plugin/Kubernetes: Service and Endpoint Indexing (#1149)
* indexing
* corrections
Diffstat (limited to 'plugin/federation/kubernetes_api_test.go')
-rw-r--r-- | plugin/federation/kubernetes_api_test.go | 78 |
1 files changed, 76 insertions, 2 deletions
diff --git a/plugin/federation/kubernetes_api_test.go b/plugin/federation/kubernetes_api_test.go index 3900ae0b8..0d8df64d3 100644 --- a/plugin/federation/kubernetes_api_test.go +++ b/plugin/federation/kubernetes_api_test.go @@ -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{ { |