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

Commit

Permalink
remove docker dependency from hyperkube extract
Browse files Browse the repository at this point in the history
Signed-off-by: Jess Frazelle <acidburn@microsoft.com>
  • Loading branch information
jessfraz committed Jun 18, 2018
1 parent c4b1324 commit a2f518b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 71 deletions.
34 changes: 0 additions & 34 deletions parts/k8s/kubernetesagentcustomdata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,40 +90,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
18 changes: 16 additions & 2 deletions parts/k8s/kubernetescustomscript.sh
Original file line number Diff line number Diff line change
Expand Up @@ -364,8 +364,22 @@ function ensureKubelet() {
}

function extractHyperkube(){
retrycmd_if_failure 100 1 60 docker pull $HYPERKUBE_URL || exit $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.4.6/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
34 changes: 0 additions & 34 deletions parts/k8s/kubernetesmastercustomdata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -144,40 +144,6 @@ MASTER_ADDONS_CONFIG_PLACEHOLDER

MASTER_CUSTOM_FILES_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 @@ -245,7 +245,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 a2f518b

Please sign in to comment.