feat(local-cluster): add option to use alpha releases

pull/644/head
Adam Reese 9 years ago
parent 1a8e9cd46f
commit a4b73c208e

@ -30,6 +30,18 @@ command_exists() {
hash "${1}" 2>/dev/null hash "${1}" 2>/dev/null
} }
# fetch url using wget or curl and print to stdout
fetch_url() {
local url="$1"
if command_exists wget; then
curl -sSL "$url"
elif command_exists curl; then
wget -qO- "$url"
else
error_exit "Couldn't find curl or wget. Bailing out."
fi
}
# Program Functions ------------------------------------------------------------ # Program Functions ------------------------------------------------------------
# Check host platform and docker host # Check host platform and docker host
@ -91,14 +103,12 @@ verify_prereqs() {
# Get the latest stable release tag # Get the latest stable release tag
get_latest_version_number() { get_latest_version_number() {
local -r latest_url="https://storage.googleapis.com/kubernetes-release/release/stable.txt" local channel="stable"
if command_exists wget ; then if [[ -n "${ALPHA:-}" ]]; then
wget -qO- ${latest_url} channel="latest"
elif command_exists curl ; then
curl -Ss ${latest_url}
else
error_exit "Couldn't find curl or wget. Bailing out."
fi fi
local latest_url="https://storage.googleapis.com/kubernetes-release/release/${channel}.txt"
fetch_url "$latest_url"
} }
# Detect ip address od docker host # Detect ip address od docker host
@ -235,17 +245,13 @@ generate_kubeconfig() {
download_kubectl() { download_kubectl() {
echo "Downloading kubectl binary..." echo "Downloading kubectl binary..."
local output="/usr/local/bin/kubectl"
kubectl_url="https://storage.googleapis.com/kubernetes-release/release/${KUBE_VERSION}/bin/${host_os}/${host_arch}/kubectl" kubectl_url="https://storage.googleapis.com/kubernetes-release/release/${KUBE_VERSION}/bin/${host_os}/${host_arch}/kubectl"
if command_exists wget; then fetch_url "${kubectl_url}" > "${output}"
wget -O ./bin/kubectl "${kubectl_url}" chmod a+x "${output}"
elif command_exists curl; then
curl -sSOL ./bin/kubectl "${kubectl_url}"
else
error_exit "Couldn't find curl or wget. Bailing out."
fi
chmod a+x ./bin/kubectl
KUBECTL=./bin/kubectl KUBECTL="${output}"
} }
# Clean volumes that are left by kubelet # Clean volumes that are left by kubelet

Loading…
Cancel
Save