Skip to content

Commit

Permalink
Fix local cluster scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
ddysher committed Nov 3, 2014
1 parent 808be2d commit a7bdb36
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
19 changes: 19 additions & 0 deletions cluster/local/util.sh
Original file line number Diff line number Diff line change
@@ -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"
}
58 changes: 48 additions & 10 deletions hack/local-up-cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,23 @@
# 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
echo "Failed to successfully run 'docker ps', please verify that docker is installed and \$DOCKER_HOST is set correctly."
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
Expand All @@ -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" \
Expand All @@ -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=$!

Expand Down

0 comments on commit a7bdb36

Please sign in to comment.