From efe345f8b6896cac0a112ba5b5be01f85fa359c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9na=C3=AFc=20Huard?= Date: Fri, 13 Mar 2015 15:54:53 +0100 Subject: [PATCH 1/2] Make libvirt-coreos generate a .kubeconfig file and have e2e tests use it --- cluster/libvirt-coreos/util.sh | 7 +++++++ hack/ginkgo-e2e.sh | 13 +++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/cluster/libvirt-coreos/util.sh b/cluster/libvirt-coreos/util.sh index aefe351a818..6587b8eb123 100644 --- a/cluster/libvirt-coreos/util.sh +++ b/cluster/libvirt-coreos/util.sh @@ -220,6 +220,13 @@ function kube-up { rm $domain_xml done + export KUBECONFIG="${HOME}/.kube/.kubeconfig" + local kubectl="${KUBE_ROOT}/cluster/kubectl.sh" + + "${kubectl}" config set-cluster libvirt-coreos --server=http://${KUBE_MASTER_IP-}:8080 + "${kubectl}" config set-context libvirt-coreos --cluster=libvirt-coreos + "${kubectl}" config use-context libvirt-coreos --cluster=libvirt-coreos + wait-cluster-readiness echo "Kubernetes cluster is running. The master is running at:" diff --git a/hack/ginkgo-e2e.sh b/hack/ginkgo-e2e.sh index 87d9c2f89b8..ea5fc60c0ad 100755 --- a/hack/ginkgo-e2e.sh +++ b/hack/ginkgo-e2e.sh @@ -109,6 +109,10 @@ if [[ -z "${AUTH_CONFIG:-}" ]]; then auth_config=( "--auth_config=${HOME}/.kube/${INSTANCE_PREFIX}/kubernetes_auth" ) + elif [[ "${KUBERNETES_PROVIDER}" == "libvirt-coreos" ]]; then + auth_config=( + "--kubeconfig=${HOME}/.kube/.kubeconfig" + ) elif [[ "${KUBERNETES_PROVIDER}" == "conformance_test" ]]; then auth_config=( "--auth_config=${KUBERNETES_CONFORMANCE_TEST_AUTH_CONFIG:-}" @@ -117,12 +121,6 @@ if [[ -z "${AUTH_CONFIG:-}" ]]; then else auth_config=() fi - - if [[ "$KUBERNETES_PROVIDER" == "libvirt-coreos" ]]; then - host="http://${KUBE_MASTER_IP-}:8080" - else - host="https://${KUBE_MASTER_IP-}" - fi else echo "Conformance Test. No cloud-provider-specific preparation." KUBERNETES_PROVIDER="" @@ -130,13 +128,12 @@ else "--auth_config=${AUTH_CONFIG:-}" "--cert_dir=${CERT_DIR:-}" ) - host="https://${KUBE_MASTER_IP-}" fi # Use the kubectl binary from the same directory as the e2e binary. export PATH=$(dirname "${e2e}"):"${PATH}" "${e2e}" "${auth_config[@]:+${auth_config[@]}}" \ - --host="$host" \ + --host="https://${KUBE_MASTER_IP-}" \ --provider="${KUBERNETES_PROVIDER}" \ --gce_project="${PROJECT:-}" \ --gce_zone="${ZONE:-}" \ From fc6e6ed310684c427f71f148c05518b605ad4851 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9na=C3=AFc=20Huard?= Date: Thu, 19 Mar 2015 15:13:35 +0100 Subject: [PATCH 2/2] Explain when e2e --host parameter is used and when it is ignored --- hack/ginkgo-e2e.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hack/ginkgo-e2e.sh b/hack/ginkgo-e2e.sh index ea5fc60c0ad..54e0f44ea22 100755 --- a/hack/ginkgo-e2e.sh +++ b/hack/ginkgo-e2e.sh @@ -131,6 +131,9 @@ else fi # Use the kubectl binary from the same directory as the e2e binary. +# The --host setting is used only when providing --auth_config +# If --kubeconfig is used, the host to use is retrieved from the .kubeconfig +# file and the one provided with --host is ignored. export PATH=$(dirname "${e2e}"):"${PATH}" "${e2e}" "${auth_config[@]:+${auth_config[@]}}" \ --host="https://${KUBE_MASTER_IP-}" \