Make libvirt-coreos cluster use create-kubeconfig

pull/6/head
Lénaïc Huard 2015-04-14 10:03:12 +02:00 committed by Jeff Lowdermilk
parent 4f6dc99075
commit 08f17bfa70
3 changed files with 9 additions and 14 deletions

View File

@ -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")

View File

@ -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

View File

@ -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).