From 5d6a5780f987c1e3e00223db5eb42f7efd65539c Mon Sep 17 00:00:00 2001 From: leonharetd <610288372@qq.com> Date: Wed, 22 Dec 2021 13:44:37 +0800 Subject: [PATCH] Replace kind installation Signed-off-by: leonharetd <610288372@qq.com> --- hack/README.md | 3 +++ hack/local-up-karmada.sh | 2 +- hack/util.sh | 24 +----------------------- 3 files changed, 5 insertions(+), 24 deletions(-) diff --git a/hack/README.md b/hack/README.md index 1653a5933..c4fa6ce9b 100644 --- a/hack/README.md +++ b/hack/README.md @@ -51,6 +51,9 @@ ensures development quality. please use it like this: `hack/undeploy-karmada.sh `, the same parameters as you input at the installing step. +- [`delete-cluster.sh`](delete-cluster.sh) This script delete a kube cluster by kind, + please use it like this: `hack/delete-cluster.sh.sh ` + ## For CI pipeline - [`local-up-karmada.sh`](local-up-karmada.sh) This script also used for testing. diff --git a/hack/local-up-karmada.sh b/hack/local-up-karmada.sh index b2379a12f..b700ec97f 100755 --- a/hack/local-up-karmada.sh +++ b/hack/local-up-karmada.sh @@ -65,7 +65,7 @@ if util::cmd_exist kind; then echo "passed" else echo "not pass" - util::install_kind $kind_version + util::install_tools "sigs.k8s.io/kind" $kind_version fi # get arch name and os name in bootstrap BS_ARCH=$(go env GOARCH) diff --git a/hack/util.sh b/hack/util.sh index 008031985..7fa38572a 100755 --- a/hack/util.sh +++ b/hack/util.sh @@ -25,7 +25,7 @@ MIN_Go_VERSION=go1.16.0 function util::install_tools() { local package="$1" local version="$2" - + echo "go install ${package}@${version}" GO111MODULE=on go install "${package}"@"${version}" GOPATH=$(go env GOPATH | awk -F ':' '{print $1}') export PATH=$PATH:$GOPATH/bin @@ -119,28 +119,6 @@ function util::install_kubectl { fi } -# util::install_kind will install the given version kind -function util::install_kind { - local kind_version=${1} - echo "Installing 'kind ${kind_version}' for you" - local os_name - os_name=$(go env GOOS) - local arch_name - arch_name=$(go env GOARCH) - curl --retry 5 -sSLo ./kind -w "%{http_code}" "https://kind.sigs.k8s.io/dl/${kind_version}/kind-${os_name:-linux}-${arch_name:-amd64}" | grep '200' > /dev/null - ret=$? - if [ ${ret} -eq 0 ]; then - chmod +x ./kind - mkdir -p ~/.local/bin/ - mv ./kind ~/.local/bin/kind - - export PATH=$PATH:~/.local/bin - else - echo "Failed to install kind, can not download the binary file at https://kind.sigs.k8s.io/dl/${kind_version}/kind-${os_name:-linux}-${arch_name:-amd64}" - exit 1 - fi -} - # util::create_signing_certkey creates a CA, args are sudo, dest-dir, ca-id, purpose function util::create_signing_certkey { local sudo=$1