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

Update cimfs snapshotter & differ for new hcsshim interface #10033

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ambarve
Copy link
Contributor

@ambarve ambarve commented Apr 4, 2024

hcsshim recently updated the interface of APIs that are used for importing OCI layers. Plus it now expects that the CimFS snapshotter mounts contain the full cim paths for parent layers. This change updates the cimfs differ & snapshotter to use that new interface.

@k8s-ci-robot
Copy link

Hi @ambarve. Thanks for your PR.

I'm waiting for a containerd member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@@ -1 +1 @@
v0.12.0
1d406d0eac5573287ba7b46a04a58275410137ac
Copy link
Member

Choose a reason for hiding this comment

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

Is it possible to get a release with the changes? 2.0 doesn't seem too far off so it'd be nice to stay on a tag

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, I wasn't planning to get this in containerd 2.0 since the rc builds are already out. That's why we didn't get a release on hcsshim. Do we still need a tag if we don't want to get this in 2.0?

Copy link
Member

Choose a reason for hiding this comment

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

Maybe I've forgotten the release process but I'd think if this got checked in anytime before we decide to tag 2.0 then it'd be part of the release

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, it does look like merging this right now will get it into 2.0. I have confirmed that getting this into 2.0 shouldn't be a problem.

Copy link
Member

Choose a reason for hiding this comment

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

Gotcha.

I have confirmed that getting this into 2.0 shouldn't be a problem.

You mean the commit instead of a tag?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't need to get this into 2.0, we can merge this after the final 2.0 tag is cut. At that time, we can merge with a commit ID of hcsshim and then when containerd is preparing for a 2.1 release we can make a separate hcsshim tag at that time and vendor that. Does that sound okay?

Copy link
Member

Choose a reason for hiding this comment

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

Sounds fine to me at least, I'm not sure if any other maintainers would prefer us stay on a tag.

Copy link
Member

Choose a reason for hiding this comment

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

I agree it would be best to keep a tagged release here.

@dcantah
Copy link
Member

dcantah commented Apr 18, 2024

Needs a rebase

core/mount/mount_windows.go Outdated Show resolved Hide resolved
go.mod Outdated
@@ -7,7 +7,7 @@ require (
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24
github.com/AdamKorcz/go-118-fuzz-build v0.0.0-20230306123547-8075edf89bb0
github.com/Microsoft/go-winio v0.6.2
github.com/Microsoft/hcsshim v0.12.3
github.com/Microsoft/hcsshim v0.12.1-0.20240326215926-1d406d0eac55
Copy link
Member

Choose a reason for hiding this comment

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

I think we'd prefer to vendor a tagged release.

core/mount/mount_windows.go Outdated Show resolved Hide resolved
core/mount/mount_windows.go Outdated Show resolved Hide resolved
@@ -130,6 +141,40 @@ func (m *Mount) GetParentPaths() ([]string, error) {
return parentLayerPaths, nil
}

// gets the paths of the parent cims of this mount
func (m *Mount) GetParentCimPaths() ([]string, error) {
Copy link
Member

Choose a reason for hiding this comment

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

I would prefer these functions be defined in the cimfs snapshotter package, and take a Mount as input, rather than being attached to the type. We probably don't want Mount to end up with functions hanging off of it for specific mount types, it should stay generic.

}
return false, err
func (s *cimFSSnapshotter) parentIDsToCimPaths(parentIDs []string) []string {
cimPaths := []string{}
Copy link
Member

@kevpar kevpar May 14, 2024

Choose a reason for hiding this comment

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

nit: make([]string, 0, len(parentIDs))

} else if ok {
cimUsage, err := cimfs.GetCimUsage(ctx, getCimLayerPath(s.cimDir, id))
if info.Kind == snapshots.KindCommitted {
// Committed MUST be a cimfs layer
Copy link
Member

Choose a reason for hiding this comment

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

I think we are saying not just that committed -> cimfs, but also cimfs -> committed, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, here the comment just suggests that a committed snapshot means we should add the usage of cim files too.

}
// if this is an image layer being extracted include a cim path in which the layer
// will be extracted.
if strings.Contains(key, snapshots.UnpackKeyPrefix) {
Copy link
Member

Choose a reason for hiding this comment

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

It would be nice to avoid keying more stuff off of UnpackKeyPrefix. Is there any way we can avoid this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have updated this to use the snapshot digest label that is passed with each Prepare call during image extraction. I think it is slightly better than checking for the key prefix. Let me know what you think.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, there are two other places (Commit & Mounts) where we still need to use the UnpackKeyPrefix. I am trying to figure out if we can easily change it there too. But if not, would you be okay with making this change in a separate PR?

hcsshim recently [updated](microsoft/hcsshim@1d406d0)
the interface of APIs that are used for importing OCI layers. Plus, it now expects that the CimFS snapshotter mounts contain the full cim paths for parent layers. This change updates the cimfs differ & snapshotter to use that new interface.

Signed-off-by: Amit Barve <ambarve@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants