mirror of
				https://github.com/k3s-io/kubernetes.git
				synced 2025-11-04 07:49:35 +00:00 
			
		
		
		
	Merge pull request #20398 from mfanjie/mfanjie-patch-1
Auto commit by PR queue bot
This commit is contained in:
		@@ -73,17 +73,19 @@ When building final release tars, they are first staged into `_output/release-st
 | 
				
			|||||||
## Proxy Settings
 | 
					## Proxy Settings
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
If you are behind a proxy, you need to edit `build/build-image/Dockerfile` and add proxy settings to execute command in that container correctly.
 | 
					If you are behind a proxy, you need to export proxy settings for kubernetes build, the following environment variables should be defined.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
example:
 | 
					```
 | 
				
			||||||
 | 
					export KUBE_BUILD_HTTP_PROXY=http://username:password@proxyaddr:proxyport
 | 
				
			||||||
 | 
					export KUBE_BUILD_HTTPS_PROXY=http://username:password@proxyaddr:proxyport
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
`ENV http_proxy http://username:password@proxyaddr:proxyport`
 | 
					Optionally, you can specify addresses of no proxy for kubernetes build, for example
 | 
				
			||||||
 | 
					
 | 
				
			||||||
`ENV https_proxy http://username:password@proxyaddr:proxyport`
 | 
					```
 | 
				
			||||||
 | 
					export KUBE_BUILD_NO_PROXY=127.0.0.1
 | 
				
			||||||
Besides, to avoid integration test touch the proxy while connecting to local etcd service, you need to set
 | 
					```
 | 
				
			||||||
 | 
					If you are using sudo to make kubernetes build for example make quick-release, you need run `sudo -E make quick-release` to pass the environment variables.
 | 
				
			||||||
`ENV no_proxy 127.0.0.1`
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
## TODOs
 | 
					## TODOs
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,6 +22,10 @@ MAINTAINER  Joe Beda <jbeda@google.com>
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
ENV GOOS    linux
 | 
					ENV GOOS    linux
 | 
				
			||||||
ENV GOARCH  amd64
 | 
					ENV GOARCH  amd64
 | 
				
			||||||
 | 
					ENV http_proxy KUBE_BUILD_HTTP_PROXY
 | 
				
			||||||
 | 
					ENV https_proxy KUBE_BUILD_HTTPS_PROXY
 | 
				
			||||||
 | 
					ENV no_proxy KUBE_BUILD_NO_PROXY
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# work around 64MB tmpfs size in Docker 1.6
 | 
					# work around 64MB tmpfs size in Docker 1.6
 | 
				
			||||||
