Fix k8s client (#379)

* Fix k8s client to use client-go

* Fix Kubernetes Build Issue

The client-go code requires you to vendor. I have done a hack here
in the Makefile to vendor it to version 1.5. But looks like we
will need to do this the 'right' way soon.

* Convert v1 to api Objects in List Functions

Also removed the endpoint controller which was not used for anything.
The Watch functions may still need the same treatment.

* Vendor client-go release-1.5

* Fix basic SRV feature

This is actually not serving SRV records correctly, but this should
get it to work as it did prior to the k8s client changes. Another
fix will be needed to serve SRV records as defined in the spec.

* Add additional output in test result

Add the response to the test output.

* Fix erroneous test data
This commit is contained in:
John Belamaric 2016-11-05 07:57:08 -04:00 committed by Miek Gieben
parent 775d26c5e2
commit 229c82c418
1339 changed files with 705368 additions and 77 deletions

View file

@ -56,11 +56,11 @@ var testdataLookupSRV = []struct {
{"mynginx.any.coredns.local.", 1, 1}, // One SRV record, via wildcard namespace
{"someservicethatdoesnotexist.*.coredns.local.", 0, 0}, // Record does not exist with wildcard for namespace
{"someservicethatdoesnotexist.any.coredns.local.", 0, 0}, // Record does not exist with wildcard for namespace
{"*.demo.coredns.local.", 1, 1}, // One SRV record, via wildcard
{"any.demo.coredns.local.", 1, 1}, // One SRV record, via wildcard
{"*.demo.coredns.local.", 2, 2}, // Two (mynginx, webserver) SRV record, via wildcard
{"any.demo.coredns.local.", 2, 2}, // Two (mynginx, webserver) SRV record, via wildcard
{"*.test.coredns.local.", 0, 0}, // One SRV record, via wildcard that is not exposed
{"any.test.coredns.local.", 0, 0}, // One SRV record, via wildcard that is not exposed
{"*.*.coredns.local.", 1, 1}, // One SRV record, via namespace and service wildcard
{"*.*.coredns.local.", 2, 2}, // Two SRV record, via namespace and service wildcard
}
func TestKubernetesIntegration(t *testing.T) {
@ -89,7 +89,7 @@ func testLookupA(t *testing.T) {
corefile :=
`.:0 {
kubernetes coredns.local {
endpoint http://localhost:8080
endpoint http://localhost:8080
namespaces demo
}
@ -135,7 +135,7 @@ func testLookupSRV(t *testing.T) {
corefile :=
`.:0 {
kubernetes coredns.local {
endpoint http://localhost:8080
endpoint http://localhost:8080
namespaces demo
}
`
@ -171,10 +171,10 @@ func testLookupSRV(t *testing.T) {
}
if srvRecordCount != testData.SRVRecordCount {
t.Errorf("Expected '%v' SRV records in response. Instead got '%v' SRV records. Test query string: '%v'", testData.SRVRecordCount, srvRecordCount, testData.Query)
t.Errorf("Expected '%v' SRV records in response. Instead got '%v' SRV records. Test query string: '%v', res: %v", testData.SRVRecordCount, srvRecordCount, testData.Query, res)
}
if len(res.Answer) != testData.TotalAnswerCount {
t.Errorf("Expected '%v' records in answer section. Instead got '%v' records in answer section. Test query string: '%v'", testData.TotalAnswerCount, len(res.Answer), testData.Query)
t.Errorf("Expected '%v' records in answer section. Instead got '%v' records in answer section. Test query string: '%v', res: %v", testData.TotalAnswerCount, len(res.Answer), testData.Query, res)
}
}
}