diff --git a/README.md b/README.md index cf13618d2e31a..b39d6052ac36e 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ While the concepts and architecture in Kubernetes represent years of experience ### Contents * Getting Started Guides * [Google Compute Engine](docs/getting-started-guides/gce.md) + * [Locally](docs/getting-started-guides/locally.md) * [Vagrant](docs/getting-started-guides/vagrant.md) * Fedora (w/ [Ansible](docs/getting-started-guides/fedora/fedora_ansible_config.md) or [manual](docs/getting-started-guides/fedora/fedora_manual_config.md)) * [Circle CI](https://circleci.com/docs/docker#google-compute-engine-and-kubernetes) @@ -27,7 +28,6 @@ While the concepts and architecture in Kubernetes represent years of experience * [vSphere](docs/getting-started-guides/vsphere.md) * The following clouds are currently broken at Kubernetes head. Please sync your client to `v0.3` (`git checkout v0.3`) to use these: - * [Locally](docs/getting-started-guides/locally.md) * [Microsoft Azure](docs/getting-started-guides/azure.md) * [Kubernetes 101](https://github.com/GoogleCloudPlatform/kubernetes/tree/master/examples/walkthrough) * [kubecfg command line tool](https://github.com/GoogleCloudPlatform/kubernetes/blob/master/docs/cli.md) diff --git a/cluster/local/util.sh b/cluster/local/util.sh new file mode 100644 index 0000000000000..090bb74ad9c03 --- /dev/null +++ b/cluster/local/util.sh @@ -0,0 +1,19 @@ +#!/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. + +function detect-master () { + echo "Running locally" +} diff --git a/hack/local-up-cluster.sh b/hack/local-up-cluster.sh index e556cdaf96387..3f5a3ada8811c 100755 --- a/hack/local-up-cluster.sh +++ b/hack/local-up-cluster.sh @@ -18,7 +18,14 @@ # local-up.sh, but this one launches the three separate binaries. # You may need to run this as root to allow kubelet to open docker's socket. -source $(dirname $0)/util.sh +KUBE_ROOT=$(dirname "${BASH_SOURCE}")/.. +cd "${KUBE_ROOT}" + +# Stop right away if the build fails +set -e + +source "${KUBE_ROOT}/hack/lib/init.sh" +"${KUBE_ROOT}/hack/build-go.sh" docker ps 2> /dev/null 1> /dev/null if [ "$?" != "0" ]; then @@ -26,13 +33,8 @@ if [ "$?" != "0" ]; then exit 1 fi -# Stop right away if the build fails -set -e - -$(dirname $0)/build-go.sh - echo "Starting etcd" -start_etcd +kube::etcd::start # Shut down anyway if there's an error. set +e @@ -44,7 +46,43 @@ API_CORS_ALLOWED_ORIGINS=${API_CORS_ALLOWED_ORIGINS:-"/127.0.0.1(:[0-9]+)?$,/loc KUBELET_PORT=${KUBELET_PORT:-10250} LOG_LEVEL=${LOG_LEVEL:-3} -GO_OUT=$(dirname $0)/../_output/go/bin +# Detect the OS name/arch so that we can find our binary +case "$(uname -s)" in + Darwin) + host_os=darwin + ;; + Linux) + host_os=linux + ;; + *) + echo "Unsupported host OS. Must be Linux or Mac OS X." >&2 + exit 1 + ;; +esac + +case "$(uname -m)" in + x86_64*) + host_arch=amd64 + ;; + i?86_64*) + host_arch=amd64 + ;; + amd64*) + host_arch=amd64 + ;; + arm*) + host_arch=arm + ;; + i?86*) + host_arch=x86 + ;; + *) + echo "Unsupported host arch. Must be x86_64, 386 or arm." >&2 + exit 1 + ;; +esac + +GO_OUT="${KUBE_ROOT}/_output/local/bin/${host_os}/${host_arch}" APISERVER_LOG=/tmp/apiserver.log "${GO_OUT}/apiserver" \ @@ -54,15 +92,15 @@ APISERVER_LOG=/tmp/apiserver.log --etcd_servers="http://127.0.0.1:4001" \ --portal_net="10.0.0.0/24" \ --cors_allowed_origins="${API_CORS_ALLOWED_ORIGINS}" >"${APISERVER_LOG}" 2>&1 & - #--machines="127.0.0.1" \ removed APISERVER_PID=$! # Wait for apiserver to come up before launching the rest of the components. -wait_for_url "http://$API_HOST:$API_PORT/api/v1beta1/pods" "apiserver: " +kube::util::wait_for_url "http://${API_HOST}:${API_PORT}/api/v1beta1/pods" "apiserver: " CTLRMGR_LOG=/tmp/controller-manager.log "${GO_OUT}/controller-manager" \ -v=${LOG_LEVEL} \ + --machines="127.0.0.1" \ --master="${API_HOST}:${API_PORT}" >"${CTLRMGR_LOG}" 2>&1 & CTLRMGR_PID=$!