Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Commit

Permalink
download hyperkube without docker
Browse files Browse the repository at this point in the history
Signed-off-by: Jess Frazelle <[email protected]>
  • Loading branch information
jessfraz authored and jackfrancis committed May 18, 2018
1 parent 25cfb55 commit 1462676
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 73 deletions.
34 changes: 0 additions & 34 deletions parts/k8s/kubernetesagentcustomdata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,40 +74,6 @@ write_files:
name: localclustercontext
current-context: localclustercontext
- path: "/etc/systemd/system/hyperkube-extract.service"
permissions: "0644"
owner: "root"
content: |
[Unit]
Description=kubectl and kubelet extraction
Requires=docker.service
After=docker.service
{{if .IsCoreOS}}
ConditionPathExists=!/opt/kubectl
{{else}}
ConditionPathExists=!/usr/local/bin/kubectl
{{end}}

[Service]
TimeoutStartSec=0
Restart=on-failure
RestartSec=5s
ExecStartPre=/bin/mkdir -p /tmp/hyperkubedir
ExecStartPre=/usr/bin/docker pull {{WrapAsVariable "kubernetesHyperkubeSpec"}}
ExecStartPre=/usr/bin/docker run --rm -v /tmp/hyperkubedir:/opt/hyperkubedir {{WrapAsVariable "kubernetesHyperkubeSpec"}} /bin/bash -c "cp /hyperkube /opt/hyperkubedir/"
{{if .IsCoreOS}}
ExecStartPre=/bin/cp /tmp/hyperkubedir/hyperkube /opt/kubelet
ExecStartPre=/bin/mv /tmp/hyperkubedir/hyperkube /opt/kubectl
ExecStart=/bin/chmod a+x /opt/kubelet /opt/kubectl
{{else}}
ExecStartPre=/bin/cp /tmp/hyperkubedir/hyperkube /usr/local/bin/kubelet
ExecStartPre=/bin/mv /tmp/hyperkubedir/hyperkube /usr/local/bin/kubectl
ExecStart=/bin/chmod a+x /usr/local/bin/kubelet /usr/local/bin/kubectl
{{end}}

[Install]
WantedBy=multi-user.target

- path: "/etc/default/kubelet"
permissions: "0644"
owner: "root"
Expand Down
25 changes: 21 additions & 4 deletions parts/k8s/kubernetescustomscript.sh
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,22 @@ function ensureKubelet() {
}

function extractHyperkube(){
retrycmd_if_failure 100 1 60 docker pull $HYPERKUBE_URL || $ERR_K8S_DOWNLOAD_TIMEOUT
systemctlEnableAndStart hyperkube-extract
TMP_DIR=$(mktemp -d)
retrycmd_if_failure 100 1 30 curl -sSL -o /usr/local/bin/img "https://github.com/genuinetools/img/releases/download/v0.3.1/img-linux-amd64"
chmod +x /usr/local/bin/img
retrycmd_if_failure 100 1 60 img pull $HYPERKUBE_URL || $ERR_K8S_DOWNLOAD_TIMEOUT
path=$(find /tmp/img -name "hyperkube")

if [[ $OS == $COREOS_OS_NAME ]]; then
cp "$path" "/opt/kubelet"
cp "$path" "/opt/kubectl"
chmod a+x /opt/kubelet /opt/kubectl
else
cp "$path" "/usr/local/bin/kubelet"
cp "$path" "/usr/local/bin/kubectl"
chmod a+x /usr/local/bin/kubelet /usr/local/bin/kubectl
fi
rm -rf /tmp/hyperkube.tar "/tmp/img"
}

function ensureJournal(){
Expand Down Expand Up @@ -456,10 +470,13 @@ else
echo "skipping master node provision operations, this is an agent node"
fi

installDocker
if [[ "$CONTAINER_RUNTIME" == "docker" ]]; then
installDocker
ensureDocker
fi

runAptDaily
configureK8s
ensureDocker
configNetworkPlugin

if [[ ! -z "${MASTER_NODE}" ]]; then
Expand Down
34 changes: 0 additions & 34 deletions parts/k8s/kubernetesmastercustomdata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,40 +133,6 @@ MASTER_MANIFESTS_CONFIG_PLACEHOLDER

MASTER_ADDONS_CONFIG_PLACEHOLDER

- path: "/etc/systemd/system/hyperkube-extract.service"
permissions: "0644"
owner: "root"
content: |
[Unit]
Description=kubectl and kubelet extraction
Requires=docker.service
After=docker.service
{{if .MasterProfile.IsCoreOS}}
ConditionPathExists=!/opt/kubectl
{{else}}
ConditionPathExists=!/usr/local/bin/kubectl
{{end}}

[Service]
TimeoutStartSec=0
Restart=on-failure
RestartSec=5s
ExecStartPre=/bin/mkdir -p /tmp/hyperkubedir
ExecStartPre=/usr/bin/docker pull {{WrapAsVariable "kubernetesHyperkubeSpec"}}
ExecStartPre=/usr/bin/docker run --rm -v /tmp/hyperkubedir:/opt/hyperkubedir {{WrapAsVariable "kubernetesHyperkubeSpec"}} /bin/bash -c "cp /hyperkube /opt/hyperkubedir/"
{{if .MasterProfile.IsCoreOS}}
ExecStartPre=/bin/cp /tmp/hyperkubedir/hyperkube /opt/kubelet
ExecStartPre=/bin/mv /tmp/hyperkubedir/hyperkube /opt/kubectl
ExecStart=/bin/chmod a+x /opt/kubelet /opt/kubectl
{{else}}
ExecStartPre=/bin/cp /tmp/hyperkubedir/hyperkube /usr/local/bin/kubelet
ExecStartPre=/bin/mv /tmp/hyperkubedir/hyperkube /usr/local/bin/kubectl
ExecStart=/bin/chmod a+x /usr/local/bin/kubelet /usr/local/bin/kubectl
{{end}}

[Install]
WantedBy=multi-user.target

- path: "/etc/default/kubelet"
permissions: "0644"
owner: "root"
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/runner/cli_provisioner.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ func (cli *CLIProvisioner) FetchProvisioningMetrics(path string, cfg *config.Con
agentFiles := []string{"/var/log/azure/cluster-provision.log", "/var/log/cloud-init.log",
"/var/log/cloud-init-output.log", "/var/log/syslog", "/var/log/azure/custom-script/handler.log",
"/opt/m", "/opt/azure/containers/kubelet.sh", "/opt/azure/containers/provision.sh",
"/opt/azure/provision-ps.log", "/var/log/azure/kubelet-status.log", "/var/log/azure/hyperkube-extract-status.log",
"/opt/azure/provision-ps.log", "/var/log/azure/kubelet-status.log",
"/var/log/azure/docker-status.log", "/var/log/azure/systemd-journald-status.log"}
masterFiles := agentFiles
masterFiles = append(masterFiles, "/opt/azure/containers/mountetcd.sh", "/opt/azure/containers/setup-etcd.sh", "/opt/azure/containers/setup-etcd.log")
Expand Down

0 comments on commit 1462676

Please sign in to comment.