Merge pull request #22728 from spxtr/tidy-shell

Auto commit by PR queue bot
This commit is contained in:
k8s-merge-robot 2016-03-09 13:59:13 -08:00
commit 36cb9d05ea
24 changed files with 32 additions and 90 deletions

View File

@ -34,6 +34,7 @@
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
source "${KUBE_ROOT}/cluster/aws/${KUBE_CONFIG_FILE-"config-default.sh"}"
source "${KUBE_ROOT}/cluster/common.sh"
source "${KUBE_ROOT}/cluster/lib/util.sh"
ALLOCATE_NODE_CIDRS=true

View File

@ -28,7 +28,6 @@ if [[ "${KUBERNETES_PROVIDER:-gce}" != "gce" ]]; then
fi
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
source "${KUBE_ROOT}/cluster/kube-env.sh"
source "${KUBE_ROOT}/cluster/kube-util.sh"
function usage() {

View File

@ -26,7 +26,6 @@ if [ -f "${KUBE_ROOT}/cluster/env.sh" ]; then
source "${KUBE_ROOT}/cluster/env.sh"
fi
source "${KUBE_ROOT}/cluster/kube-env.sh"
source "${KUBE_ROOT}/cluster/kube-util.sh"
echo "Bringing down cluster using provider: $KUBERNETES_PROVIDER"

View File

@ -1,52 +0,0 @@
#!/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.
# Set the default provider of Kubernetes cluster to know where to load provider-specific scripts
# You can override the default provider by exporting the KUBERNETES_PROVIDER
# variable in your bashrc
#
# The valid values: 'gce', 'gke', 'aws', 'vagrant', 'vsphere', 'libvirt-coreos', 'juju'
KUBERNETES_PROVIDER=${KUBERNETES_PROVIDER:-gce}
# Some useful colors.
if [[ -z "${color_start-}" ]]; then
declare -r color_start="\033["
declare -r color_red="${color_start}0;31m"
declare -r color_yellow="${color_start}0;33m"
declare -r color_green="${color_start}0;32m"
declare -r color_norm="${color_start}0m"
fi
# Returns the server version as MMmmpp, with MM as the major
# component, mm the minor component, and pp as the patch
# revision. e.g. 0.7.1 is echoed as 701, and 1.0.11 would be
# 10011. (This makes for easy integer comparison in bash.)
function kube_server_version() {
local server_version
local major
local minor
local patch
# This sed expression is the POSIX BRE to match strings like:
# Server Version: &version.Info{Major:"0", Minor:"7+", GitVersion:"v0.7.0-dirty", GitCommit:"ad44234f7152e9c66bc2853575445c7071335e57", GitTreeState:"dirty"}
# and capture the GitVersion portion (which has the patch level)
server_version=$(${KUBECTL} --match-server-version=false version | grep "Server Version:")
read major minor patch < <(
echo ${server_version} | \
sed "s/.*GitVersion:\"v\([0-9]\{1,\}\)\.\([0-9]\{1,\}\)\.\([0-9]\{1,\}\).*/\1 \2 \3/")
printf "%02d%02d%02d" ${major} ${minor} ${patch} | sed 's/^0*//'
}

View File

@ -29,7 +29,6 @@ if [ -f "${KUBE_ROOT}/cluster/env.sh" ]; then
source "${KUBE_ROOT}/cluster/env.sh"
fi
source "${KUBE_ROOT}/cluster/kube-env.sh"
source "${KUBE_ROOT}/cluster/kube-util.sh"
function usage() {

View File

@ -31,7 +31,6 @@ if [ -f "${KUBE_ROOT}/cluster/env.sh" ]; then
source "${KUBE_ROOT}/cluster/env.sh"
fi
source "${KUBE_ROOT}/cluster/kube-env.sh"
source "${KUBE_ROOT}/cluster/kube-util.sh"

View File

@ -14,9 +14,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# A library of helper functions that each provider hosting Kubernetes must implement to use cluster/kube-*.sh scripts.
# This script contains skeletons of helper functions that each provider hosting
# Kubernetes must implement to use cluster/kube-*.sh scripts.
# It sets KUBERNETES_PROVIDER to its default value (gce) if it is unset, and
# then sources cluster/${KUBERNETES_PROVIDER}/util.sh.
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
KUBERNETES_PROVIDER="${KUBERNETES_PROVIDER:-gce}"
# Must ensure that the following ENV vars are set
function detect-master {
@ -91,10 +94,8 @@ function test-teardown {
echo "TODO: test-teardown" 1>&2
}
# Providers util.sh scripts should define functions that override the above default functions impls
if [ -n "${KUBERNETES_PROVIDER}" ]; then
PROVIDER_UTILS="${KUBE_ROOT}/cluster/${KUBERNETES_PROVIDER}/util.sh"
if [ -f ${PROVIDER_UTILS} ]; then
source "${PROVIDER_UTILS}"
fi
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
PROVIDER_UTILS="${KUBE_ROOT}/cluster/${KUBERNETES_PROVIDER}/util.sh"
if [ -f ${PROVIDER_UTILS} ]; then
source "${PROVIDER_UTILS}"
fi

View File

@ -31,7 +31,6 @@ set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
source "${KUBE_ROOT}/cluster/kube-env.sh"
source "${KUBE_ROOT}/cluster/kube-util.sh"
# Get the absolute path of the directory component of a file, i.e. the

View File

@ -25,3 +25,11 @@ kube::util::wait-for-jobs() {
return ${fail}
}
# Some useful colors.
if [[ -z "${color_start-}" ]]; then
declare -r color_start="\033["
declare -r color_red="${color_start}0;31m"
declare -r color_yellow="${color_start}0;33m"
declare -r color_green="${color_start}0;32m"
declare -r color_norm="${color_start}0m"
fi

View File

@ -24,7 +24,6 @@ set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
: ${KUBE_CONFIG_FILE:="config-test.sh"}
source "${KUBE_ROOT}/cluster/kube-env.sh"
source "${KUBE_ROOT}/cluster/kube-util.sh"
readonly report_dir="${1:-_artifacts}"

View File

@ -23,8 +23,7 @@
# exit on any error
set -e
source $(dirname $0)/../kube-env.sh
source $(dirname $0)/../$KUBERNETES_PROVIDER/util.sh
source $(dirname $0)/../kube-util.sh
echo "Starting cluster using provider: $KUBERNETES_PROVIDER"

View File

@ -22,7 +22,7 @@ set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
source "${KUBE_ROOT}/cluster/kube-env.sh"
source "${KUBE_ROOT}/cluster/kube-util.sh"
echo "Testing cluster with provider: ${KUBERNETES_PROVIDER}" 1>&2

View File

@ -30,7 +30,7 @@ if [ -f "${KUBE_ROOT}/cluster/env.sh" ]; then
source "${KUBE_ROOT}/cluster/env.sh"
fi
source "${KUBE_ROOT}/cluster/kube-env.sh"
source "${KUBE_ROOT}/cluster/lib/util.sh"
source "${KUBE_ROOT}/cluster/kube-util.sh"
ALLOWED_NOTREADY_NODES="${ALLOWED_NOTREADY_NODES:-0}"

View File

@ -25,8 +25,7 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
export KUBECTL KUBE_CONFIG_FILE
source "${KUBE_ROOT}/cluster/kube-env.sh"
source "${KUBE_ROOT}/cluster/${KUBERNETES_PROVIDER}/util.sh"
source "${KUBE_ROOT}/cluster/kube-util.sh"
prepare-e2e

View File

@ -25,8 +25,7 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
export KUBECTL KUBE_CONFIG_FILE
source "${KUBE_ROOT}/cluster/kube-env.sh"
source "${KUBE_ROOT}/cluster/${KUBERNETES_PROVIDER}/util.sh"
source "${KUBE_ROOT}/cluster/kube-util.sh"
prepare-e2e

View File

@ -25,8 +25,7 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
export KUBECTL KUBE_CONFIG_FILE
source "${KUBE_ROOT}/cluster/kube-env.sh"
source "${KUBE_ROOT}/cluster/${KUBERNETES_PROVIDER}/util.sh"
source "${KUBE_ROOT}/cluster/kube-util.sh"
prepare-e2e

View File

@ -25,8 +25,7 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
export KUBECTL KUBE_CONFIG_FILE
source "${KUBE_ROOT}/cluster/kube-env.sh"
source "${KUBE_ROOT}/cluster/${KUBERNETES_PROVIDER}/util.sh"
source "${KUBE_ROOT}/cluster/kube-util.sh"
prepare-e2e

View File

@ -25,8 +25,7 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
export KUBECTL KUBE_CONFIG_FILE
source "${KUBE_ROOT}/cluster/kube-env.sh"
source "${KUBE_ROOT}/cluster/${KUBERNETES_PROVIDER}/util.sh"
source "${KUBE_ROOT}/cluster/kube-util.sh"
prepare-e2e

View File

@ -25,8 +25,7 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
export KUBECTL KUBE_CONFIG_FILE
source "${KUBE_ROOT}/cluster/kube-env.sh"
source "${KUBE_ROOT}/cluster/${KUBERNETES_PROVIDER}/util.sh"
source "${KUBE_ROOT}/cluster/kube-util.sh"
prepare-e2e

View File

@ -25,8 +25,7 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE}")/../..
export KUBECTL KUBE_CONFIG_FILE
source "${KUBE_ROOT}/cluster/kube-env.sh"
source "${KUBE_ROOT}/cluster/${KUBERNETES_PROVIDER}/util.sh"
source "${KUBE_ROOT}/cluster/kube-util.sh"
prepare-e2e

View File

@ -38,7 +38,7 @@ e2e_test=$(kube::util::find-binary "e2e.test")
export KUBECTL KUBE_CONFIG_FILE
source "${KUBE_ROOT}/cluster/kube-env.sh"
source "${KUBE_ROOT}/cluster/kube-util.sh"
# ---- Do cloud-provider-specific setup
if [[ -n "${KUBERNETES_CONFORMANCE_TEST:-}" ]]; then
@ -53,8 +53,6 @@ if [[ -n "${KUBERNETES_CONFORMANCE_TEST:-}" ]]; then
else
echo "Setting up for KUBERNETES_PROVIDER=\"${KUBERNETES_PROVIDER}\"."
source "${KUBE_ROOT}/cluster/${KUBERNETES_PROVIDER}/util.sh"
prepare-e2e
detect-master >/dev/null

View File

@ -20,7 +20,7 @@ set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
source "${KUBE_ROOT}/cluster/kube-env.sh"
source "${KUBE_ROOT}/cluster/lib/util.sh"
SILENT=true
ALL=false

View File

@ -19,7 +19,7 @@ set -o nounset
set -o pipefail
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
source "${KUBE_ROOT}/cluster/kube-env.sh"
source "${KUBE_ROOT}/cluster/lib/util.sh"
SILENT=true

View File

@ -16,7 +16,7 @@
source "${KUBE_ROOT}/cluster/kubemark/config-default.sh"
source "${KUBE_ROOT}/cluster/kubemark/util.sh"
source "${KUBE_ROOT}/cluster/kube-env.sh"
source "${KUBE_ROOT}/cluster/lib/util.sh"
detect-project &> /dev/null
export PROJECT