Skip to content
Merged
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
2 changes: 1 addition & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ go_repository(
go_repository(
name = "io_k8s_sigs_kind",
importpath = "sigs.k8s.io/kind",
tag = "0.1.0",
tag = "0.2.1",
)

go_repository(
Expand Down
24 changes: 5 additions & 19 deletions test/e2e/util/kind/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ var (
managerImageTar = flag.String("managerImageTar", "", "a script to load the manager Docker image into Docker")
)

const kindContainerName = "kind-1-control-plane"

// Cluster represents the running state of a KIND cluster.
// An empty struct is enough to call Setup() on.
type Cluster struct {
Expand All @@ -73,28 +71,16 @@ func (c *Cluster) Setup() {
fmt.Fprintf(ginkgo.GinkgoWriter, "export KUBECONFIG=%s\n", c.kubepath)

if *managerImageTar != "" {
c.loadImage()
fmt.Fprintf(
ginkgo.GinkgoWriter,
"loading image %q into Kind node\n",
*managerImageTar)
c.run(exec.Command(*kindBinary, "load", "image-archive", *managerImageTar))
}

c.applyYAML()
}

func (c *Cluster) loadImage() {
// TODO(EKF): once kind supports loading images directly, remove this hack
fmt.Fprintf(
ginkgo.GinkgoWriter,
"loading image %q into nested docker instance\n",
*managerImageTar)
file, err := os.Open(*managerImageTar)
gomega.Expect(err).To(gomega.BeNil())

// Pipe the tar file into the kind container then docker-load it
cmd := exec.Command("docker", "exec", "--interactive", kindContainerName, "docker", "load")
cmd.Stdin = file
cmd.Stdout = ginkgo.GinkgoWriter
c.run(cmd)
}

// Teardown attempts to delete the KIND cluster
func (c *Cluster) Teardown() {
c.run(exec.Command(*kindBinary, "delete", "cluster"))
Expand Down