From c9b1232a17c118ba10b066c7d852695d3ce521a4 Mon Sep 17 00:00:00 2001 From: "Madhusudan.C.S" Date: Tue, 7 Jun 2016 02:11:46 -0700 Subject: [PATCH 1/3] Detect the project in which the federation of clusters are being created and point the federation docker registry to that project. --- federation/cluster/common.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/federation/cluster/common.sh b/federation/cluster/common.sh index bfb7392c8f0..c11453bacd9 100644 --- a/federation/cluster/common.sh +++ b/federation/cluster/common.sh @@ -24,7 +24,19 @@ : "${KUBE_ROOT?Must set KUBE_ROOT env var}" +# Provides the $KUBERNETES_PROVIDER variable and detect-project function +source "${KUBE_ROOT}/cluster/kube-util.sh" + +# 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_IMAGE_REPO_BASE=${FEDERATION_IMAGE_REPO_BASE:-'gcr.io/google_containers'} +FEDERATION_PUSH_REPO_BASE=${FEDERATION_PUSH_REPO_BASE:-gcr.io/${PROJECT}} FEDERATION_NAMESPACE=${FEDERATION_NAMESPACE:-federation-e2e} KUBE_PLATFORM=${KUBE_PLATFORM:-linux} From 498168b4da6ff246fb08849d91793dbd4f653f6d Mon Sep 17 00:00:00 2001 From: "Madhusudan.C.S" Date: Fri, 10 Jun 2016 00:22:14 -0700 Subject: [PATCH 2/3] Set FEDERATION_PUSH_REPO_BASE only when it isn't set. --- federation/cluster/common.sh | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/federation/cluster/common.sh b/federation/cluster/common.sh index c11453bacd9..20153734d24 100644 --- a/federation/cluster/common.sh +++ b/federation/cluster/common.sh @@ -27,16 +27,20 @@ # Provides the $KUBERNETES_PROVIDER variable and detect-project function source "${KUBE_ROOT}/cluster/kube-util.sh" -# 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 +# If $FEDERATION_PUSH_REPO_BASE isn't set set the GCR registry name based on the +# detected project name. +if [[ -z "${FEDERATION_PUSH_REPO_BASE}" ]]; 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} fi FEDERATION_IMAGE_REPO_BASE=${FEDERATION_IMAGE_REPO_BASE:-'gcr.io/google_containers'} -FEDERATION_PUSH_REPO_BASE=${FEDERATION_PUSH_REPO_BASE:-gcr.io/${PROJECT}} FEDERATION_NAMESPACE=${FEDERATION_NAMESPACE:-federation-e2e} KUBE_PLATFORM=${KUBE_PLATFORM:-linux} From c7a4401359d450fa3d3709beae6bb4d28f1e9834 Mon Sep 17 00:00:00 2001 From: "Madhusudan.C.S" Date: Mon, 13 Jun 2016 01:38:31 -0700 Subject: [PATCH 3/3] Default to GCR as the image registry if the provider is GCE or GKE. --- docs/devel/e2e-tests.md | 8 ++++++-- federation/cluster/common.sh | 23 ++++++++++++++--------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/docs/devel/e2e-tests.md b/docs/devel/e2e-tests.md index b67d3a5efb0..4a4a26342ed 100644 --- a/docs/devel/e2e-tests.md +++ b/docs/devel/e2e-tests.md @@ -266,8 +266,12 @@ Next, specify the docker repository where your ci images will be pushed. * **If `KUBERNETES_PROVIDER=gce` or `KUBERNETES_PROVIDER=gke`**: - You can simply set your push repo base based on your project name, and the necessary repositories will be auto-created when you - first push your container images. + If you use the same GCP project where you to run the e2e tests as the container image repository, + FEDERATION_PUSH_REPO_BASE environment variable will be defaulted to "gcr.io/${DEFAULT_GCP_PROJECT_NAME}". + You can skip ahead to the **Build** section. + + You can simply set your push repo base based on your project name, and the necessary repositories will be + auto-created when you first push your container images. ```sh $ export FEDERATION_PUSH_REPO_BASE="gcr.io/${GCE_PROJECT_NAME}" diff --git a/federation/cluster/common.sh b/federation/cluster/common.sh index 20153734d24..1f83867190e 100644 --- a/federation/cluster/common.sh +++ b/federation/cluster/common.sh @@ -27,17 +27,22 @@ # Provides the $KUBERNETES_PROVIDER variable and detect-project function source "${KUBE_ROOT}/cluster/kube-util.sh" -# If $FEDERATION_PUSH_REPO_BASE isn't set set the GCR registry name based on the -# detected project name. +# 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 - # 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 + 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 - FEDERATION_PUSH_REPO_BASE=gcr.io/${PROJECT} fi FEDERATION_IMAGE_REPO_BASE=${FEDERATION_IMAGE_REPO_BASE:-'gcr.io/google_containers'}