Merge pull request #26951 from madhusudancs/fed-detect-project-registry-base

Automatic merge from submit-queue

Detect the project in which the federation of clusters are being created and point the federation docker registry to that project.

Only the last commit here needs review.

Depends on #26950.

cc @colhom @kubernetes/sig-cluster-federation

[![Analytics](https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/.github/PULL_REQUEST_TEMPLATE.md?pixel)]()
This commit is contained in:
k8s-merge-robot
2016-06-13 06:00:04 -07:00
committed by GitHub
2 changed files with 27 additions and 2 deletions

View File

@@ -24,6 +24,27 @@
: "${KUBE_ROOT?Must set KUBE_ROOT env var}"
# Provides the $KUBERNETES_PROVIDER variable and detect-project function
source "${KUBE_ROOT}/cluster/kube-util.sh"
# If $FEDERATION_PUSH_REPO_BASE isn't set, then set the GCR registry name
# based on the detected project name for gce and gke providers.
FEDERATION_PUSH_REPO_BASE=${FEDERATION_PUSH_REPO_BASE:-}
if [[ -z "${FEDERATION_PUSH_REPO_BASE}" ]]; then
if [[ "${KUBERNETES_PROVIDER}" == "gke" || "${KUBERNETES_PROVIDER}" == "gce" ]]; then
# Populates $PROJECT
detect-project
if [[ ${PROJECT} == *':'* ]]; then
echo "${PROJECT} contains ':' and can not be used as FEDERATION_PUSH_REPO_BASE. Please set FEDERATION_PUSH_REPO_BASE explicitly."
exit 1
fi
FEDERATION_PUSH_REPO_BASE=gcr.io/${PROJECT}
else
echo "Must set FEDERATION_PUSH_REPO_BASE env var"
exit 1
fi
fi
FEDERATION_IMAGE_REPO_BASE=${FEDERATION_IMAGE_REPO_BASE:-'gcr.io/google_containers'}
FEDERATION_NAMESPACE=${FEDERATION_NAMESPACE:-federation-e2e}