From ace11ac289d9814052fc4adcabadd277c7ebf4c1 Mon Sep 17 00:00:00 2001 From: Akihiro Suda Date: Thu, 24 Oct 2024 22:26:23 +0900 Subject: [PATCH 1/3] plugin: fix compilation errors Signed-off-by: Akihiro Suda --- plugin/plugin.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugin/plugin.go b/plugin/plugin.go index c3a52ee..ebaf028 100644 --- a/plugin/plugin.go +++ b/plugin/plugin.go @@ -22,9 +22,11 @@ package fuseoverlayfs import ( "errors" + "github.com/containerd/containerd/v2/plugins" fuseoverlayfs "github.com/containerd/fuse-overlayfs-snapshotter" "github.com/containerd/platforms" "github.com/containerd/plugin" + "github.com/containerd/plugin/registry" ) // Config represents configuration for the fuse-overlayfs plugin. @@ -34,8 +36,8 @@ type Config struct { } func init() { - plugin.Register(&plugin.Registration{ - Type: plugin.SnapshotPlugin, + registry.Register(&plugin.Registration{ + Type: plugins.SnapshotPlugin, ID: "fuse-overlayfs", Config: &Config{}, InitFn: func(ic *plugin.InitContext) (interface{}, error) { @@ -46,7 +48,7 @@ func init() { return nil, errors.New("invalid fuse-overlayfs configuration") } - root := ic.Root + root := ic.Properties[plugins.PropertyRootDir] if config.RootPath != "" { root = config.RootPath } From 1a420aa0b14c66a89f259b5814b1f5d159c0240e Mon Sep 17 00:00:00 2001 From: Akihiro Suda Date: Thu, 24 Oct 2024 22:28:06 +0900 Subject: [PATCH 2/3] Dockerfile: test go build for all the packages Signed-off-by: Akihiro Suda --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 92076b5..69a4df5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,6 +24,7 @@ COPY . /go/src/github.com/containerd/fuse-overlayfs-snapshotter WORKDIR /go/src/github.com/containerd/fuse-overlayfs-snapshotter ENV CGO_ENABLED=0 ENV GO111MODULE=on +RUN go build ./... RUN mkdir /out && go test -c -o /out/containerd-fuse-overlayfs.test # from https://github.com/containers/fuse-overlayfs/blob/53c17dab78b43de1cd121bf9260b20b76371bbaf/Dockerfile.static.ubuntu From dca913c32aecd0fd4d9c6d62fc3bf75b4905ef8d Mon Sep 17 00:00:00 2001 From: Akihiro Suda Date: Thu, 24 Oct 2024 22:28:25 +0900 Subject: [PATCH 3/3] go.mod: module github.com/containerd/fuse-overlayfs-snapshotter/v2 Signed-off-by: Akihiro Suda --- Makefile | 4 ++-- README.md | 4 ++-- cmd/containerd-fuse-overlayfs-grpc/main.go | 4 ++-- go.mod | 2 +- plugin/plugin.go | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index d646e3d..b4d6919 100644 --- a/Makefile +++ b/Makefile @@ -31,8 +31,8 @@ VERSION ?= $(shell $(GIT) describe --match 'v[0-9]*' --dirty='.m' --always --tag VERSION_TRIMMED := $(VERSION:v%=%) REVISION ?= $(shell $(GIT) rev-parse HEAD)$(shell if ! $(GIT) diff --no-ext-diff --quiet --exit-code; then $(ECHO) .m; fi) -PKG_MAIN := github.com/containerd/fuse-overlayfs-snapshotter/cmd/$(TARGET_BIN) -PKG_VERSION := github.com/containerd/fuse-overlayfs-snapshotter/cmd/$(TARGET_BIN)/version +PKG_MAIN := github.com/containerd/fuse-overlayfs-snapshotter/v2/cmd/$(TARGET_BIN) +PKG_VERSION := github.com/containerd/fuse-overlayfs-snapshotter/v2/cmd/$(TARGET_BIN)/version export GO_BUILD=GO111MODULE=on CGO_ENABLED=0 $(GO) build -ldflags "-s -w -X $(PKG_VERSION).Version=$(VERSION) -X $(PKG_VERSION).Revision=$(REVISION)" diff --git a/README.md b/README.md index 15648af..2708607 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Choose 1 if you don't mind recompiling containerd, otherwise choose 2. ### Option 1: Embed `fuse-overlayfs` plugin into the containerd binary -Create `builtins_fuseoverlayfs_linux.go` under [`$GOPATH/src/github.com/containerd/containerd/cmd/containerd`](https://github.com/containerd/containerd/tree/master/cmd/containerd) +Create `builtins_fuseoverlayfs_linux.go` under [`$GOPATH/src/github.com/containerd/containerd/cmd/containerd/builtins`](https://github.com/containerd/containerd/tree/master/cmd/containerd/builtins) with the following content, and recompile the containerd binary: ```go @@ -45,7 +45,7 @@ with the following content, and recompile the containerd binary: package main -import _ "github.com/containerd/fuse-overlayfs-snapshotter/plugin" +import _ "github.com/containerd/fuse-overlayfs-snapshotter/v2/plugin" ``` No extra configuration is needed. diff --git a/cmd/containerd-fuse-overlayfs-grpc/main.go b/cmd/containerd-fuse-overlayfs-grpc/main.go index aee5dd3..35f674a 100644 --- a/cmd/containerd-fuse-overlayfs-grpc/main.go +++ b/cmd/containerd-fuse-overlayfs-grpc/main.go @@ -24,8 +24,8 @@ import ( snapshotsapi "github.com/containerd/containerd/api/services/snapshots/v1" "github.com/containerd/containerd/v2/contrib/snapshotservice" - fuseoverlayfs "github.com/containerd/fuse-overlayfs-snapshotter" - "github.com/containerd/fuse-overlayfs-snapshotter/cmd/containerd-fuse-overlayfs-grpc/version" + fuseoverlayfs "github.com/containerd/fuse-overlayfs-snapshotter/v2" + "github.com/containerd/fuse-overlayfs-snapshotter/v2/cmd/containerd-fuse-overlayfs-grpc/version" "github.com/containerd/log" sddaemon "github.com/coreos/go-systemd/v22/daemon" "google.golang.org/grpc" diff --git a/go.mod b/go.mod index 7df3454..d2cfe8c 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/containerd/fuse-overlayfs-snapshotter +module github.com/containerd/fuse-overlayfs-snapshotter/v2 go 1.22.0 diff --git a/plugin/plugin.go b/plugin/plugin.go index ebaf028..368f392 100644 --- a/plugin/plugin.go +++ b/plugin/plugin.go @@ -23,7 +23,7 @@ import ( "errors" "github.com/containerd/containerd/v2/plugins" - fuseoverlayfs "github.com/containerd/fuse-overlayfs-snapshotter" + fuseoverlayfs "github.com/containerd/fuse-overlayfs-snapshotter/v2" "github.com/containerd/platforms" "github.com/containerd/plugin" "github.com/containerd/plugin/registry"