imgpkg icon indicating copy to clipboard operation
imgpkg copied to clipboard

Add annotations/labels to bundle

Open pbarker opened this issue 4 years ago • 8 comments

Describe the problem/challenge you have OCI images would be a great place to store machine learning models. ImgPkg works as expected with storing a generic model file, however there are times in which you may want to select between different model versions based on metadata such as the training score or dataset used.

Describe the solution you'd like I would like to add basic metadata to bundles to help select them. Looking for similar functionality to https://docs.docker.com/engine/reference/builder/#label or https://github.com/opencontainers/image-spec/blob/master/annotations.md. Would be nice to also have a way to search or filter them when looking through the repository.


Vote on this request

This is an invitation to the community to vote on issues, to help us prioritize our backlog. Use the "smiley face" up to the right of this comment to vote.

👍 "I would like to see this addressed as soon as possible" 👎 "There are other more important things to focus on right now"

We are also happy to receive and review Pull Requests if you want to help working on this issue.

pbarker avatar May 26 '21 17:05 pbarker

Hey @pbarker I was looking at this issue and was trying to understand the ask here. From what I am reading I see 2:

  1. Have the ability to add annotations to an image using imgpkg
  2. Have the ability to, given a repository, filter the images present in that repository

Is this accurate?

Trying to think I would work for your use case. imgpkg has the ability to bundle a group of OCI Images together, is this something that would be interesting for you, or you'll do not need something like that?

I am asking because if you bundle OCI Images using imgpkg we already have an epic to implement something like a filter, see #116 for more detail. In your case this would look something like this:

  1. Create a bundle with model 1
  2. Create a bundle with model 2
  3. Create a "big bundle" that contains the 2 above bundles and when you generate the Images Lock file you can add annotations to each bundle.
  4. When trying to retrieve the model you want, you could just use the filtering capabilities from the above issue and just get the one you are interested in.

We also have another issue that #124 that talks about having the ability to describe what is part of a particular bundle.

Do you think that these issues could solve the problem you are trying to address?

joaopapereira avatar Jun 01 '21 14:06 joaopapereira

There's an outstanding question of how well this approach would fit the original request.

@pbarker, thoughts on the matter?

pivotaljohn avatar Jun 23 '21 16:06 pivotaljohn

Hey, sorry somehow missed your response @joaopapereira. Adding them to a big bundle may not work for this use case because I would be pushing bundles often, and I believe that would require me to repush the big bundle each time.

Ideally I would just be able to add annotations to a bundle, then query the registry namespace for them, or at least just have a way of listing the artifacts present in the repo with their annotations. I think that may depend on https://github.com/opencontainers/artifacts/pull/29 though

pbarker avatar Jun 23 '21 16:06 pbarker

Hi @pbarker, One of the interesting use cases for Artifact referenceTypes is the ability to push additional annotations. The artifact-manifest removes the constraint on having required layers and required config object and formalizes blobs are not required to be ordinal. This is a decision of the specific artifact author, as outlined in OCI Artifacts. This enables pushing new annotations, that extends an existing artifact in a registry without having to push a dev/null config object, or faking layers

As for adoption, we have to start somewhere. If we say we can't use something until it's adopted, doesn't adoption have to start for this "clock to start ticking"?

SteveLasker avatar Jul 14 '21 18:07 SteveLasker

Thanks @SteveLasker I like the annotations design! The one thing I was thinking I needed from opencontainers/artifacts#29 was the ability to query for annotations, or at least list them all from the registry. Unless I'm missing a way of doing that now.

pbarker avatar Jul 20 '21 17:07 pbarker

Having an option to add labels/annotations to an image besides the default 'dev.carvel.imgpkg.bundle' label during pushing would be nice.

Use-case is publishing imgpkg packages to Github Container registry from a monorepo. The image/package name is not the repository name in this case and Github can't connect the image/package to the repository automatically. Adding the pre-defined org.opencontainers.image.source annotation (Github docs) tells Github how to link the image/package to a repository.

sboschman avatar Jan 14 '22 13:01 sboschman

@pbarker now I am embarrassed, sorry for not following up, but a lot happened last year.

Ideally I would just be able to add annotations to a bundle

Do you mean at the moment you first push the bundle to the registry?

@sboschman that is definitely an interesting use case. This label can only be applied to the Bundle itself and not the Images that are part of it, because adding labels to images does change the SHA.

joaopapereira avatar Jan 18 '22 21:01 joaopapereira

Added a fix here https://github.com/vmware-tanzu/carvel-imgpkg/pull/412

old-ocean-creature avatar Jul 09 '22 19:07 old-ocean-creature

One other use case for this is artifact tracing. Being able to look at a pkg/pkgi resource deployed in a cluster and trace that back to a bundle in an OCI registry, then being able to look at annotation on the image and seeing metadata like git repo, branch, commit SHA, PR#, etc. to trace that back to a specific PR in a specific repo. That would be great.

phenixblue avatar Jun 21 '23 17:06 phenixblue

Can this please be added, it's one of the first things I tried to do with imgpkg to link the package registry to the source repo use label of org.opencontainers.image.source. GitHub even shows you this when there is a package registry that is not linked to a repository:

Screenshot 2023-06-21 at 1 52 20 PM

djschny avatar Jun 21 '23 17:06 djschny