Skip to content

Commit

Permalink
Move KUBERNETES_PROVIDER setting into cluster/kube-util.sh.
Browse files Browse the repository at this point in the history
  • Loading branch information
spxtr committed Mar 9, 2016
1 parent e8fda8c commit 401985b
Show file tree
Hide file tree
Showing 18 changed files with 19 additions and 42 deletions.
1 change: 0 additions & 1 deletion cluster/gce/upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
1 change: 0 additions & 1 deletion cluster/kube-down.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
8 changes: 0 additions & 8 deletions cluster/kube-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,6 @@
# 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["
Expand Down
1 change: 0 additions & 1 deletion cluster/kube-push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
1 change: 0 additions & 1 deletion cluster/kube-up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"


Expand Down
17 changes: 9 additions & 8 deletions cluster/kube-util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
1 change: 0 additions & 1 deletion cluster/kubectl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion cluster/log-dump.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
3 changes: 1 addition & 2 deletions cluster/rackspace/kube-up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion cluster/test-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 1 addition & 2 deletions hack/e2e-internal/build-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 1 addition & 2 deletions hack/e2e-internal/e2e-cluster-size.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 1 addition & 2 deletions hack/e2e-internal/e2e-down.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 1 addition & 2 deletions hack/e2e-internal/e2e-push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 1 addition & 2 deletions hack/e2e-internal/e2e-status.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 1 addition & 2 deletions hack/e2e-internal/e2e-up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 1 addition & 2 deletions hack/e2e-internal/e2e-upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 1 addition & 3 deletions hack/ginkgo-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 401985b

Please sign in to comment.