mirror of
				https://github.com/k3s-io/kubernetes.git
				synced 2025-11-03 23:40:03 +00:00 
			
		
		
		
	Default to GCR as the image registry if the provider is GCE or GKE.
This commit is contained in:
		@@ -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}"
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
    if [[ "${KUBERNETES_PROVIDER}" == "gke" || "${KUBERNETES_PROVIDER}" == "gce" ]]; then
 | 
			
		||||
        # Populates $PROJECT
 | 
			
		||||
        detect-project
 | 
			
		||||
    if [[ ${PROJECT} == *':'* ]]
 | 
			
		||||
    then
 | 
			
		||||
        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'}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user