Merge pull request #2323 from stevvooe/ping-snapshots-from-cli

cmd/snapshots: add gc.root to created snapshots
This commit is contained in:
Michael Crosby 2018-05-04 13:27:44 -04:00 committed by GitHub
commit e22c827cf5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -304,7 +304,11 @@ var prepareCommand = cli.Command{
defer cancel()
snapshotter := client.SnapshotService(context.GlobalString("snapshotter"))
mounts, err := snapshotter.Prepare(ctx, key, parent)
labels := map[string]string{
"containerd.io/gc.root": time.Now().UTC().Format(time.RFC3339),
}
mounts, err := snapshotter.Prepare(ctx, key, parent, snapshots.WithLabels(labels))
if err != nil {
return err
}
@ -404,7 +408,10 @@ var commitCommand = cli.Command{
}
defer cancel()
snapshotter := client.SnapshotService(context.GlobalString("snapshotter"))
return snapshotter.Commit(ctx, key, active)
labels := map[string]string{
"containerd.io/gc.root": time.Now().UTC().Format(time.RFC3339),
}
return snapshotter.Commit(ctx, key, active, snapshots.WithLabels(labels))
},
}