Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kind install and setup #1

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions ci/kind/kind-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,15 @@ function destroy {
delete_networks
}

function kind_install {
if [[ $(uname) == 'Darwin' || $(uname) == 'Linux' ]]; then
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.11.1/kind-$(uname)-amd64
chmod +x ./kind
sudo mv kind /usr/bin
exit 0
fi
}

while [[ $# -gt 0 ]]
do
key="$1"
Expand All @@ -324,6 +333,10 @@ while [[ $# -gt 0 ]]
modify "$2"
exit 0
;;
kind-install)
kind_install
exit 0
;;
--pod-cidr)
POD_CIDR="$2"
shift 2
Expand Down
9 changes: 8 additions & 1 deletion multicluster/controllers/multicluster/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package multicluster

import (
"context"
"os/exec"
"path/filepath"
"testing"
"time"
Expand Down Expand Up @@ -86,7 +87,13 @@ func TestAPIs(t *testing.T) {

var _ = BeforeSuite(func() {
logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true)))

out, _ := exec.Command("which", "kind").Output()
if len(string(out)) == 0 {
err := exec.Command("sudo", "../../../ci/kind/kind-setup.sh", "kind-install").Run()
Expect(err).NotTo(HaveOccurred())
}
err := exec.Command("sudo", "../../../ci/kind/kind-setup.sh", "create", "kind").Run()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you shouldn't create kind inside suite_test.go, my intention is to use a shell script to start the kind setup and test. you may take a look at how kind-setup.sh being used in upstream.

Expect(err).NotTo(HaveOccurred())
By("bootstrapping test environment")
//TODO: KUBECONFIG should be set up by command line.
// kubeConfigPath := "/Users/luolan/.kube/local-kind-config"
Expand Down