ENV TMPDIR /tmp.k8s
 | 
					ENV TMPDIR /tmp.k8s
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -189,7 +189,11 @@ function kube::build::prepare_docker_machine() {
 | 
				
			|||||||
  kube::log::status "docker-machine was found."
 | 
					  kube::log::status "docker-machine was found."
 | 
				
			||||||
  docker-machine inspect "${DOCKER_MACHINE_NAME}" >/dev/null || {
 | 
					  docker-machine inspect "${DOCKER_MACHINE_NAME}" >/dev/null || {
 | 
				
			||||||
    kube::log::status "Creating a machine to build Kubernetes"
 | 
					    kube::log::status "Creating a machine to build Kubernetes"
 | 
				
			||||||
    docker-machine create --driver "${DOCKER_MACHINE_DRIVER}" "${DOCKER_MACHINE_NAME}" > /dev/null || {
 | 
					    docker-machine create --driver "${DOCKER_MACHINE_DRIVER}" \
 | 
				
			||||||
 | 
					      --engine-env HTTP_PROXY="${KUBE_BUILD_HTTP_PROXY:-}" \
 | 
				
			||||||
 | 
					      --engine-env HTTPS_PROXY="${KUBE_BUILD_HTTPS_PROXY:-}" \
 | 
				
			||||||
 | 
					      --engine-env NO_PROXY="${KUBE_BUILD_NO_PROXY:-127.0.0.1}" \
 | 
				
			||||||
 | 
					      "${DOCKER_MACHINE_NAME}" > /dev/null || {
 | 
				
			||||||
      kube::log::error "Something went wrong creating a machine."
 | 
					      kube::log::error "Something went wrong creating a machine."
 | 
				
			||||||
      kube::log::error "Try the following: "
 | 
					      kube::log::error "Try the following: "
 | 
				
			||||||
      kube::log::error "docker-machine create -d ${DOCKER_MACHINE_DRIVER} ${DOCKER_MACHINE_NAME}"
 | 
					      kube::log::error "docker-machine create -d ${DOCKER_MACHINE_DRIVER} ${DOCKER_MACHINE_NAME}"
 | 
				
			||||||
@@ -233,6 +237,18 @@ function kube::build::is_osx() {
 | 
				
			|||||||
  [[ "$(uname)" == "Darwin" ]]
 | 
					  [[ "$(uname)" == "Darwin" ]]
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function kube::build::update_dockerfile() {
 | 
				
			||||||
 | 
					  if kube::build::is_osx; then
 | 
				
			||||||
 | 
					    sed_opts=("-i ''")
 | 
				
			||||||
 | 
					  else
 | 
				
			||||||
 | 
					    sed_opts=(-i)
 | 
				
			||||||
 | 
					  fi
 | 
				
			||||||
 | 
					  sed ${sed_opts[@]} "s/KUBE_BUILD_IMAGE_CROSS/${KUBE_BUILD_IMAGE_CROSS}/" ${build_context_dir}/Dockerfile
 | 
				
			||||||
 | 
					  sed ${sed_opts[@]} "s#KUBE_BUILD_HTTP_PROXY#${KUBE_BUILD_HTTP_PROXY:-\"\"}#" ${build_context_dir}/Dockerfile
 | 
				
			||||||
 | 
					  sed ${sed_opts[@]} "s#KUBE_BUILD_HTTPS_PROXY#${KUBE_BUILD_HTTPS_PROXY:-\"\"}#" ${build_context_dir}/Dockerfile
 | 
				
			||||||
 | 
					  sed ${sed_opts[@]} "s#KUBE_BUILD_NO_PROXY#${KUBE_BUILD_NO_PROXY:-127.0.0.1}#" ${build_context_dir}/Dockerfile
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function kube::build::ensure_docker_in_path() {
 | 
					function kube::build::ensure_docker_in_path() {
 | 
				
			||||||
  if [[ -z "$(which docker)" ]]; then
 | 
					  if [[ -z "$(which docker)" ]]; then
 | 
				
			||||||
    kube::log::error "Can't find 'docker' in PATH, please fix and retry."
 | 
					    kube::log::error "Can't find 'docker' in PATH, please fix and retry."
 | 
				
			||||||
@@ -502,11 +518,8 @@ function kube::build::build_image() {
 | 
				
			|||||||
  kube::version::save_version_vars "${build_context_dir}/kube-version-defs"
 | 
					  kube::version::save_version_vars "${build_context_dir}/kube-version-defs"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  cp build/build-image/Dockerfile ${build_context_dir}/Dockerfile
 | 
					  cp build/build-image/Dockerfile ${build_context_dir}/Dockerfile
 | 
				
			||||||
  if kube::build::is_osx; then
 | 
					  kube::build::update_dockerfile
 | 
				
			||||||
    sed -i "" "s/KUBE_BUILD_IMAGE_CROSS/${KUBE_BUILD_IMAGE_CROSS}/" ${build_context_dir}/Dockerfile
 | 
					
 | 
				
			||||||
  else
 | 
					 | 
				
			||||||
    sed -i "s/KUBE_BUILD_IMAGE_CROSS/${KUBE_BUILD_IMAGE_CROSS}/" ${build_context_dir}/Dockerfile
 | 
					 | 
				
			||||||
  fi
 | 
					 | 
				
			||||||
  # We don't want to force-pull this image because it's based on a local image
 | 
					  # We don't want to force-pull this image because it's based on a local image
 | 
				
			||||||
  # (see kube::build::build_image_cross), not upstream.
 | 
					  # (see kube::build::build_image_cross), not upstream.
 | 
				
			||||||
  kube::build::docker_build "${KUBE_BUILD_IMAGE}" "${build_context_dir}" 'false'
 | 
					  kube::build::docker_build "${KUBE_BUILD_IMAGE}" "${build_context_dir}" 'false'
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user