-
Notifications
You must be signed in to change notification settings - Fork 119
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
Refactor the optimizer based on containerd #240
Conversation
cmd/ctr-remote/commands/notify.go
Outdated
) | ||
|
||
var NotifyCommand = cli.Command{ | ||
Name: "notify", |
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/notify/fanotify/ might have more clarity
Thanks, design SGTM 👍 |
@@ -23,6 +23,8 @@ ORG_IMAGE_TAG="${REGISTRY_HOST}:5000/test:org$(date '+%M%S')" | |||
OPT_IMAGE_TAG="${REGISTRY_HOST}:5000/test:opt$(date '+%M%S')" | |||
NOOPT_IMAGE_TAG="${REGISTRY_HOST}:5000/test:noopt$(date '+%M%S')" | |||
TOC_JSON_DIGEST_ANNOTATION="containerd.io/snapshot/stargz/toc.digest" | |||
NETWORK_MOUNT_TEST_ORG_IMAGE_TAG="ghcr.io/stargz-containers/centos:8-test" |
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.
nit: CentOS is deprecated
14ae5bb
to
9c2288a
Compare
@mc256 Sorry for the slow reply. I implemented |
6881173
to
770ff66
Compare
9f86fdb
to
a55cf0c
Compare
Benchmarking result with images generated by this new optimizer seems fine. https://github.com/ktock/stargz-snapshotter/runs/1789973644 |
Signed-off-by: Kohei Tokunaga <[email protected]>
Merging, but test script should show error on non-amd64 |
#223
#230
#238
This refactors optimizer based on continerd and fanotify. Options of
ctr-remote image optimize
are unchanged except it now accepts--oci
option and multiple--platform
options. Nowctr-remote image optimize
requires containerd daemon up-and-running but doesn't require FUSE.CAP_SYS_ADMIN
is needed for fanotify and cloning a mount namespace.The design is the following:
*analyzer.Analize()
creates a mount namespace and monitor "/" mountpoint of that namespace with fanotify-based notifier process (ctr-remote notify
).*analyzer.Analyze
preapres snapshots and container spec based on the specified option. Then it runs a container in that mount namespace created in step 1 (notifier process is invisible to the container). Notifier sends all accessed files to the optimizer over stdio.NOTEs:
*analyzer.imageRecorder
takes responsibility to find out the layer that the file notified belongs to.TODOs:
containerd.WithXXXX
) instead ofanalyzer.runtimeOpts
.--wait-on-signal
doesn't seem to work yet.cc @AkihiroSuda