-
Notifications
You must be signed in to change notification settings - Fork 1
Add tar index mode to erofs snapshotter #1
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,9 +18,9 @@ package plugin | |
|
|
||
| import ( | ||
| "fmt" | ||
| "os/exec" | ||
|
|
||
| "github.com/containerd/containerd/v2/core/metadata" | ||
| "github.com/containerd/containerd/v2/internal/erofsutils" | ||
| "github.com/containerd/containerd/v2/plugins" | ||
| "github.com/containerd/containerd/v2/plugins/diff/erofs" | ||
| "github.com/containerd/platforms" | ||
|
|
@@ -32,6 +32,10 @@ import ( | |
| type Config struct { | ||
| // MkfsOptions are extra options used for the applier | ||
| MkfsOptions []string `toml:"mkfs_options"` | ||
|
|
||
| // EnableTarIndex enables the tar index mode where the index is generated | ||
| // for tar content without extracting the tar | ||
| EnableTarIndex bool `toml:"enable_tar_index"` | ||
| } | ||
|
|
||
| func init() { | ||
|
|
@@ -43,9 +47,12 @@ func init() { | |
| }, | ||
| Config: &Config{}, | ||
| InitFn: func(ic *plugin.InitContext) (interface{}, error) { | ||
| _, err := exec.LookPath("mkfs.erofs") | ||
| tarModeSupported, err := erofsutils.SupportGenerateFromTar() | ||
| if err != nil { | ||
| return nil, fmt.Errorf("could not find mkfs.erofs: %v: %w", err, plugin.ErrSkipPlugin) | ||
| return nil, fmt.Errorf("failed to check mkfs.erofs availability: %v: %w", err, plugin.ErrSkipPlugin) | ||
| } | ||
| if !tarModeSupported { | ||
| return nil, fmt.Errorf("mkfs.erofs does not support tar mode (--tar option), disabling erofs differ: %w", plugin.ErrSkipPlugin) | ||
| } | ||
|
|
||
| md, err := ic.GetSingle(plugins.MetadataPlugin) | ||
|
|
@@ -57,7 +64,17 @@ func init() { | |
| cs := md.(*metadata.DB).ContentStore() | ||
| config := ic.Config.(*Config) | ||
|
|
||
| return erofs.NewErofsDiffer(cs, config.MkfsOptions), nil | ||
| var opts []erofs.DifferOpt | ||
|
|
||
| if len(config.MkfsOptions) > 0 { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What config is this? Containerd toml config? I think passing the deterministic parameters through this would feel pretty unwieldy. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's used for erofs extra mount options, because many users have their requirement for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for tardev use cases, I think just config the containerd toml as below: Another reason I tend to leave We could document the recommanded config in the containerd erofs snapshotter doc. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The mid term plan is to introduce |
||
| opts = append(opts, erofs.WithMkfsOptions(config.MkfsOptions)) | ||
| } | ||
|
|
||
| if config.EnableTarIndex { | ||
| opts = append(opts, erofs.WithTarIndexMode()) | ||
| } | ||
|
|
||
| return erofs.NewErofsDiffer(cs, opts...), nil | ||
| }, | ||
| }) | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.