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

Use canonical image names when adding to the cache #11126

Closed
afbjorklund opened this issue Apr 18, 2021 · 0 comments · Fixed by #11168
Closed

Use canonical image names when adding to the cache #11126

afbjorklund opened this issue Apr 18, 2021 · 0 comments · Fixed by #11168
Labels
co/runtime/crio CRIO related issues kind/feature Categorizes issue or PR as related to a new feature. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete.

Comments

@afbjorklund
Copy link
Collaborator

afbjorklund commented Apr 18, 2021

Currently, we save the images as archives using only a short name such as "busybox".

[
  {
    "Config": "sha256:388056c9a6838deea3792e8f00705b35b439cf57b3c9c2634fb4e95cfc896de6",
    "RepoTags": [
      "busybox"
    ],
    "Layers": [
      "f531cdc67389c92deac44e019e7a1b6fba90d1aaa58ae3e8192f0e0eed747152.tar.gz"
    ]
  }
]

We should make sure to use the canonical name, e.g. "docker.io/library/busybox:latest"

[
  {
    "Config": "sha256:388056c9a6838deea3792e8f00705b35b439cf57b3c9c2634fb4e95cfc896de6",
    "RepoTags": [
      "docker.io/library/busybox:latest"
    ],
    "Layers": [
      "f531cdc67389c92deac44e019e7a1b6fba90d1aaa58ae3e8192f0e0eed747152.tar.gz"
    ]
  }
]

The go-container-registry library can do this (Name), only have to work around index.docker.io

var (
	legacyDefaultDomain = "index.docker.io"
	defaultDomain       = "docker.io"
	officialRepoName    = "library"
	defaultTag          = "latest"
)
       // Rewrite "docker.io" to "index.docker.io".
        // See: https://github.com/google/go-containerregistry/issues/68
        if name == defaultRegistryAlias {
                name = DefaultRegistry
        }

Having the canonical name means that we can load them into container runtimes such as cri-o.

The library calls this "strict validation", as opposed to "weak validation" (without registry and tag)


Eventually it also opens up for having a different default registry.

/ WithDefaultRegistry sets the default registry that will be used if one is not
// provided.
func WithDefaultRegistry(r string) Option

But in the short term, it fixes some shortcomings with the cache: #8554

See also https://www.redhat.com/sysadmin/container-image-short-names

We can use the same short name as argument and as a cache filename.

@afbjorklund afbjorklund added co/runtime/crio CRIO related issues kind/feature Categorizes issue or PR as related to a new feature. labels Apr 18, 2021
@spowelljr spowelljr added the priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. label Apr 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
co/runtime/crio CRIO related issues kind/feature Categorizes issue or PR as related to a new feature. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants