This repository has been archived by the owner on Jan 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 560
Pre-pull hyperkube in VHD #4174
Merged
jackfrancis
merged 10 commits into
Azure:master
from
CecileRobertMichon:hyperkube-with-docker
Nov 5, 2018
Merged
Changes from 7 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
25a16cd
extract hyperkube with docker
28363f4
audit image versions
fef7531
exclude the current image
b750b6e
add ccm image
aac43c0
delete hyperkube-downloads
6c22bc9
add back img when runtime is not docker
6642f78
inverse if/else
9aa0331
missing repository for ccm
5a4d97c
unpack with img
9136df4
re-add img
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -175,34 +175,46 @@ function installImg() { | |
retrycmd_get_executable 120 5 $img_filepath "https://acs-mirror.azureedge.net/img/img-linux-amd64-v0.4.6" ls || exit $ERR_IMG_DOWNLOAD_TIMEOUT | ||
} | ||
|
||
function pullHyperkube() { | ||
retrycmd_if_failure 60 1 1200 img pull $HYPERKUBE_URL || exit $ERR_K8S_DOWNLOAD_TIMEOUT | ||
img unpack -o "/home/rootfs-${KUBERNETES_VERSION}" $HYPERKUBE_URL | ||
path=$(find /home/rootfs-${KUBERNETES_VERSION} -name "hyperkube") | ||
function extractHyperkube() { | ||
CLI_TOOL=$1 | ||
path="/home/hyperkube-downloads/${KUBERNETES_VERSION}" | ||
mkdir -p "$path" | ||
pullContainerImage $CLI_TOOL ${HYPERKUBE_URL} | ||
docker run --rm -v $path:$path {{WrapAsVariable "kubernetesHyperkubeSpec"}} /bin/bash -c "cp /hyperkube $path" | ||
CecileRobertMichon marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
if [[ $OS == $COREOS_OS_NAME ]]; then | ||
cp "$path" "/opt/kubelet" | ||
mv "$path" "/opt/kubectl" | ||
cp "$path/hyperkube" "/opt/kubelet" | ||
mv "$path/hyperkube" "/opt/kubectl" | ||
chmod a+x /opt/kubelet /opt/kubectl | ||
else | ||
cp "$path" "/usr/local/bin/kubelet-${KUBERNETES_VERSION}" | ||
mv "$path" "/usr/local/bin/kubectl-${KUBERNETES_VERSION}" | ||
cp "$path/hyperkube" "/usr/local/bin/kubelet-${KUBERNETES_VERSION}" | ||
mv "$path/hyperkube" "/usr/local/bin/kubectl-${KUBERNETES_VERSION}" | ||
fi | ||
} | ||
|
||
function extractHyperkube() { | ||
if [[ ! -f "/usr/local/bin/kubelet-${KUBERNETES_VERSION}" ]]; then | ||
installImg | ||
pullHyperkube | ||
function installKubeletAndKubectl() { | ||
if [[ ! -f "/usr/local/bin/kubectl-${KUBERNETES_VERSION}" ]]; then | ||
if [[ "$CONTAINER_RUNTIME" == "docker" ]]; then | ||
extractHyperkube "docker" | ||
else | ||
installImg | ||
extractHyperkube "img" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jackfrancis added back img pull when runtime isn't docker |
||
fi | ||
fi | ||
mv "/usr/local/bin/kubelet-${KUBERNETES_VERSION}" "/usr/local/bin/kubelet" | ||
mv "/usr/local/bin/kubectl-${KUBERNETES_VERSION}" "/usr/local/bin/kubectl" | ||
chmod a+x /usr/local/bin/kubelet /usr/local/bin/kubectl | ||
rm -rf /usr/local/bin/kubelet-* /usr/local/bin/kubectl-* /home/rootfs-* & | ||
rm -rf /usr/local/bin/kubelet-* /usr/local/bin/kubectl-* /home/hyperkube-downloads & | ||
} | ||
|
||
function pullContainerImage() { | ||
CLI_TOOL=$1 | ||
DOCKER_IMAGE_URL=$2 | ||
retrycmd_if_failure 60 1 1200 $CLI_TOOL pull $DOCKER_IMAGE_URL || exit $ERR_IMG_DOWNLOAD_TIMEOUT | ||
} | ||
|
||
function cleanUpContainerImages() { | ||
// TODO remove all unused container images at runtime | ||
docker rmi $(docker images --format '{{.Repository}}:{{.Tag}}' | grep -v ${KUBERNETES_VERSION} | grep 'hyperkube') & | ||
docker rmi $(docker images --format '{{.Repository}}:{{.Tag}}' | grep -v ${KUBERNETES_VERSION} | grep 'cloud-controller-manager') & | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is the one doing the extraction really so renamed to extractHyperkube