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 pkg/skaffold/kubernetes/loader/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func (i *ImageLoader) loadImages(ctx context.Context, out io.Writer, artifacts [
}

func findKnownImages(ctx context.Context, cli *kubectl.CLI) ([]string, error) {
nodeGetOut, err := cli.RunOut(ctx, "get", "nodes", `-ojsonpath='{@.items[*].status.images[*].names[*]}'`)
nodeGetOut, err := cli.RunOut(ctx, "get", "nodes", `-ojsonpath={@.items[*].status.images[*].names[*]}`)
if err != nil {
return nil, fmt.Errorf("unable to inspect the nodes: %w", err)
}
Expand Down
20 changes: 10 additions & 10 deletions pkg/skaffold/kubernetes/loader/load_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,29 +46,29 @@ func TestLoadImagesInKindNodes(t *testing.T) {
cluster: "kind",
deployed: []graph.Artifact{{Tag: "tag1"}},
commands: testutil.
CmdRunOut("kubectl --context kubecontext --namespace namespace get nodes -ojsonpath='{@.items[*].status.images[*].names[*]}'", "").
CmdRunOut("kubectl --context kubecontext --namespace namespace get nodes -ojsonpath={@.items[*].status.images[*].names[*]}", "").
AndRunOut("kind load docker-image --name kind tag1", "output: image loaded"),
},
{
description: "load missing image",
cluster: "other-kind",
deployed: []graph.Artifact{{Tag: "tag1"}, {Tag: "tag2"}},
commands: testutil.
CmdRunOut("kubectl --context kubecontext --namespace namespace get nodes -ojsonpath='{@.items[*].status.images[*].names[*]}'", "docker.io/library/tag1").
CmdRunOut("kubectl --context kubecontext --namespace namespace get nodes -ojsonpath={@.items[*].status.images[*].names[*]}", "docker.io/library/tag1").
AndRunOut("kind load docker-image --name other-kind tag2", "output: image loaded"),
},
{
description: "no new images",
cluster: "kind",
deployed: []graph.Artifact{{Tag: "tag0"}, {Tag: "docker.io/library/tag1"}, {Tag: "docker.io/tag2"}, {Tag: "gcr.io/test/tag3"}, {Tag: "someregistry.com/tag4"}},
commands: testutil.
CmdRunOut("kubectl --context kubecontext --namespace namespace get nodes -ojsonpath='{@.items[*].status.images[*].names[*]}'", "docker.io/library/tag0 docker.io/library/tag1 docker.io/library/tag2 gcr.io/test/tag3 someregistry.com/tag4"),
CmdRunOut("kubectl --context kubecontext --namespace namespace get nodes -ojsonpath={@.items[*].status.images[*].names[*]}", "docker.io/library/tag0 docker.io/library/tag1 docker.io/library/tag2 gcr.io/test/tag3 someregistry.com/tag4"),
},
{
description: "inspect error",
deployed: []graph.Artifact{{Tag: "tag"}},
commands: testutil.
CmdRunOutErr("kubectl --context kubecontext --namespace namespace get nodes -ojsonpath='{@.items[*].status.images[*].names[*]}'", "", errors.New("BUG")),
CmdRunOutErr("kubectl --context kubecontext --namespace namespace get nodes -ojsonpath={@.items[*].status.images[*].names[*]}", "", errors.New("BUG")),
shouldErr: true,
expectedError: "unable to inspect",
},
Expand All @@ -77,7 +77,7 @@ func TestLoadImagesInKindNodes(t *testing.T) {
cluster: "kind",
deployed: []graph.Artifact{{Tag: "tag"}},
commands: testutil.
CmdRunOut("kubectl --context kubecontext --namespace namespace get nodes -ojsonpath='{@.items[*].status.images[*].names[*]}'", "").
CmdRunOut("kubectl --context kubecontext --namespace namespace get nodes -ojsonpath={@.items[*].status.images[*].names[*]}", "").
AndRunOutErr("kind load docker-image --name kind tag", "output: error!", errors.New("BUG")),
shouldErr: true,
expectedError: "output: error!",
Expand All @@ -100,29 +100,29 @@ func TestLoadImagesInK3dNodes(t *testing.T) {
cluster: "k3d",
deployed: []graph.Artifact{{Tag: "tag1"}},
commands: testutil.
CmdRunOut("kubectl --context kubecontext --namespace namespace get nodes -ojsonpath='{@.items[*].status.images[*].names[*]}'", "").
CmdRunOut("kubectl --context kubecontext --namespace namespace get nodes -ojsonpath={@.items[*].status.images[*].names[*]}", "").
AndRunOut("k3d image import --cluster k3d tag1", "output: image loaded"),
},
{
description: "load missing image",
cluster: "other-k3d",
deployed: []graph.Artifact{{Tag: "tag1"}, {Tag: "tag2"}},
commands: testutil.
CmdRunOut("kubectl --context kubecontext --namespace namespace get nodes -ojsonpath='{@.items[*].status.images[*].names[*]}'", "docker.io/library/tag1").
CmdRunOut("kubectl --context kubecontext --namespace namespace get nodes -ojsonpath={@.items[*].status.images[*].names[*]}", "docker.io/library/tag1").
AndRunOut("k3d image import --cluster other-k3d tag2", "output: image loaded"),
},
{
description: "no new images",
cluster: "k3d",
deployed: []graph.Artifact{{Tag: "tag0"}, {Tag: "docker.io/library/tag1"}, {Tag: "docker.io/tag2"}, {Tag: "gcr.io/test/tag3"}, {Tag: "someregistry.com/tag4"}},
commands: testutil.
CmdRunOut("kubectl --context kubecontext --namespace namespace get nodes -ojsonpath='{@.items[*].status.images[*].names[*]}'", "docker.io/library/tag0 docker.io/library/tag1 docker.io/library/tag2 gcr.io/test/tag3 someregistry.com/tag4"),
CmdRunOut("kubectl --context kubecontext --namespace namespace get nodes -ojsonpath={@.items[*].status.images[*].names[*]}", "docker.io/library/tag0 docker.io/library/tag1 docker.io/library/tag2 gcr.io/test/tag3 someregistry.com/tag4"),
},
{
description: "inspect error",
deployed: []graph.Artifact{{Tag: "tag"}},
commands: testutil.
CmdRunOutErr("kubectl --context kubecontext --namespace namespace get nodes -ojsonpath='{@.items[*].status.images[*].names[*]}'", "", errors.New("BUG")),
CmdRunOutErr("kubectl --context kubecontext --namespace namespace get nodes -ojsonpath={@.items[*].status.images[*].names[*]}", "", errors.New("BUG")),
shouldErr: true,
expectedError: "unable to inspect",
},
Expand All @@ -131,7 +131,7 @@ func TestLoadImagesInK3dNodes(t *testing.T) {
cluster: "k3d",
deployed: []graph.Artifact{{Tag: "tag"}},
commands: testutil.
CmdRunOut("kubectl --context kubecontext --namespace namespace get nodes -ojsonpath='{@.items[*].status.images[*].names[*]}'", "").
CmdRunOut("kubectl --context kubecontext --namespace namespace get nodes -ojsonpath={@.items[*].status.images[*].names[*]}", "").
AndRunOutErr("k3d image import --cluster k3d tag", "output: error!", errors.New("BUG")),
shouldErr: true,
expectedError: "output: error!",
Expand Down