Skip to content

Commit

Permalink
Merge pull request #366 from pixiake/release-1.0
Browse files Browse the repository at this point in the history
update download script
  • Loading branch information
pixiake authored Nov 8, 2020
2 parents 43bc578 + efbc8ce commit 3b104f8
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 12 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ KubeKey can install Kubernetes and KubeSphere together. The dependency that need

## Usage

### Get the Installer Excutable File
### Get the Installer Executable File

* Binary downloads of the KubeKey can be found on the [Releases page](https://github.com/kubesphere/kubekey/releases).
Unpack the binary and you are good to go!
Expand All @@ -93,7 +93,7 @@ KubeKey can install Kubernetes and KubeSphere together. The dependency that need
> Note:
>
> * Docker needs to be installed before building.
> * If you have problem to access `https://proxy.golang.org/`, excute `build.sh -p` instead.
> * If you have problem to access `https://proxy.golang.org`, execute `build.sh -p` instead.

### Create a Cluster

Expand All @@ -105,6 +105,7 @@ Quick Start is for `all-in-one` installation which is a good start to get famili

##### Command

> If you have problem to access `https://storage.googleapis.com`, execute first `export KKZONE=cn`.
```shell script
./kk create cluster [--with-kubernetes version] [--with-kubesphere version]
```
Expand Down Expand Up @@ -133,6 +134,8 @@ Quick Start is for `all-in-one` installation which is a good start to get famili

You have more control to customize parameters or create a multi-node cluster using the advanced installation. Specifically, create a cluster by specifying a configuration file.

> If you have problem to access `https://storage.googleapis.com`, execute first `export KKZONE=cn`.

1. First, create an example configuration file

```shell script
Expand Down
3 changes: 3 additions & 0 deletions README_zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ KubeKey 可以同时安装 Kubernetes 和 KubeSphere。根据 KubeSphere 所安
> 注意: 由于 Kubernetes 暂不支持大写 NodeName, hostname 中包含大写字母将导致后续安装过程无法正常结束

##### 命令
> 如果无法访问 `https://storage.googleapis.com`, 请先执行 `export KKZONE=cn`.

```shell script
./kk create cluster [--with-kubernetes version] [--with-kubesphere version]
Expand Down Expand Up @@ -135,6 +136,8 @@ KubeKey 可以同时安装 Kubernetes 和 KubeSphere。根据 KubeSphere 所安

您可以使用高级安装来控制自定义参数或创建多节点群集。具体来说,通过指定配置文件来创建集群。

> 如果无法访问 `https://storage.googleapis.com`, 请先执行 `export KKZONE=cn`.

1. 首先,创建一个示例配置文件

```shell script
Expand Down
8 changes: 4 additions & 4 deletions pkg/cluster/preinstall/preinstall.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ func FilesDownloadHttp(mgr *manager.Manager, filepath, version, arch string) err
helm.GetCmd = fmt.Sprintf("curl -o %s/helm-%s-linux-%s.tar.gz %s && cd %s && tar -zxf helm-%s-linux-%s.tar.gz && mv linux-%s/helm . && rm -rf *linux-%s*", filepath, helm.Version, helm.Arch, helm.Url, filepath, helm.Version, helm.Arch, helm.Arch, helm.Arch)
}

kubeadm.GetCmd = fmt.Sprintf("curl -o %s %s", kubeadm.Path, kubeadm.Url)
kubelet.GetCmd = fmt.Sprintf("curl -o %s %s", kubelet.Path, kubelet.Url)
kubectl.GetCmd = fmt.Sprintf("curl -o %s %s", kubectl.Path, kubectl.Url)
kubeadm.GetCmd = fmt.Sprintf("curl -L -o %s %s", kubeadm.Path, kubeadm.Url)
kubelet.GetCmd = fmt.Sprintf("curl -L -o %s %s", kubelet.Path, kubelet.Url)
kubectl.GetCmd = fmt.Sprintf("curl -L -o %s %s", kubectl.Path, kubectl.Url)
kubecni.GetCmd = fmt.Sprintf("curl -L -o %s %s", kubecni.Path, kubecni.Url)

binaries := []files.KubeBinary{kubeadm, kubelet, kubectl, helm, kubecni}
Expand All @@ -72,7 +72,7 @@ func FilesDownloadHttp(mgr *manager.Manager, filepath, version, arch string) err
for i := 5; i > 0; i-- {
if output, err := exec.Command("/bin/sh", "-c", binary.GetCmd).CombinedOutput(); err != nil {
fmt.Println(string(output))
return errors.Wrap(err, fmt.Sprintf("Failed to download %s binary", binary.Name))
return errors.New(fmt.Sprintf("Failed to download %s binary: %s", binary.Name, binary.GetCmd))
}

if err := SHA256Check(binary, version); err != nil {
Expand Down
17 changes: 11 additions & 6 deletions scripts/downloadKubekey.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,27 @@ fi

DOWNLOAD_URL="https://github.com/kubesphere/kubekey/releases/download/${KUBEKEY_VERSION}/kubekey-${KUBEKEY_VERSION}-${OSTYPE}-${ARCH}.tar.gz"
if [ "x${KKZONE}" = "xcn" ]; then
export KKZONE=cn
DOWNLOAD_URL="https://kubernetes.pek3b.qingstor.com/kubekey/releases/download/${KUBEKEY_VERSION}/kubekey-${KUBEKEY_VERSION}-${OSTYPE}-${ARCH}.tar.gz"
fi

echo "\nDownloading kubekey ${KUBEKEY_VERSION} from ${DOWNLOAD_URL} ...\n"
echo ""
echo "Downloading kubekey ${KUBEKEY_VERSION} from ${DOWNLOAD_URL} ..."
echo ""

curl -fsLO "$DOWNLOAD_URL"
if [ $? -ne 0 ]; then
echo "\n\n"
echo "Failed to download Kubekey ${KUBEKEY_VERSION} !\n"
echo "Please verify the version you are trying to download.\n\n"
echo ""
echo "Failed to download Kubekey ${KUBEKEY_VERSION} !"
echo ""
echo "Please verify the version you are trying to download."
echo ""
exit
fi

filename="kubekey-${KUBEKEY_VERSION}-${OSTYPE}-${ARCH}.tar.gz"
tar -xzf "${filename}"
# rm "${filename}"

echo "\nKubekey ${KUBEKEY_VERSION} Download Complete!\n"
echo ""
echo "Kubekey ${KUBEKEY_VERSION} Download Complete!"
echo ""

0 comments on commit 3b104f8

Please sign in to comment.