From bbb6d97bb53f86e7457d451a2e21cf1af5239613 Mon Sep 17 00:00:00 2001 From: Brendan Burns Date: Mon, 22 Dec 2014 16:00:35 -0800 Subject: [PATCH 1/3] Add a script suitable for wget https://get.k8s.io | sh installation --- cluster/get-kube.sh | 93 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100755 cluster/get-kube.sh diff --git a/cluster/get-kube.sh b/cluster/get-kube.sh new file mode 100755 index 00000000000..e4297be0178 --- /dev/null +++ b/cluster/get-kube.sh @@ -0,0 +1,93 @@ +#!/bin/bash + +# Copyright 2014 Google Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Bring up a Kubernetes cluster. +# Usage: +# wget -q -O - https://get.k8s.io | sh +# or +# curl -sS https://get.k8s.io | sh +# +# Advanced options +# Set KUBERNETES_PROVIDER to choose between different providers: +# Google Compute Engine [default] +# * export KUBERNETES_PROVIDER=gce; wget -q -O - https://get.k8s.io | sh +# Amazon EC2 +# * export KUBERNETES_PROVIDER=aws; wget -q -O - https://get.k8s.io | sh +# Microsoft Azure +# * export KUBERNETES_PROVIDER=azure; wget -q -O - https://get.k8s.io | sh +# Vagrant (local virtual machines) +# * export KUBERNETES_PROVIDER=vagrant; wget -q -O - https://get.k8s.io | sh +# VMWare VSphere +# * export KUBERNETES_PROVIDER=vsphere; wget -q -O - https://get.k8s.io | sh +# Rackspace +# * export KUBERNETES_PROVIDER=rackspace; wget -q -O - https://get.k8s.io | sh + +set -o errexit +set -o nounset +set -o pipefail + +release=v0.7.0 +release_url=https://storage.googleapis.com/kubernetes-release/release/${release}/kubernetes.tar.gz + +uname=$(uname) +if [[ "${uname}" == "Darwin" ]]; then + platform="darwin" +elif [[ "${uname}" == "Linux" ]]; then + platform="linux" +else + echo "Unknown, unsupported platform: (${uname}). Bailing out." + exit 2 +fi + +machine=$(uname -m) +if [[ "${machine}" == "x86_64" ]]; then + arch="amd64" +elif [[ "${machine}" == "i686" ]]; then + arch="386" +elif [[ "${machine}" == "arm*" ]]; then + arch="arm" +else + echo "Unknown, unsupported architecture (${machine}). Bailing out." + exit 3 +fi + +file=kubernetes.tar.gz + +echo "Downloading kubernetes release ${release}" +if [[ $(which wget) ]]; then + wget -O ${file} ${release_url} +elif [[ $(which curl) ]]; then + curl -o ${file} ${release_url} +else + echo "Couldn't find curl or wget. Bailing out." + exit 1 +fi + +echo "Unpacking kubernetes release ${release}" +tar -xzf ${file} +rm ${file} + +echo "Installing kubernetes..." +( + cd kubernetes + ./cluster/kube-up.sh +) + +echo "Kubernetes binaries at ${PWD}/kubernetes/platforms/${platform}/${arch}/PATH" +echo "You may want to add this directory to your PATH in \$HOME/.profile" + +echo "Installation successful!" + From ab429598e7192d19ac129d2e947b90da794c6d2d Mon Sep 17 00:00:00 2001 From: Brendan Burns Date: Tue, 23 Dec 2014 11:33:33 -0800 Subject: [PATCH 2/3] Update to 0.7.2, forgot to push... --- cluster/get-kube.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cluster/get-kube.sh b/cluster/get-kube.sh index e4297be0178..e02e0133363 100755 --- a/cluster/get-kube.sh +++ b/cluster/get-kube.sh @@ -39,7 +39,7 @@ set -o errexit set -o nounset set -o pipefail -release=v0.7.0 +release=v0.7.2 release_url=https://storage.googleapis.com/kubernetes-release/release/${release}/kubernetes.tar.gz uname=$(uname) From 1091744a5fca69c42fe8a70f165b10b32c42f178 Mon Sep 17 00:00:00 2001 From: Brendan Burns Date: Tue, 6 Jan 2015 13:08:31 -0800 Subject: [PATCH 3/3] Address comments. --- cluster/get-kube.sh | 54 ++++++++++++++++++++++++++++++++------------- 1 file changed, 39 insertions(+), 15 deletions(-) diff --git a/cluster/get-kube.sh b/cluster/get-kube.sh index e02e0133363..a35b122de3d 100755 --- a/cluster/get-kube.sh +++ b/cluster/get-kube.sh @@ -34,11 +34,30 @@ # * export KUBERNETES_PROVIDER=vsphere; wget -q -O - https://get.k8s.io | sh # Rackspace # * export KUBERNETES_PROVIDER=rackspace; wget -q -O - https://get.k8s.io | sh - +# +# Set KUBERNETES_SKIP_DOWNLOAD to non-empty to skip downloading a release. +# Set KUBERNETES_SKIP_CONFIRM to skip the installation confirmation prompt. set -o errexit set -o nounset set -o pipefail +function create-cluster { + echo "Creating a kubernetes on ${KUBERNETES_PROVIDER:-gce}..." + ( + cd kubernetes + ./cluster/kube-up.sh + echo "Kubernetes binaries at ${PWD}/kubernetes/cluster/" + echo "You may want to add this directory to your PATH in \$HOME/.profile" + + echo "Installation successful!" + ) +} + +if [[ "${KUBERNETES_SKIP_DOWNLOAD-}" ]]; then + create-cluster + exit 0 +fi + release=v0.7.2 release_url=https://storage.googleapis.com/kubernetes-release/release/${release}/kubernetes.tar.gz @@ -48,7 +67,9 @@ if [[ "${uname}" == "Darwin" ]]; then elif [[ "${uname}" == "Linux" ]]; then platform="linux" else - echo "Unknown, unsupported platform: (${uname}). Bailing out." + echo "Unknown, unsupported platform: (${uname})." + echo "Supported platforms: Linux, Darwin." + echo "Bailing out." exit 2 fi @@ -60,17 +81,29 @@ elif [[ "${machine}" == "i686" ]]; then elif [[ "${machine}" == "arm*" ]]; then arch="arm" else - echo "Unknown, unsupported architecture (${machine}). Bailing out." + echo "Unknown, unsupported architecture (${machine})." + echo "Supported architectures x86_64, i686, arm*" + echo "Bailing out." exit 3 fi file=kubernetes.tar.gz -echo "Downloading kubernetes release ${release}" + +echo "Downloading kubernetes release ${release} to ${PWD}/kubernetes.tar.gz" +if [[ -n "${KUBERNETES_SKIP_CONFIRM-}" ]]; then + echo "Is this ok? [Y]/n" + read confirm + if [[ "$confirm" == "n" ]]; then + echo "Aborting." + exit 0 + fi +fi + if [[ $(which wget) ]]; then wget -O ${file} ${release_url} elif [[ $(which curl) ]]; then - curl -o ${file} ${release_url} + curl -L -o ${file} ${release_url} else echo "Couldn't find curl or wget. Bailing out." exit 1 @@ -80,14 +113,5 @@ echo "Unpacking kubernetes release ${release}" tar -xzf ${file} rm ${file} -echo "Installing kubernetes..." -( - cd kubernetes - ./cluster/kube-up.sh -) - -echo "Kubernetes binaries at ${PWD}/kubernetes/platforms/${platform}/${arch}/PATH" -echo "You may want to add this directory to your PATH in \$HOME/.profile" - -echo "Installation successful!" +create-cluster