mirror of
				https://github.com/k3s-io/kubernetes.git
				synced 2025-11-03 23:40:03 +00:00 
			
		
		
		
	Merge pull request #64782 from mgdevstack/master-local-cluster
Automatic merge from submit-queue (batch tested with PRs 65254, 64837, 64782, 64555, 64850). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Added OS verification for third party etcd binary **What this PR does / why we need it**: Enables downloading and relinking etcd to correct OS specific binary/package. **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes #64754 **Special notes for your reviewer**: There are some incidents when etcd binaries are present for darwin (etcd-v3.2.18-darwin-amd64) in `${KUBE_ROOT}/third_party` directory but local-cluster creation is invoked from linux system. This leads to cluster creation failure due to missing appropriate os dependent etcd binary (etcd-v3.2.18-linux-amd64). So in this PR, we are verifying OS and relinking `etcd` softlink to appropriate `etc-${version}-${os}-*` binary. **Release note**: ```release-note NONE ```
This commit is contained in:
		@@ -102,11 +102,13 @@ kube::etcd::cleanup() {
 | 
			
		||||
 | 
			
		||||
kube::etcd::install() {
 | 
			
		||||
  (
 | 
			
		||||
    local os
 | 
			
		||||
    cd "${KUBE_ROOT}/third_party"
 | 
			
		||||
    if [[ $(readlink etcd) == etcd-v${ETCD_VERSION}-* ]]; then
 | 
			
		||||
    os=$(uname | tr "[:upper:]" "[:lower:]")
 | 
			
		||||
    if [[ $(readlink etcd) == etcd-v${ETCD_VERSION}-${os}-* ]]; then
 | 
			
		||||
      return  # already installed
 | 
			
		||||
    fi
 | 
			
		||||
    if [[ $(uname) == "Darwin" ]]; then
 | 
			
		||||
    if [[ ${os} == "darwin" ]]; then
 | 
			
		||||
      download_file="etcd-v${ETCD_VERSION}-darwin-amd64.zip"
 | 
			
		||||
      url="https://github.com/coreos/etcd/releases/download/v${ETCD_VERSION}/${download_file}"
 | 
			
		||||
      kube::util::download_file "${url}" "${download_file}"
 | 
			
		||||
@@ -119,6 +121,7 @@ kube::etcd::install() {
 | 
			
		||||
      kube::util::download_file "${url}" "${download_file}"
 | 
			
		||||
      tar xzf "${download_file}"
 | 
			
		||||
      ln -fns "etcd-v${ETCD_VERSION}-linux-amd64" etcd
 | 
			
		||||
      rm "${download_file}"
 | 
			
		||||
    fi
 | 
			
		||||
    kube::log::info "etcd v${ETCD_VERSION} installed. To use:"
 | 
			
		||||
    kube::log::info "export PATH=$(pwd)/etcd:\${PATH}"
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user