We should never return a nil context because of the way this function is
typically used... e.g.
```
ctx, done, err := containerd.WithLease(ctx)
```
If there is an error `ctx` will be nil and any error handling may cause
an NPE if it tries to use `ctx`.
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
It's sometimes useful to specify a custom lease configuration. In this
case clients have to deal with LeaseManager manually to create/defer delete lease (essentially dup
WithLease logic). This PR adds lease opts to WithLease, so options
can be specified inline.
Signed-off-by: Maksym Pavlenko <makpav@amazon.com>
Allow setting an expiration label to have the garbage
collector remove an item after the specified time.
Signed-off-by: Derek McGowan <derek@mcgstyle.net>
Allows the client to choose the context to finish the lease.
This allows the client to switch contexts when the main context
used to the create the lease may have been cancelled.
Signed-off-by: Derek McGowan <derek@mcgstyle.net>