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

feature: implement RemoveImage and ImageStatus methods for cri manager #496

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions daemon/mgr/cri.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,18 @@ func (c *CriManager) ListImages(ctx context.Context, r *runtime.ListImagesReques

// ImageStatus returns the status of the image, returns nil if the image isn't present.
Copy link
Collaborator

Choose a reason for hiding this comment

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

What does the status of image mean? The existence of the image, or the ImageInfo as meta data of image?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ImageStatus will return the Basic information about a container image includes "ID" and "Size" and extra information about the image if needed. Also, if the image isn't present,it will return nil.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated 4.Describe how to verify it

Copy link
Collaborator

Choose a reason for hiding this comment

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

It is some kind of weird to use status, Maybe info is better. Not blocking this pr.

func (c *CriManager) ImageStatus(ctx context.Context, r *runtime.ImageStatusRequest) (*runtime.ImageStatusResponse, error) {
return nil, fmt.Errorf("ImageStatus Not Implemented Yet")
imageRef := r.GetImage().GetImage()
imageInfo, err := c.ImageMgr.GetImage(ctx, imageRef)
if err != nil {
return nil, err
}

image, err := imageToCriImage(imageInfo)
if err != nil {
return nil, err
}

return &runtime.ImageStatusResponse{Image: image}, nil
}

// PullImage pulls an image with authentication config.
Expand All @@ -317,7 +328,18 @@ func (c *CriManager) PullImage(ctx context.Context, r *runtime.PullImageRequest)

// RemoveImage removes the image.
func (c *CriManager) RemoveImage(ctx context.Context, r *runtime.RemoveImageRequest) (*runtime.RemoveImageResponse, error) {
return nil, fmt.Errorf("RemoveImage Not Implemented Yet")
imageRef := r.GetImage().GetImage()
imageInfo, err := c.ImageMgr.GetImage(ctx, imageRef)
if err != nil {
return nil, err
}

err = c.ImageMgr.RemoveImage(ctx, imageInfo, &ImageRemoveOption{})
if err != nil {
return nil, err
}

return &runtime.RemoveImageResponse{}, nil
}

// ImageFsInfo returns information of the filesystem that is used to store images.
Expand Down