-
Notifications
You must be signed in to change notification settings - Fork 131
Add fuse-manager #1892
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
Add fuse-manager #1892
Conversation
80cee15
to
e015180
Compare
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.
Thanks. Could you add Co-authored-by for @ilyee in the commit messages?
cmd/containerd-stargz-grpc/main.go
Outdated
fmAddr := config.FuseManagerAddress | ||
if fmAddr == "" { | ||
var err error | ||
fmAddr, err = exec.LookPath(fuseManagerAddress) |
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.
Please always expect an absolute path.
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.
done
cmd/go.mod
Outdated
github.com/opencontainers/go-digest v1.0.0 | ||
github.com/opencontainers/image-spec v1.1.0 | ||
github.com/opencontainers/runtime-spec v1.2.0 | ||
github.com/pelletier/go-toml v1.9.5 | ||
github.com/pkg/errors v0.9.1 |
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.
Please do not use this package because this has been archived
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.
done
Config *service.Config | ||
IPFS bool | ||
MetadataStore string | ||
DefaultImageServiceAddress string |
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.
Can you add JSON tags?
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.
done
@@ -0,0 +1,58 @@ | |||
/* |
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.
Can we have fusemanager
package in the repo root?
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.
Can we have
fusemanager
package in the repo root?
I have tried two approaches:
-
Placing the fusemanager in the repository root. However, since the fsopts package is located in the cmd directory, building directly leads to issues where fusemanager cannot find fsopts. This requires adding fsopts separately to the go.mod file, which would introduce a significant number of dependencies.
-
Keeping the service.go file that depends on fsopts, along with the fusemanager.go and fusestore.go files, in the cmd/stargz-fuse-manager directory, while only moving the client-side content to the repository root.
I was wondering if there might be a better solution
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.
Can we pass fsopts.ConfigFsOpts
to fusemanager as a callback function so that we can eliminate direct dependency from fusemanager to fsopts?
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.
done
service/service.go
Outdated
snOpts := []snbase.Opt{snbase.AsynchronousRemove} | ||
if config.SnapshotterConfig.AllowInvalidMountsOnRestart { | ||
snOpts = append(snOpts, snbase.AllowInvalidMountsOnRestart) | ||
func StartFuseManager(ctx context.Context, executable, address, fusestore, logLevel, logPath string) error { |
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.
Can we put this in fusemounter
package because this seem to be independent to service
package.
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.
done,just mv it to fusemanager/fusemanager.go
|
||
mt, err := getMetadataStore(rootDir, config) | ||
if err != nil { | ||
log.G(ctx).WithError(err).Fatalf("failed to configure metadata store") |
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.
Return an error.
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.
done
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.
Fatal
exits the process here. This line isn't needed and just do return nil, fmt.Errorf("failed to configure metadata store: %w", err)
The same applies to other places as well.
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.
done
func runFuseManager(ctx context.Context) error { | ||
lvl, err := logrus.ParseLevel(logLevel) | ||
if err != nil { | ||
log.L.WithError(err).Fatal("failed to prepare logger") |
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.
Return an error.
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.
done
|
||
credsFuncs, err := keychainconfig.ConfigKeychain(ctx, fm.server, &keyChainConfig) | ||
if err != nil { | ||
log.G(ctx).WithError(err).Fatalf("failed to configure keychain") |
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.
Return an error (also the same for other places in this file)
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.
done
service/service.go
Outdated
@@ -66,6 +69,27 @@ func WithFilesystemOptions(opts ...stargzfs.Option) Option { | |||
|
|||
// NewStargzSnapshotterService returns stargz snapshotter. | |||
func NewStargzSnapshotterService(ctx context.Context, root string, config *Config, opts ...Option) (snapshots.Snapshotter, error) { | |||
fs, err := NewFileSystem(ctx, root, config, opts...) | |||
if err != nil { | |||
log.G(ctx).WithError(err).Fatalf("failed to configure filesystem") |
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.
Return an error (also the same for other places in this file)
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.
done
done, I have squash these commit and add Co-authored-by for @ilyee |
ffc8b65
to
58a325c
Compare
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 need to enable fusemanager in the tests in our CI (can be following up though)
fusemanager/service.go
Outdated
return nil | ||
} | ||
|
||
func (fm *Server) clearMounts(ctx context.Context) error { |
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.
Stargz snapshotter (snapshot/snapshot.go) already has the similar cleanup logic. Can we just rely on it or why we need this in fusemanager? It needs documents about how to restart fusemanager (e.g. for upgrading).
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.
done
- clearMounts is unnecessary and has been deleted.
- add
Upgrading Fuse Manager
to overview.md
fusemanager/fusemanager.go
Outdated
func runFuseManager(ctx context.Context) error { | ||
lvl, err := logrus.ParseLevel(logLevel) | ||
if err != nil { | ||
log.L.WithError(err).Fatal("failed to prepare logger") |
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.
Same as #1892 (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.
done
service/service.go
Outdated
|
||
snapshotter, err = snbase.NewSnapshotter(ctx, snapshotterRoot(root), fs, snOpts...) | ||
if err != nil { | ||
log.G(ctx).WithError(err).Fatalf("failed to create new snapshotter") |
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.
Same as #1892 (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.
done
service/service.go
Outdated
@@ -66,6 +67,29 @@ func WithFilesystemOptions(opts ...stargzfs.Option) Option { | |||
|
|||
// NewStargzSnapshotterService returns stargz snapshotter. | |||
func NewStargzSnapshotterService(ctx context.Context, root string, config *Config, opts ...Option) (snapshots.Snapshotter, error) { | |||
fs, err := NewFileSystem(ctx, root, config, opts...) | |||
if err != nil { | |||
log.G(ctx).WithError(err).Fatalf("failed to configure filesystem") |
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.
Same as #1892 (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.
done
48731b5
to
29532df
Compare
Signed-off-by: abushwang <[email protected]> Co-authored-by: Zuti He <[email protected]>
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.
Thanks
Thanks to @ilyee, the author of PR #324 for his permission, this work can be resumed.
In light of the project's evolution over the past two years, the following adjustments have been made compared to the original content: