aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorGravatar Yong Tang <yong.tang.github@outlook.com> 2017-08-10 17:14:56 -0700
committerGravatar GitHub <noreply@github.com> 2017-08-10 17:14:56 -0700
commit26d8680a11cbe444546d9ec247837ddf0594350e (patch)
treef0e2217e30fcdfedc9574f7c292b41a5f051e598 /test
parentacfa6501e03829aadf8824344a509c760a27e891 (diff)
downloadcoredns-26d8680a11cbe444546d9ec247837ddf0594350e.tar.gz
coredns-26d8680a11cbe444546d9ec247837ddf0594350e.tar.zst
coredns-26d8680a11cbe444546d9ec247837ddf0594350e.zip
Support multiple k8s api servers specification and load balance among api servers (#820)
* Support multiple k8s api servers specification and load balance among api servers This fix adds supports for multiple k8s api servers specification, load balance among api servers. When two or more api servers are specified in kubernetes block (endpoint ...), a proxy is created locally (with randomly generately port). The coredns will points to the generated proxy so that load balancing could be achieved. Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Setup initial healthcheck at the beginning Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Update README.md for kubernetes middleware and remove whitespaces. Signed-off-by: Yong Tang <yong.tang.github@outlook.com> * Use middleware/pkg/healthcheck in middleware/kubernetes for api proxy Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Diffstat (limited to 'test')
-rw-r--r--test/kubernetes_test.go23
1 files changed, 22 insertions, 1 deletions
diff --git a/test/kubernetes_test.go b/test/kubernetes_test.go
index 1d00be3b8..d99ca1618 100644
--- a/test/kubernetes_test.go
+++ b/test/kubernetes_test.go
@@ -450,7 +450,7 @@ func doIntegrationTests(t *testing.T, corefile string, testCases []test.Case) {
// Work-around for timing condition that results in no-data being returned in
// test environment.
- time.Sleep(1 * time.Second)
+ time.Sleep(3 * time.Second)
for _, tc := range testCases {
@@ -513,6 +513,27 @@ func TestKubernetesIntegration(t *testing.T) {
doIntegrationTests(t, corefile, dnsTestCases)
}
+func TestKubernetesIntegrationAPIProxy(t *testing.T) {
+
+ removeUpstreamConfig, upstreamServer, udp := createUpstreamServer(t)
+ defer upstreamServer.Stop()
+ defer removeUpstreamConfig()
+
+ corefile :=
+ `.:0 {
+ kubernetes cluster.local 0.0.10.in-addr.arpa {
+ endpoint http://nonexistance:8080,http://invalidip:8080,http://localhost:8080
+ namespaces test-1
+ pods disabled
+ upstream ` + udp + `
+ }
+ erratic . {
+ drop 0
+ }
+`
+ doIntegrationTests(t, corefile, dnsTestCases)
+}
+
func TestKubernetesIntegrationPodsInsecure(t *testing.T) {
corefile :=
`.:0 {