...
1#!/usr/bin/env bash
2
3# Copyright 2014 The Kubernetes Authors.
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17# Bring up a Kubernetes cluster.
18#
19# If the full release name (gs://<bucket>/<release>) is passed in then we take
20# that directly. If not then we assume we are doing development stuff and take
21# the defaults in the release config.
22
23set -o errexit
24set -o nounset
25set -o pipefail
26
27KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
28
29if [ -f "${KUBE_ROOT}/cluster/env.sh" ]; then
30 source "${KUBE_ROOT}/cluster/env.sh"
31fi
32
33source "${KUBE_ROOT}/cluster/kube-util.sh"
34
35if [ -z "${ZONE-}" ]; then
36 echo "... Starting cluster using provider: ${KUBERNETES_PROVIDER}" >&2
37else
38 echo "... Starting cluster in ${ZONE} using provider ${KUBERNETES_PROVIDER}" >&2
39fi
40
41echo "... calling verify-prereqs" >&2
42verify-prereqs
43echo "... calling verify-kube-binaries" >&2
44verify-kube-binaries
45echo "... calling verify-release-tars" >&2
46verify-release-tars
47
48echo "... calling kube-up" >&2
49kube-up
50
51echo "... calling validate-cluster" >&2
52# Override errexit
53(validate-cluster) && validate_result="$?" || validate_result="$?"
54
55# We have two different failure modes from validate cluster:
56# - 1: fatal error - cluster won't be working correctly
57# - 2: weak error - something went wrong, but cluster probably will be working correctly
58# We just print an error message in case 2).
59if [[ "${validate_result}" == "1" ]]; then
60 exit 1
61elif [[ "${validate_result}" == "2" ]]; then
62 echo "...ignoring non-fatal errors in validate-cluster" >&2
63fi
64
65if [[ "${ENABLE_PROXY:-}" == "true" ]]; then
66 # shellcheck disable=SC1091
67 . /tmp/kube-proxy-env
68 echo ""
69 echo "*** Please run the following to add the kube-apiserver endpoint to your proxy white-list ***"
70 cat /tmp/kube-proxy-env
71 echo "*** ***"
72 echo ""
73fi
74
75echo -e "Done, listing cluster services:\n" >&2
76"${KUBE_ROOT}/cluster/kubectl.sh" cluster-info
77echo
78
79exit 0
View as plain text