Skip to content

Conversation

@dcantah
Copy link
Member

@dcantah dcantah commented Oct 11, 2023

This was spurred by seeing:

"Failed to get the info of the filesystem with mountpoint"
err="no such file or directory" mountpoint="/path/to/io.containerd.snapshotter.v1.native"

in the kubelets logs. This is due to the imageFSPath for the CRI plugin assuming all of the snapshotters are located under the default location that gets passed on plugin initialization. Several of the snapshotters offer the ability to set different root paths and override this however, and afaict for remote snapshotters it's entirely up to them so this location can be wrong in some cases.

This change exports the root path for the remaining built-in snapshotters that allow you to change their location, and then uses the introspection API to grab the path.

Now ImageFSInfo on my host returns:

containerd sudo crictl -t 20s imagefsinfo
{
  "status": {
    "timestamp": "1697024624876142000",
    "fsId": {
      "mountpoint": "/Users/dcantah/containerd/blockfile"
    },
    "usedBytes": {
      "value": "0"
    },
    "inodesUsed": {
      "value": "0"
    }
  }
}

@k8s-ci-robot
Copy link

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@ktock
Copy link
Member

ktock commented Oct 11, 2023

This might be related to #9214 (comment)

@dcantah
Copy link
Member Author

dcantah commented Oct 11, 2023

Yep! Thanks for pointing me to that thread. We've been seeing this for quite a bit now apparently but finally looked into it, I think it's definitely more pronounced for remote sn's but all of the built in linux snapshotters allow you to point wherever you want also.

Edit: As Derek mentioned in that issue there's more to be done for the CRI call there, especially if we want to take into account the experimental multi snapshotter support, but this is a good start I think.

@dcantah dcantah marked this pull request as ready for review October 11, 2023 11:48
@dmcgowan
Copy link
Member

I wonder if this type of static metadata is better suited for the introspection API rather than a dedicated endpoint. If the data is stateful or dynamic, then such a call probably makes more sense. We do need to figure out a better way for out of process plugins to set their plugin metadata though, it might just have to be done through the proxy plugin config for now.

@dcantah
Copy link
Member Author

dcantah commented Oct 11, 2023

I wonder if this type of static metadata is better suited for the introspection API rather than a dedicated endpoint.

Not a bad idea from looking, I honestly have never used it 😆

@dcantah
Copy link
Member Author

dcantah commented Oct 12, 2023

Swapping to an introspection approach

@fuweid
Copy link
Member

fuweid commented Oct 12, 2023

I think the metadata in plugin is good enough to get the information.

ic.Meta.Exports["root"] = root

