Use docker container (instead of binary) for kubectl and travis cleanup (#352)

This fix uses docker container for kubectl. Since Kubernetes docker
image hyperkube has already been downloaded and it consists of
kubectl, there is really no need to download kubectl binary again.

This fix cleans up the Kubernetes related travis setup and removes
unneeded scripts.

This fix also fixes several mismatches of the Kubernetes version used,
so that any changes in version in the future only need to update .travis.yml.

Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
This commit is contained in:
Yong Tang
2016-10-20 11:06:15 -07:00
committed by GitHub
parent 14dc376ee7
commit a2bd9ad3f5
9 changed files with 122 additions and 225 deletions

View File

@@ -12,7 +12,7 @@ go:
go_import_path: github.com/miekg/coredns
env:
- ETCD_VERSION=2.3.1 K8S_VERSION=1.3.7
- ETCD_VERSION=2.3.1 K8S_VERSION=1.3.7 KUBECTL="docker exec hyperkube /hyperkube kubectl" DNS_ARGUMENTS=""
# In the Travis VM-based build environment, IPv6 networking is not
# enabled by default. The sysctl operations below enable IPv6.
@@ -30,11 +30,19 @@ before_install:
before_script:
- docker run -d --net=host --name=etcd quay.io/coreos/etcd:v$ETCD_VERSION
- ./.travis/kubernetes/start_k8s_with_services.sh
- docker run -d --volume=/:/rootfs:ro --volume=/sys:/sys:ro --volume=/var/lib/docker/:/var/lib/docker:rw --volume=/var/lib/kubelet/:/var/lib/kubelet:rw --volume=/var/run:/var/run:rw --net=host --pid=host --privileged --name=hyperkube gcr.io/google_containers/hyperkube-amd64:v$K8S_VERSION /hyperkube kubelet --containerized --hostname-override=127.0.0.1 --api-servers=http://localhost:8080 --config=/etc/kubernetes/manifests $DNS_ARGUMENTS --allow-privileged --v=2
# Wait until kubectl is ready
- for i in {1..10}; do $KUBECTL version && break || sleep 5; done
- $KUBECTL version
- $KUBECTL config set-cluster test-doc --server=http://localhost:8080
- $KUBECTL config set-context test-doc --cluster=test-doc
- $KUBECTL config use-context test-doc
# Wait until k8s is ready
- for i in {1..30}; do $KUBECTL get nodes && break || sleep 5; done
- .travis/kubernetes/setup_k8s_services.sh
- docker ps -a
script:
- docker ps -a
- ./.travis/kubernetes/kubectl version
- make coverage
after_success: