Skip to content

Commit

Permalink
get namespace var back
Browse files Browse the repository at this point in the history
  • Loading branch information
roman-kiselenko committed Dec 4, 2023
1 parent 2f2eb40 commit 847bbcf
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions pkg/build/nodeimage/imageimporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ import (
"sigs.k8s.io/kind/pkg/exec"
)

var commonNS = "k8s.io"

type containerdImporter struct {
containerCmder exec.Cmder
}
Expand All @@ -50,25 +48,25 @@ func (c *containerdImporter) End() error {

func (c *containerdImporter) Pull(image, platform string) error {
return c.containerCmder.Command(
"ctr", "--namespace="+commonNS, "content", "fetch", "--platform="+platform, image,
"ctr", "--namespace=k8s.io", "content", "fetch", "--platform="+platform, image,
).SetStdout(io.Discard).SetStderr(io.Discard).Run()
}

// kubelet can determine what images to skip while doing image garbage collection
// by checking the pinned attribute of the images through CRI
func (c *containerdImporter) Pin(image, platform string) error {
return c.containerCmder.Command(
"ctr", "--namespace="+commonNS, "images", "label", image, "--platform="+platform, "io.cri-containerd.pinned=pinned",
"ctr", "--namespace=k8s.io", "images", "label", image, "--platform="+platform, "io.cri-containerd.pinned=pinned",
).SetStdout(io.Discard).SetStderr(io.Discard).Run()
}

func (c *containerdImporter) LoadCommand() exec.Cmd {
return c.containerCmder.Command(
// TODO: ideally we do not need this in the future. we have fixed at least one image
"ctr", "--namespace="+commonNS, "images", "import", "--all-platforms", "--no-unpack", "--digests", "-",
"ctr", "--namespace=k8s.io", "images", "import", "--all-platforms", "--no-unpack", "--digests", "-",
)
}

func (c *containerdImporter) ListImported() ([]string, error) {
return exec.OutputLines(c.containerCmder.Command("ctr", "--namespace="+commonNS, "images", "list", "-q"))
return exec.OutputLines(c.containerCmder.Command("ctr", "--namespace=k8s.io", "images", "list", "-q"))
}

0 comments on commit 847bbcf

Please sign in to comment.