-
Notifications
You must be signed in to change notification settings - Fork 0
Make the snapshotter configurable #40
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
Conversation
bea880d to
3e3c4bf
Compare
3e3c4bf to
8ed407d
Compare
cmd/dockerd/config.go
Outdated
|
|
||
| flags.StringVar(&conf.ContainerdNamespace, "containerd-namespace", conf.ContainerdNamespace, "Containerd namespace to use") | ||
| flags.StringVar(&conf.ContainerdPluginNamespace, "containerd-plugins-namespace", conf.ContainerdPluginNamespace, "Containerd namespace to use for plugins") | ||
| flags.StringVar(&conf.ContainerdSnapshotter, "containerd-snapshotter", conf.ContainerdSnapshotter, "Containerd snapshotter to use") |
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.
Wondering if this should take the place of --storage-driver and/or --storage-opt;
moby/cmd/dockerd/config_unix.go
Line 39 in 2279803
| flags.StringVarP(&conf.GraphDriver, "storage-driver", "s", "", "Storage driver to use") |
Line 38 in 2279803
| flags.Var(opts.NewNamedListOptsRef("storage-opts", &conf.GraphOptions, nil), "storage-opt", "Storage driver options") |
As effectively, they're mutually exclusive (either us containerd-snapshotter, or graph drivers). Default snapshotter could be an option for that 🤔
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.
"s/take the place/if we could use/"
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.
What feels weird is that snapshotters are not storage drivers, I'm not sure why the GraphDriver flag is storage-driver, I would prefer having a flag for containerd rather than using the existing. This would also make it clearer in the future that graph drivers don't exist any more since the daemon won't start (I guess?) if you give it a flag it doesn't know
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'm not sure why the GraphDriver flag is storage-driver,
Right, so originally they were called "graph-driver", which was quite specific to the implementation, so later on it was renamed to storage-driver (which is more descriptive for the purpose). However, when the "visible" terminology was renamed, the internal types and packages weren't; there were some PRs to do so (moby#9758, moby#22228 -> moby#23237), but abandoned, and I guess nobody picked it up again to finish 😞.
What feels weird is that snapshotters are not storage drivers
Not sure; overall, they seem quite the equivalent, with the difference being that "storage drivers" had the problem that the concept of "layers" leaked into them; "snapshotters" made that more generic, and changed it into a more generic concept of "snapshots" (which could be implemented using layers, but also through other ways).
From a user-perspective, I'm inclined to see them as "same purpose", only the snapshotters may be "multi-arch" aware (and other features, but that also applies to storage-drivers; some come with additional features that can be used).
I can bring this up in the maintainers meeting to see what others think
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.
We discussed this in the maintainers meeting;
- concensus was that the preference is to re-use the
--storage-driverflag, as the term is generic enough, and was originally chosen for that reason (apparently there had been some internal discussion at that time to get rid of the "layers" concept, and early implementations of "snapshotter-like approaches" were already being designed) - for now, we would switch between "containerd snapshotters" and "storage drivers" based on the
featureflag that was added (but snapshotter would of course at some point become the default) - if that feature is enabled, we must have some mapping for backward compatibility on (already familiar) names that have an equivalent in containerd, so;
overlay->io.containerd.snapshotter.v1.overlayfsoverlay2->io.containerd.snapshotter.v1.overlayfs(same)zfs->io.containerd.snapshotter.v1.zfs- etc.
- besides the "shorthand" (
overlay2) names, also accept the "fully qualified" names (e.g.io.containerd.snapshotter.v1.overlayfscan be used in the daemon config) - if no explicit snapshotter is defined in the daemon config we can use containerd's default
- but, we should consider having a better automatic selection (similar to how we currently select the most suitable snapshotter) instead of containerd's (currently hardcoded) default; this could be by querying (if possible) the list of available snapshotter-plugins that were loaded, and pick the first available one (based on a priority list).
- perhaps this could use a contribution to containerd, to make containerd itself also make a similar selection (TBD)
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.
./cc @tonistiigi @cpuguy83 @tianon @neersighted (pls check if I captured the discussion correctly or if I forgot something)
4eaca06 to
d15224e
Compare
4edbac0 to
53c9291
Compare
|
Still a bit flaky, this one; |
rumpl
left a comment
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.
Approved :D
daemon/containerd/snapshotters.go
Outdated
| graphDriver = strings.TrimPrefix(graphDriver, "io.containerd.snapshotter.v1.") | ||
| return graphDriver |
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.
Silly question; does containerd always expect the snapshotter name without the prefix? I was somewhat expecting it to use the "fully qualified" name, but indeed see that containerd.DefaultSnapshotter is just "overlayfs".
Mostly wondering if it would expect a fully-qualified name for non-built-in snapshotters (e.g.)
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.
Yes, it only works with shortname. I tested the stargz snapshotter with the FQN and it fails:
snapshotter not loaded: io.containerd.snapshotter.v1.stargz: invalid argument
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.
Giving this some thought; if containerd itself doesn't accept the fully-qualified name (io.containerd.snapshotter.v1.<foo>), perhaps we should not either (at least for now); we can consider contributing this in upstream, and if that's accepted implement it on our side as well.
That said; if we DO want to support it, perhaps we should use containerd's const for this; https://github.com/containerd/containerd/blob/902212651b12e4d81b7bc779632b2e4da0a8e673/plugin/plugin.go#L65-L66
graphDriver = strings.TrimPrefix(graphDriver, plugin.SnapshotPlugin+".")
daemon/containerd/snapshotters.go
Outdated
| if graphDriver == "" { | ||
| graphDriver = containerd.DefaultSnapshotter | ||
| } |
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.
As we were discussing; we should (for a follow-up) look at;
- detecting what snapshotter to use as default (which may depend on the underlying filesystem (zfs, btrfs))
- check if we should be storing the default in the containerd namespaces and/or check what default was set in the namespace and take that as default if no custom default was set.
- see if we can present the list of available snapshotters (although I'm not sure if we currently present that list in
docker infoor elsewhere 🤔)
53c9291 to
f076116
Compare
f076116 to
b6770ed
Compare
daemon/containerd/snapshotters.go
Outdated
| graphDriver = strings.TrimPrefix(graphDriver, "io.containerd.snapshotter.v1.") | ||
| return graphDriver |
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.
Giving this some thought; if containerd itself doesn't accept the fully-qualified name (io.containerd.snapshotter.v1.<foo>), perhaps we should not either (at least for now); we can consider contributing this in upstream, and if that's accepted implement it on our side as well.
That said; if we DO want to support it, perhaps we should use containerd's const for this; https://github.com/containerd/containerd/blob/902212651b12e4d81b7bc779632b2e4da0a8e673/plugin/plugin.go#L65-L66
graphDriver = strings.TrimPrefix(graphDriver, plugin.SnapshotPlugin+".")b6770ed to
f060068
Compare
Signed-off-by: Djordje Lukic <[email protected]>
Also moved some layerStore related initialization to the non-c8d case because otherwise they get treated as a graphdriver plugins. Co-authored-by: Sebastiaan van Stijn <[email protected]> Signed-off-by: Paweł Gronowski <[email protected]> Signed-off-by: Sebastiaan van Stijn <[email protected]>
f060068 to
e645f73
Compare
|
Squashed suggestions from #48 |
thaJeztah
left a comment
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.
LGTM, thanks!
|
CI is happy; let's get this one in 👍 |
This was added as part of rumpl#40, but wasn't used. Signed-off-by: Sebastiaan van Stijn <[email protected]>
This was added as part of rumpl#40, but wasn't used. Signed-off-by: Sebastiaan van Stijn <[email protected]>
This was added as part of rumpl#40, but wasn't used. Signed-off-by: Sebastiaan van Stijn <[email protected]>
No description provided.