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

env_kind.go: load image into kind cluster #73

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

leonnicolas
Copy link

@leonnicolas leonnicolas commented Nov 16, 2024

This commit load the image into the kind cluster with

kind load docker-image <image-name>

We need to do this if the image is not in a public registry.
It also stops using docker manifest inspect.
Instead we should rather check if the image is present locally.
If so we can load it into the cluster, otherwise we have to pull it first.

Signed-off-by: leonnicolas [email protected]

This commit load the image into the kind cluster with
```
kind load docker-image <image-name>
```
We need to do this if the image is not in a public registry.
Honestly, the purpose of the `preLoadImage()` function is not clear to me.

Signed-off-by: leonnicolas <[email protected]>
env_kind.go Outdated
Comment on lines 769 to 771
if _, err = r.env.execContext(ctx, "docker", "image", "inspect", r.opts.Image).CombinedOutput(); err == nil {
return nil
return r.loadImageIntoKindCluster(ctx)
}
Copy link
Author

@leonnicolas leonnicolas Nov 18, 2024

Choose a reason for hiding this comment

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

Actually this won't work for a public image that is not present on the machine, yet.

I feel like we should remove the if block. The comment in line 774/773 suggests that we should pull the image if we get an "No such image" error, but pulling an image that does no have a manifest will never work.

So rather we should either
a. check if the image is present locally and if not try to pull it and finally (always) load it into docker
b. check if image is present locally. If yes do nothing more. If no check if it is present locally and load it into kind or fail.

Copy link
Author

Choose a reason for hiding this comment

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

done

Pull only the image if it isn't present on the machine and always load
it into the cluster.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant