Files
kubernetes/cluster/get-kube.sh
Alain Roy fa9d79df75 Initial kube-up support for VMware's Photon Controller
This is for: https://github.com/kubernetes/kubernetes/issues/24121

Photon Controller is an open-source cloud management platform. More
information is available at:
http://vmware.github.io/photon-controller/

This commit provides initial support for Photon Controller. The
following features are tested and working:
- kube-up and kube-down
- Basic pod and service management
- Networking within the Kubernetes cluster
- UI and DNS addons

It has been tested with a Kubernetes cluster of up to 10
nodes. Further work on scaling is planned for the near future.

Internally we have implemented continuous integration testing and will
run it multiple times per day against the Kubernetes master branch
once this is integrated so we can quickly react to problems.

A few things have not yet been implemented, but are planned:
- Support for kube-push
- Support for test-build-release, test-setup, test-teardown

Assuming this is accepted for inclusion, we will write documentation
for the kubernetes.io site.

We have included a script to help users configure Photon Controller
for use with Kubernetes. While not required, it will help some
users get started more quickly. It will be documented.

We are aware of the kube-deploy efforts and will track them and
support them as appropriate.
2016-04-25 13:24:16 -07:00

138 lines
4.2 KiB
Bash
Executable File

#!/bin/bash
# Copyright 2014 The Kubernetes Authors 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 | bash
# or
# curl -sS https://get.k8s.io | bash
#
# 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 | bash
# Google Container Engine
# * export KUBERNETES_PROVIDER=gke; wget -q -O - https://get.k8s.io | bash
# Amazon EC2
# * export KUBERNETES_PROVIDER=aws; wget -q -O - https://get.k8s.io | bash
# Libvirt (with CoreOS as a guest operating system)
# * export KUBERNETES_PROVIDER=libvirt-coreos; wget -q -O - https://get.k8s.io | bash
# Vagrant (local virtual machines)
# * export KUBERNETES_PROVIDER=vagrant; wget -q -O - https://get.k8s.io | bash
# VMWare VSphere
# * export KUBERNETES_PROVIDER=vsphere; wget -q -O - https://get.k8s.io | bash
# VMWare Photon Controller
# * export KUBERNETES_PROVIDER=photon-controller; wget -q -O - https://get.k8s.io | bash
# Rackspace
# * export KUBERNETES_PROVIDER=rackspace; wget -q -O - https://get.k8s.io | bash
#
# Set KUBERNETES_SKIP_DOWNLOAD to non-empty to skip downloading a release.
# Set KUBERNETES_SKIP_CONFIRM to skip the installation confirmation prompt.
# Set KUBERNETES_RELEASE to the release you want to use (e.g. 'v1.2.0'). See https://github.com/kubernetes/kubernetes/releases for release options
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}/cluster/"
if [[ ":$PATH:" != *":${PWD}/cluster:"* ]]; then
echo "You may want to add this directory to your PATH in \$HOME/.profile"
fi
echo "Installation successful!"
)
}
if [[ "${KUBERNETES_SKIP_DOWNLOAD-}" ]]; then
create_cluster
exit 0
fi
function get_latest_version_number {
local -r latest_url="https://storage.googleapis.com/kubernetes-release/release/stable.txt"
if [[ $(which wget) ]]; then
wget -qO- ${latest_url}
elif [[ $(which curl) ]]; then
curl -Ss ${latest_url}
else
echo "Couldn't find curl or wget. Bailing out."
exit 4
fi
}
release=${KUBERNETES_RELEASE:-$(get_latest_version_number)}
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})."
echo "Supported platforms: Linux, Darwin."
echo "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"
elif [[ "${machine}" == "s390x*" ]]; then
arch="s390x"
elif [[ "${machine}" == "ppc64le" ]]; then
arch="ppc64le"
else
echo "Unknown, unsupported architecture (${machine})."
echo "Supported architectures x86_64, i686, arm, s390x, ppc64le."
echo "Bailing out."
exit 3
fi
file=kubernetes.tar.gz
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 -N ${release_url}
elif [[ $(which curl) ]]; then
curl -L -z ${file} ${release_url} -o ${file}
else
echo "Couldn't find curl or wget. Bailing out."
exit 1
fi
echo "Unpacking kubernetes release ${release}"
tar -xzf ${file}
create_cluster