Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,14 @@ ifneq ($(STATIC),)
endif
GO_LD_FLAGS+='

.PHONY: all build clean
# helper tools
TOOLSDIR := $(shell pwd)/hack/tools
NERDCTL := $(TOOLSDIR)/bin/nerdctl
NERDCTL_VERSION := 2.0.0
CONTAINERD := $(TOOLSDIR)/bin/containerd
CONTAINERD_VERSION := 2.0.0

.PHONY: all build clean tools

all: build

Expand All @@ -39,3 +46,20 @@ atomfs-snapshotter-grpc:

clean:
rm -rf $(OUTDIR)

# tools
tools: $(NERDCTL) $(CONTAINERD)

$(NERDCTL):
mkdir -p $(TOOLSDIR)/bin
curl -Lo nerdctl.tar.gz https://github.com/containerd/nerdctl/releases/download/v$(NERDCTL_VERSION)/nerdctl-$(NERDCTL_VERSION)-$(OS)-$(ARCH).tar.gz
tar xvzf nerdctl.tar.gz -C $(TOOLSDIR)/bin nerdctl
rm nerdctl.tar.gz

$(CONTAINERD):
mkdir -p $(TOOLSDIR)/bin
curl -Lo containerd.tar.gz https://github.com/containerd/containerd/releases/download/v$(CONTAINERD_VERSION)/containerd-$(CONTAINERD_VERSION)-$(OS)-$(ARCH).tar.gz
tar xvzf containerd.tar.gz -C $(TOOLSDIR)/bin --strip-components=1 bin/containerd
tar xvzf containerd.tar.gz -C $(TOOLSDIR)/bin --strip-components=1 bin/ctr
rm containerd.tar.gz

10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,13 @@ address = "/run/atomfs-snapshotter-grpc/atomfs-snapshotter-grpc.sock"
# tells containerd to use atomfs by default.
snapshotter = "atomfs"
```

## Run/test snapshotter

```
bin/atomfs-snapshotter-grpc /run/atomfs-snapshotter-grpc/atomfs-snapshotter-grpc.sock /tmp/atomfs/

sudo containerd -c tests/containerd.toml

hack/tools/bin/nerdctl --snapshotter atomfs run public.ecr.aws/docker/library/busybox:stable
```
8 changes: 6 additions & 2 deletions cmd/atomfs-snapshotter-grpc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

snapshotsapi "github.com/containerd/containerd/api/services/snapshots/v1"
"github.com/containerd/containerd/v2/contrib/snapshotservice"
"github.com/containerd/containerd/v2/plugins/snapshots/native"
"machinerun.io/atomfs-snapshotter/snapshot"
)

func main() {
Expand All @@ -28,7 +28,7 @@ func main() {
// snapshotter and a root directory. Your custom snapshotter will be
// much more useful than using a snapshotter which is already included.
// https://godoc.org/github.com/containerd/containerd/snapshots#Snapshotter
sn, err := native.NewSnapshotter(os.Args[2])
sn, err := snapshot.NewSnapshotter(os.Args[2])
if err != nil {
fmt.Printf("error: %v\n", err)
os.Exit(1)
Expand All @@ -41,6 +41,10 @@ func main() {
// Register the service with the gRPC server
snapshotsapi.RegisterSnapshotsServer(rpc, service)

if _, err := os.Lstat(os.Args[1]); err == nil {
os.Remove(os.Args[1])
}

// Listen and serve
l, err := net.Listen("unix", os.Args[1])
if err != nil {
Expand Down
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
module machinerun.io/atomfs-snapshotter

go 1.22.7

toolchain go1.22.9
go 1.23

require (
github.com/containerd/containerd v1.7.23
github.com/containerd/containerd/api v1.8.0
github.com/containerd/containerd/v2 v2.0.0
github.com/containerd/continuity v0.4.4
github.com/containerd/log v0.1.0
github.com/containerd/plugin v1.0.0
google.golang.org/grpc v1.68.0
)

require (
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/Microsoft/hcsshim v0.12.9 // indirect
github.com/containerd/cgroups/v3 v3.0.3 // indirect
github.com/containerd/continuity v0.4.4 // indirect
github.com/containerd/errdefs v1.0.0 // indirect
github.com/containerd/errdefs/pkg v0.3.0 // indirect
github.com/containerd/log v0.1.0 // indirect
github.com/containerd/ttrpc v1.2.6 // indirect
github.com/containerd/typeurl/v2 v2.2.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDk
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/containerd/cgroups/v3 v3.0.3 h1:S5ByHZ/h9PMe5IOQoN7E+nMc2UcLEM/V48DGDJ9kip0=
github.com/containerd/cgroups/v3 v3.0.3/go.mod h1:8HBe7V3aWGLFPd/k03swSIsGjZhHI2WzJmticMgVuz0=
github.com/containerd/containerd v1.7.23 h1:H2CClyUkmpKAGlhQp95g2WXHfLYc7whAuvZGBNYOOwQ=
github.com/containerd/containerd v1.7.23/go.mod h1:7QUzfURqZWCZV7RLNEn1XjUCQLEf0bkaK4GjUaZehxw=
github.com/containerd/containerd/api v1.8.0 h1:hVTNJKR8fMc/2Tiw60ZRijntNMd1U+JVMyTRdsD2bS0=
github.com/containerd/containerd/api v1.8.0/go.mod h1:dFv4lt6S20wTu/hMcP4350RL87qPWLVa/OHOwmmdnYc=
github.com/containerd/containerd/v2 v2.0.0 h1:qLDdFaAykQrIyLiqwQrNLLz95wiC36bAZVwioUwqShM=
Expand All @@ -21,6 +23,8 @@ github.com/containerd/errdefs/pkg v0.3.0 h1:9IKJ06FvyNlexW690DXuQNx2KA2cUJXx151X
github.com/containerd/errdefs/pkg v0.3.0/go.mod h1:NJw6s9HwNuRhnjJhM7pylWwMyAkmCQvQ4GpJHEqRLVk=
github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I=
github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo=
github.com/containerd/plugin v1.0.0 h1:c8Kf1TNl6+e2TtMHZt+39yAPDbouRH9WAToRjex483Y=
github.com/containerd/plugin v1.0.0/go.mod h1:hQfJe5nmWfImiqT1q8Si3jLv3ynMUIBB47bQ+KexvO8=
github.com/containerd/ttrpc v1.2.6 h1:zG+Kn5EZ6MUYCS1t2Hmt2J4tMVaLSFEJVOraDQwNPC4=
github.com/containerd/ttrpc v1.2.6/go.mod h1:YCXHsb32f+Sq5/72xHubdiJRQY9inL4a4ZQrAbN1q9o=
github.com/containerd/typeurl/v2 v2.2.2 h1:3jN/k2ysKuPCsln5Qv8bzR9cxal8XjkxPogJfSNO31k=
Expand Down
Loading