Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
db3fd62f
Commit
db3fd62f
authored
Oct 25, 2016
by
Jeff Grafton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make get-kube.sh smarter when choosing if it should download
parent
2e503c1a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
18 deletions
+44
-18
get-kube-binaries.sh
cluster/get-kube-binaries.sh
+2
-2
get-kube.sh
cluster/get-kube.sh
+42
-16
No files found.
cluster/get-kube-binaries.sh
View file @
db3fd62f
#!/
bin/
bash
#!/
usr/bin/env
bash
# Copyright 2016 The Kubernetes Authors.
# Copyright 2016 The Kubernetes Authors.
#
#
...
@@ -117,7 +117,7 @@ function download_tarball() {
...
@@ -117,7 +117,7 @@ function download_tarball() {
url
=
"
${
DOWNLOAD_URL_PREFIX
}
/
${
file
}
"
url
=
"
${
DOWNLOAD_URL_PREFIX
}
/
${
file
}
"
mkdir
-p
"
${
download_path
}
"
mkdir
-p
"
${
download_path
}
"
if
[[
$(
which curl
)
]]
;
then
if
[[
$(
which curl
)
]]
;
then
curl
-L
"
${
url
}
"
-o
"
${
download_path
}
/
${
file
}
"
curl
-L
--retry
3
--keepalive-time
2
"
${
url
}
"
-o
"
${
download_path
}
/
${
file
}
"
elif
[[
$(
which wget
)
]]
;
then
elif
[[
$(
which wget
)
]]
;
then
wget
"
${
url
}
"
-O
"
${
download_path
}
/
${
file
}
"
wget
"
${
url
}
"
-O
"
${
download_path
}
/
${
file
}
"
else
else
...
...
cluster/get-kube.sh
View file @
db3fd62f
#!/
bin/
bash
#!/
usr/bin/env
bash
# Copyright 2014 The Kubernetes Authors.
# Copyright 2014 The Kubernetes Authors.
#
#
...
@@ -113,18 +113,15 @@ fi
...
@@ -113,18 +113,15 @@ fi
function
get_latest_version_number
{
function
get_latest_version_number
{
local
-r
latest_url
=
"https://storage.googleapis.com/kubernetes-release/release/stable.txt"
local
-r
latest_url
=
"https://storage.googleapis.com/kubernetes-release/release/stable.txt"
if
[[
$(
which wget
)
]]
;
then
if
[[
$(
which wget
)
]]
;
then
wget
-qO-
${
latest_url
}
wget
-qO-
"
${
latest_url
}
"
elif
[[
$(
which curl
)
]]
;
then
elif
[[
$(
which curl
)
]]
;
then
curl
-Ss
${
latest_url
}
curl
-Ss
f
--retry
3
--keepalive-time
2
"
${
latest_url
}
"
else
else
echo
"Couldn't find curl or wget. Bailing out."
>
&2
echo
"Couldn't find curl or wget. Bailing out."
>
&2
exit
4
exit
4
fi
fi
}
}
release
=
${
KUBERNETES_RELEASE
:-$(
get_latest_version_number
)}
release_url
=
"
${
KUBERNETES_RELEASE_URL
}
/
${
release
}
/kubernetes.tar.gz"
# TODO: remove client checks once kubernetes.tar.gz no longer includes client
# TODO: remove client checks once kubernetes.tar.gz no longer includes client
# binaries by default.
# binaries by default.
kernel
=
$(
uname
-s
)
kernel
=
$(
uname
-s
)
...
@@ -165,10 +162,36 @@ case "${machine}" in
...
@@ -165,10 +162,36 @@ case "${machine}" in
esac
esac
file
=
kubernetes.tar.gz
file
=
kubernetes.tar.gz
release
=
${
KUBERNETES_RELEASE
:-$(
get_latest_version_number
)}
release_url
=
"
${
KUBERNETES_RELEASE_URL
}
/
${
release
}
/
${
file
}
"
need_download
=
true
if
[[
-r
"
${
PWD
}
/
${
file
}
"
]]
;
then
downloaded_version
=
$(
tar
-xzOf
"
${
PWD
}
/
${
file
}
"
kubernetes/version 2>/dev/null
||
true
)
echo
"Found preexisting
${
file
}
, release
${
downloaded_version
}
"
if
[[
"
${
downloaded_version
}
"
==
"
${
release
}
"
]]
;
then
echo
"Using preexisting kubernetes.tar.gz"
need_download
=
false
fi
fi
if
"
${
need_download
}
"
;
then
echo
"Downloading kubernetes release
${
release
}
"
echo
" from
${
release_url
}
"
echo
" to
${
PWD
}
/
${
file
}
"
fi
if
[[
-e
"
${
PWD
}
/kubernetes"
]]
;
then
# Let's try not to accidentally nuke something that isn't a kubernetes
# release dir.
if
[[
!
-f
"
${
PWD
}
/kubernetes/version"
]]
;
then
echo
"
${
PWD
}
/kubernetes exists but does not look like a Kubernetes release."
echo
"Aborting!"
exit
5
fi
echo
"Will also delete preexisting 'kubernetes' directory."
fi
echo
"Downloading kubernetes release
${
release
}
"
echo
" from
${
release_url
}
"
echo
" to
${
PWD
}
/kubernetes.tar.gz"
if
[[
-z
"
${
KUBERNETES_SKIP_CONFIRM
-
}
"
]]
;
then
if
[[
-z
"
${
KUBERNETES_SKIP_CONFIRM
-
}
"
]]
;
then
echo
"Is this ok? [Y]/n"
echo
"Is this ok? [Y]/n"
read
confirm
read
confirm
...
@@ -178,16 +201,19 @@ if [[ -z "${KUBERNETES_SKIP_CONFIRM-}" ]]; then
...
@@ -178,16 +201,19 @@ if [[ -z "${KUBERNETES_SKIP_CONFIRM-}" ]]; then
fi
fi
fi
fi
if
[[
$(
which curl
)
]]
;
then
if
"
${
need_download
}
"
;
then
curl
-L
-z
${
file
}
${
release_url
}
-o
${
file
}
if
[[
$(
which curl
)
]]
;
then
elif
[[
$(
which wget
)
]]
;
then
curl
-L
--retry
3
--keepalive-time
2
"
${
release_url
}
"
-o
"
${
file
}
"
wget
-N
${
release_url
}
elif
[[
$(
which wget
)
]]
;
then
else
wget
"
${
release_url
}
"
echo
"Couldn't find curl or wget. Bailing out."
else
exit
1
echo
"Couldn't find curl or wget. Bailing out."
exit
1
fi
fi
fi
echo
"Unpacking kubernetes release
${
release
}
"
echo
"Unpacking kubernetes release
${
release
}
"
rm
-rf
"
${
PWD
}
/kubernetes"
tar
-xzf
${
file
}
tar
-xzf
${
file
}
download_kube_binaries
download_kube_binaries
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment