-
Notifications
You must be signed in to change notification settings - Fork 102
refactor: image api to create one img that includes list of tags/references #958 #882 #959
Conversation
b5cf37c
to
2a6467e
Compare
@jsilverio22 Reviewing this now, can you take a look at resolving the merge conflicts? |
8b14f68
to
fe3f063
Compare
should be all up to date now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some initial comments that I wanted to get out. Will do some more reviewing later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work!
2bbfecb
to
b522e13
Compare
@jsilverio22 I want to define some behavior/usecases around deleting and untagging images here. Generally, it should follow the behavior of When more than one tag existsGiven this list of images:
note: image-b:latest can be the result of either
When exactly one tag existsGiven this list of images:
When the image is "in use" by an appAs described in slack, we may also want to start considering whether there are any apps consuming an image. If we were mimicking
Waiting to hear back from darren on what he'd want to do in those cases. I don't think you should focus on this part yet. I see this "when the image is 'in use' stuff as not critical to the refactor and could be done in a follow up |
5f7ef3f
to
30fbf02
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another round of review. Nothing blocking from my end still, just some food for thought.
Next Steps:
|
e88ad42
to
a823a6b
Compare
acorn images -c outputIf i specify an image (either via tag or digets) as part of the Given:
Actual:
Expected:
Additionally, If i specify a digest like |
Tag stopped working since last iteration
|
funkiness on kubectl output:
shouldn't have if theres tags. |
integration/client/client.go
Outdated
@@ -30,5 +31,9 @@ func NewImage(t *testing.T, namespace string) string { | |||
if err != nil { | |||
t.Fatal(err) | |||
} | |||
_, err = helper.BuilderClient(t, namespace).ImageCreate(context.Background(), image.ID, "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when we sync with darren's changes, i dont know if this will stay her permanently or not.
integration/dev/dev_test.go
Outdated
@@ -59,6 +59,11 @@ func TestDev(t *testing.T) { | |||
|
|||
eg := errgroup.Group{} | |||
eg.Go(func() error { | |||
_, err = helper.BuilderClient(t, ns.Name).ImageCreate(ctx, "test-app", "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again, not sure if we will do this permanently. you should keep all these ImageCreate adds in their own single commit that we can nuke later if we need to
Looking good @jsilverio22. You can squash this down now. I think this is as done as it's going to get until we can sync up with Darren's changes. |
92cc11d
to
dbff8ab
Compare
…rences acorn-io#958 Signed-off-by: Joshua Silverio <joshua@acorn.io>
3fd824f
to
606815d
Compare
Signed-off-by: Joshua Silverio <joshua@acorn.io>
364b8a8
to
e23f70e
Compare
Signed-off-by: Joshua Silverio <joshua@acorn.io>
d0b68c7
to
2b028f1
Compare
pkg/server/registry/images/tag.go
Outdated
return image, err | ||
} | ||
} | ||
err = t.client.List(ctx, imageList) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be limited to the request namespace so that we are only checking for duplicates in the context of one namespace. You can have tag foo in two different namespaces, that is allowed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be limited now
image := obj.(*apiv1.Image) | ||
duplicateTag := make(map[string]bool) | ||
|
||
for _, tag := range image.Tags { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On update we should still validate that the new tag list is unique. Is that check still enforced?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added it back & changed the order in which the image/tags runs. It will now update all duplicate tags and then either create the new image or update the existing one w/ the tags
@@ -171,7 +168,7 @@ type ImageTag struct { | |||
metav1.TypeMeta `json:",inline"` | |||
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` | |||
|
|||
TagName string `json:"tagName,omitempty"` | |||
Image *Image `json:"image,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Image *Image `json:"image,omitempty"` | |
Tags []string `json:"tags,omitempty"` |
The other fields of image, namely Digest don't seem to have any use, lets just have the one field Tags
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed to Image *Image with image/tags now having to call the create so now the requestImage can be created if it does not exist
func (t *TagStrategy) ImageTag(ctx context.Context, namespace, imageName string, requestImage *apiv1.Image) (*apiv1.Image, error) {
image := &apiv1.Image{}
imageList := &apiv1.ImageList{}
err := t.client.Get(ctx, router.Key(namespace, imageName), image)
if apierror.IsNotFound(err) {
err = t.client.Create(ctx, requestImage)
if err != nil {
return image, err
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a side effect of the fact i've rewritten things. We don't want the user to be able to create new Image objects, but right now you have to create images from the client. So I guess just leave it as is and I'll refactor it in my PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay 👍
pkg/cli/images.go
Outdated
Name string `json:"name,omitempty"` | ||
Digest string `json:"digest,omitempty"` | ||
Repository string `json:"repository,omitempty"` | ||
Tag string `json:"tags,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tag string `json:"tags,omitempty"` | |
Tag string `json:"tag,omitempty"` |
Signed-off-by: Joshua Silverio <joshua@acorn.io>
Signed-off-by: Joshua Silverio <joshua@acorn.io>
Signed-off-by: Joshua Silverio <joshua@acorn.io>
Signed-off-by: Joshua Silverio <joshua@acorn.io>
…rences acorn-io#958 acorn-io#882 (acorn-io#959) refactor: image api to create one img that includes list of tags/references acorn-io#958 Signed-off-by: Joshua Silverio <joshua@acorn.io>
#958 #882
Signed-off-by: Joshua Silverio joshua@acorn.io