@dcantah dcantah changed the title Snapshots: Add RootPath method/rpc CRI: "Fix" imageFSPath behavior Oct 12, 2023
@dcantah dcantah force-pushed the sn-rootpath branch 2 times, most recently from 2882e98 to b9f7f44 Compare October 12, 2023 07:02
// Note that if containerd changes directory layout, we also needs to change this.
func imageFSPath(rootDir, snapshotter string) string {
return filepath.Join(rootDir, plugin.SnapshotPlugin.String()+"."+snapshotter)
func imageFSPath(rootDir, snapshotter string, client *containerd.Client) string {
Copy link
Member

Choose a reason for hiding this comment

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

Would you be able to write a unit test for this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Possibly.. I'm not sure how I'd effectively use this in a unit test scenario though as it requires the daemon. Let me see if we have any CRI tests that write out a different config to use, I think that'd make the most sense

@fuweid
Copy link
Member

fuweid commented Oct 13, 2023

Need a rebase here~

Rethinking about this and it should be backported into supported release.

@fuweid fuweid added cherry-pick/1.6.x cherry-pick/1.7.x Change to be cherry picked to release/1.7 branch labels Oct 13, 2023
@dcantah
Copy link
Member Author

dcantah commented Oct 13, 2023

I still need to write a test for this, trying to find a spare hour 😅

@dmcgowan
Copy link
Member

Approach looks good, you have a few changes to rebase on top of.

We should consider defining the export keys in plugins/types.go.

@dcantah
Copy link
Member Author

dcantah commented Oct 17, 2023

@dmcgowan Will do

Some of the snapshotters that allow you to change their root location
were already doing this, this just makes all of them follow the same
pattern.

Signed-off-by: Danny Canter <danny@dcantah.dev>
Currently it didn't take into account that certain snapshots can explicitly
have their root directories placed at a different location. This changes
it to use the RootPath method of the snapshotter if it implements it.

Signed-off-by: Danny Canter <danny@dcantah.dev>
@dcantah
Copy link
Member Author

dcantah commented Oct 17, 2023

Still trying to find time to write a decent test here, sorry for the delay :(.

@dmcgowan
Copy link
Member

An indecent test seems fine as well.

I wonder if use of the introspection service there makes it trickier. The snapshots are already marked as dependencies, you could just populate the snapshotter->root map quickly with a GetByType call during init and pass that along.

@fuweid
Copy link
Member

fuweid commented Oct 18, 2023

@dcantah sorry I just merged one related pull request. It needs you to rebase it. Thanks

@k8s-ci-robot
Copy link

PR needs rebase.

Details

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.

@dims dims added the area/cri Container Runtime Interface (CRI) label Feb 7, 2024
@Kern--
Copy link
Contributor

Kern-- commented Apr 9, 2024

I think we’re seeing the same issue: awslabs/soci-snapshotter#1093

I don’t see anything here for out-of-process snapshotters that go through the proxy. Am I just missing something?

@dcantah
Copy link
Member Author

dcantah commented Apr 10, 2024

@Kern-- Trying to page this back in, but as far as I remember Derek added support to be able to specify exports for proxy plugins, so I'd assume if your proxy plugin defined the "root" export and set it then this change would probably work.

I'll try and rebase this shortly, but I remember not being able to find a decent spot to add a test given it needs a containerd config change to effectively test. If anyone has ideas, or @Kern-- if you'd wanna work on it I can give you access to this branch after rebasing so we can try and land sooner

@Kern--
Copy link
Contributor

Kern-- commented Apr 10, 2024

Looking at this a bit deeper, it looks like this was fixed as part of the CRI restructuring in #9152.

Maybe this PR should be rebased on top of release/1.7?

@dcantah
Copy link
Member Author

dcantah commented Apr 10, 2024

Oh that's sweet, if so I'll look to add to 1.7 instead. I likely won't have time this week however. @dmcgowan given you did the cri restructuring, does this change look needed in main anymore?

@Kern--
Copy link
Contributor

Kern-- commented Apr 11, 2024

I think the first commit to make sure all the snapshotters add their root path to the introspection service is still useful in main.

@dcantah I'm happy to open new PRs with the cherry-picks/rebases if you'd like. I just don't want to step on your toes :)

@dcantah
Copy link
Member Author

dcantah commented Apr 11, 2024

If I don't get to it by Friday please feel free 😭. I'd rather this land now that it's affecting a service, I'd found this just digging through logs last year but it wasn't really impacting anything

@dcantah
Copy link
Member Author

dcantah commented Apr 14, 2024

Closing this, and moving the first commit of this to #10073. @Kern-- Feel free to plop this in 1.7 if it's needed!

@austinvazquez
Copy link
Member

Cleaning up the labels here and marking this as "cherry-picked". As documented above, this fix was applied for containerd 1.6/1.7 branches; however, the issue was inadvertently fixed in mainline at the time (containerd 2.0+) through CRI restructuring so was not merged here.

@austinvazquez austinvazquez added cherry-picked/1.6.x PR commits are cherry-picked into release/1.6 branch cherry-picked/1.7.x PR commits are cherry-picked into release/1.7 branch and removed cherry-pick/1.6.x cherry-pick/1.7.x Change to be cherry picked to release/1.7 branch labels May 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/cri Container Runtime Interface (CRI) cherry-picked/1.6.x PR commits are cherry-picked into release/1.6 branch cherry-picked/1.7.x PR commits are cherry-picked into release/1.7 branch needs-rebase

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants