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

ko py: copy all referenced images to a target location #11

Closed
jonjohnsonjr opened this issue Feb 20, 2019 · 1 comment
Closed

ko py: copy all referenced images to a target location #11

jonjohnsonjr opened this issue Feb 20, 2019 · 1 comment

Comments

@jonjohnsonjr
Copy link
Collaborator

This would be a similar tool to ko resolve, but simply passes image references through instead of building import paths.

what?

ko resolve

Takes yaml that contains import paths and produces yaml that contains images in your KO_DOCKER_REPO, i.e.:

ko resolve :: Yaml<[]ImportPath> -> Yaml<[]KoDockerRepo<Image>>

ko py

Takes yaml that contains images in an arbitrary repo and produces yaml that contains images in your KO_DOCKER_REPO, i.e.:

ko py :: Yaml<[]Image> -> Yaml<[]KoDockerRepo<Image>>

why?

Imagine you have a bunch of YAML that you'd like to deploy to your cluster. These YAMLs reference images on dockerhub, but your cluster isn't allowed to talk to the internet, so you need to copy all these images into your internal registry. Similarly, you might want all these images in your internal registry for performance reasons (speed of light is finite, the network is unreliable).

This tool solves that problem for you. To copy all referenced images from dockerhub to your private registry, and produce the new YAML:

$ ko py -f public-release-on-dockerhub.yaml > internal-release-on-my-private-registry.yaml

This would also compose well with kubectl to just directly apply it:

$ ko py -f public-release.yaml | kubectl apply -f -

Or even compose with ko resolve if your YAML references both import paths and external images, you can do both in one pass:

$ ko resolve -f config/ | ko py -f - | kubectl apply -f -

how?

I have a draft PR that's just a PoC: google/go-containerregistry#378

Basically, we supply a different builder and publisher to ko resolve.

The builder identifies any image references in IsSupportedReference (via name.StrictParsing and checking that there's an image on the other side) and just pulls them in Build.

We should be able to reuse the default publisher.

@jonjohnsonjr jonjohnsonjr transferred this issue from google/go-containerregistry Mar 21, 2019
@jonjohnsonjr
Copy link
Collaborator Author

We probably don't want this to be part of ko so I'll just link to https://github.com/pivotal/image-relocation and close this.

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

No branches or pull requests

1 participant