diff --git a/cluster/common.sh b/cluster/common.sh index 076b69325f..0f25b2bbb3 100644 --- a/cluster/common.sh +++ b/cluster/common.sh @@ -46,7 +46,7 @@ function create-kubeconfig() { touch "${KUBECONFIG}" fi local cluster_args=( - "--server=https://${KUBE_MASTER_IP}" + "--server=${KUBE_SERVER:-https://${KUBE_MASTER_IP}}" ) if [[ -z "${CA_CERT:-}" ]]; then cluster_args+=("--insecure-skip-tls-verify=true") diff --git a/cluster/kubectl.sh b/cluster/kubectl.sh index 2c146bc9d6..c4e9886d02 100755 --- a/cluster/kubectl.sh +++ b/cluster/kubectl.sh @@ -120,11 +120,6 @@ elif [[ "$KUBERNETES_PROVIDER" == "vagrant" ]]; then config=( "--kubeconfig=$HOME/.kubernetes_vagrant_kubeconfig" ) -elif [[ "$KUBERNETES_PROVIDER" == "libvirt-coreos" ]]; then - detect-master > /dev/null - config=( - "--server=http://${KUBE_MASTER_IP}:8080" - ) fi echo "current-context: \"$(${kubectl} "${config[@]:+${config[@]}}" config view -o template --template='{{index . "current-context"}}')\"" >&2 diff --git a/cluster/libvirt-coreos/util.sh b/cluster/libvirt-coreos/util.sh index c8b4116051..31920510be 100644 --- a/cluster/libvirt-coreos/util.sh +++ b/cluster/libvirt-coreos/util.sh @@ -18,7 +18,8 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../.. readonly ROOT=$(dirname "${BASH_SOURCE}") -source $ROOT/${KUBE_CONFIG_FILE:-"config-default.sh"} +source "$ROOT/${KUBE_CONFIG_FILE:-"config-default.sh"}" +source "$KUBE_ROOT/cluster/common.sh" export LIBVIRT_DEFAULT_URI=qemu:///system @@ -199,6 +200,7 @@ function wait-cluster-readiness { function kube-up { detect-master detect-minions + get-password initialize-pool keep_base_image initialize-network @@ -236,11 +238,9 @@ function kube-up { done export KUBECONFIG="${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 + export KUBE_SERVER="http://192.168.10.1:8080" + export CONTEXT="libvirt-coreos" + create-kubeconfig wait-cluster-readiness @@ -331,8 +331,8 @@ function test-teardown { # Set the {KUBE_USER} and {KUBE_PASSWORD} environment values required to interact with provider function get-password { - export KUBE_USER=core - echo "TODO get-password" + export KUBE_USER='' + export KUBE_PASSWORD='' } # SSH to a node by name or IP ($1) and run a command ($2).