Use labels only when default namespace is provided and prefer given

options.

Implements same approach of setting defaults for `NewWithConn`.

Signed-off-by: Nikhil Soni <krsoninikhil@gmail.com>
This commit is contained in:
Nikhil Soni
2018-09-18 02:41:47 +05:30
parent 59432aaecf
commit 34323985a1
3 changed files with 27 additions and 14 deletions

View File

@@ -172,7 +172,7 @@ func setSnapshotterIfEmpty(ctx context.Context, client *Client, c *containers.Co
namespaceService := client.NamespaceService()
if ns, err := namespaces.NamespaceRequired(ctx); err == nil {
if labels, err := namespaceService.Labels(ctx, ns); err == nil {
if snapshotLabel, ok := labels["snapshotter"]; ok {
if snapshotLabel, ok := labels["containerd.io/defaults/snapshotter"]; ok {
defaultSnapshotter = snapshotLabel
}
}