mirror of
				https://github.com/optim-enterprises-bv/kubernetes.git
				synced 2025-11-03 19:58:17 +00:00 
			
		
		
		
	@@ -74,12 +74,16 @@ kube::etcd::install() {
 | 
			
		||||
    cd "${KUBE_ROOT}/third_party"
 | 
			
		||||
    if [[ $(uname) == "Darwin" ]]; then
 | 
			
		||||
      download_file="etcd-v${ETCD_VERSION}-darwin-amd64.zip"
 | 
			
		||||
      curl -fsSLO --retry 3 --keepalive-time 2 https://github.com/coreos/etcd/releases/download/v${ETCD_VERSION}/"${download_file}"
 | 
			
		||||
      url="https://github.com/coreos/etcd/releases/download/v${ETCD_VERSION}/${download_file}"
 | 
			
		||||
      kube::util::download_file "${url}" "${download_file}"
 | 
			
		||||
      unzip -o "${download_file}"
 | 
			
		||||
      ln -fns "etcd-v${ETCD_VERSION}-darwin-amd64" etcd
 | 
			
		||||
      rm "${download_file}"
 | 
			
		||||
    else
 | 
			
		||||
      curl -fsSL --retry 3 --keepalive-time 2 https://github.com/coreos/etcd/releases/download/v${ETCD_VERSION}/etcd-v${ETCD_VERSION}-linux-amd64.tar.gz | tar xzf -
 | 
			
		||||
      url="https://github.com/coreos/etcd/releases/download/v${ETCD_VERSION}/etcd-v${ETCD_VERSION}-linux-amd64.tar.gz"
 | 
			
		||||
      download_file="etcd-v${ETCD_VERSION}-linux-amd64.tar.gz"
 | 
			
		||||
      kube::util::download_file "${url}" "${download_file}"
 | 
			
		||||
      tar xzf "${download_file}"
 | 
			
		||||
      ln -fns "etcd-v${ETCD_VERSION}-linux-amd64" etcd
 | 
			
		||||
    fi
 | 
			
		||||
    kube::log::info "etcd v${ETCD_VERSION} installed. To use:"
 | 
			
		||||
 
 | 
			
		||||
@@ -478,4 +478,23 @@ kube::util::has_changes_against_upstream_branch() {
 | 
			
		||||
  return 1
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
kube::util::download_file() {
 | 
			
		||||
  local -r url=$1
 | 
			
		||||
  local -r destination_file=$2
 | 
			
		||||
 | 
			
		||||
  rm  ${destination_file} 2&> /dev/null || true
 | 
			
		||||
 | 
			
		||||
  for i in $(seq 5)
 | 
			
		||||
  do
 | 
			
		||||
    if ! curl -fsSL --retry 3 --keepalive-time 2 ${url} -o ${destination_file}; then
 | 
			
		||||
      echo "Downloading ${url} failed. $((5-i)) retries left."
 | 
			
		||||
      sleep 1
 | 
			
		||||
    else
 | 
			
		||||
      echo "Downloading ${url} succeed"
 | 
			
		||||
      return 0
 | 
			
		||||
    fi
 | 
			
		||||
  done
 | 
			
		||||
  return 1
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# ex: ts=2 sw=2 et filetype=sh
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user