Skip to content

Create a lease for the snapshots we prepare#62

Merged
rumpl merged 1 commit intoc8dfrom
fix-snapshot-gc
Aug 17, 2022
Merged

Create a lease for the snapshots we prepare#62
rumpl merged 1 commit intoc8dfrom
fix-snapshot-gc

Conversation

@rumpl
Copy link
Owner

@rumpl rumpl commented Aug 17, 2022

With a lease we make sure that containerd won't garbage collect out
snapshot. We remove the lease when the container is removed and leave it
to containerd to clean things up.

With a lease we make sure that containerd won't garbage collect out
snapshot. We remove the lease when the container is removed and leave it
to containerd to clean things up.

Signed-off-by: Djordje Lukic <[email protected]>
@rumpl rumpl merged commit 6630bef into c8d Aug 17, 2022
Comment on lines +197 to +206
// Add a lease so that containerd doesn't garbage collect our snapshot
ls := daemon.containerdCli.LeasesService()
lease, err := ls.Create(ctx, leases.WithID(ctr.ID))
if err != nil {
return nil, err
}
ls.AddResource(ctx, lease, leases.Resource{
ID: ctr.ID,
Type: "snapshots/" + daemon.graphDriver,
})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussing with @vvoland - possibly with this fix in place, we can revert the changes from #47, which will make upstreaming our changes easier

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants