Browse code

daemon: rename containerdCli to containerdClient

The containerdCli was somewhat confusing (is it the CLI?); let's rename
to make it match what it is :)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2023/07/18 20:57:27
Showing 7 changed files
... ...
@@ -110,7 +110,7 @@ type Daemon struct {
110 110
 	PluginStore           *plugin.Store // TODO: remove
111 111
 	pluginManager         *plugin.Manager
112 112
 	linkIndex             *linkIndex
113
-	containerdCli         *containerd.Client
113
+	containerdClient      *containerd.Client
114 114
 	containerd            libcontainerdtypes.Client
115 115
 	defaultIsolation      containertypes.Isolation // Default isolation mode on Windows
116 116
 	clusterProvider       cluster.Provider
... ...
@@ -944,7 +944,7 @@ func NewDaemon(ctx context.Context, config *config.Config, pluginStore *plugin.S
944 944
 	}
945 945
 
946 946
 	if configStore.ContainerdAddr != "" {
947
-		d.containerdCli, err = containerd.New(configStore.ContainerdAddr, containerd.WithDefaultNamespace(configStore.ContainerdNamespace), containerd.WithDialOpts(gopts), containerd.WithTimeout(60*time.Second))
947
+		d.containerdClient, err = containerd.New(configStore.ContainerdAddr, containerd.WithDefaultNamespace(configStore.ContainerdNamespace), containerd.WithDialOpts(gopts), containerd.WithTimeout(60*time.Second))
948 948
 		if err != nil {
949 949
 			return nil, errors.Wrapf(err, "failed to dial %q", configStore.ContainerdAddr)
950 950
 		}
... ...
@@ -1059,7 +1059,7 @@ func NewDaemon(ctx context.Context, config *config.Config, pluginStore *plugin.S
1059 1059
 			return nil, err
1060 1060
 		}
1061 1061
 		d.imageService = ctrd.NewService(ctrd.ImageServiceConfig{
1062
-			Client:          d.containerdCli,
1062
+			Client:          d.containerdClient,
1063 1063
 			Containers:      d.containers,
1064 1064
 			Snapshotter:     driverName,
1065 1065
 			RegistryHosts:   d.RegistryHosts,
... ...
@@ -1137,9 +1137,9 @@ func NewDaemon(ctx context.Context, config *config.Config, pluginStore *plugin.S
1137 1137
 		// containerd is not currently supported with Windows.
1138 1138
 		// So sometimes d.containerdCli will be nil
1139 1139
 		// In that case we'll create a local content store... but otherwise we'll use containerd
1140
-		if d.containerdCli != nil {
1141
-			imgSvcConfig.Leases = d.containerdCli.LeasesService()
1142
-			imgSvcConfig.ContentStore = d.containerdCli.ContentStore()
1140
+		if d.containerdClient != nil {
1141
+			imgSvcConfig.Leases = d.containerdClient.LeasesService()
1142
+			imgSvcConfig.ContentStore = d.containerdClient.ContentStore()
1143 1143
 		} else {
1144 1144
 			cs, lm, err := d.configureLocalContentStore(config.ContainerdNamespace)
1145 1145
 			if err != nil {
... ...
@@ -1316,8 +1316,8 @@ func (daemon *Daemon) Shutdown(ctx context.Context) error {
1316 1316
 		daemon.netController.Stop()
1317 1317
 	}
1318 1318
 
1319
-	if daemon.containerdCli != nil {
1320
-		daemon.containerdCli.Close()
1319
+	if daemon.containerdClient != nil {
1320
+		daemon.containerdClient.Close()
1321 1321
 	}
1322 1322
 
1323 1323
 	if daemon.mdDB != nil {
... ...
@@ -1493,7 +1493,7 @@ func (daemon *Daemon) initLibcontainerd(ctx context.Context, cfg *config.Config)
1493 1493
 	var err error
1494 1494
 	daemon.containerd, err = remote.NewClient(
1495 1495
 		ctx,
1496
-		daemon.containerdCli,
1496
+		daemon.containerdClient,
1497 1497
 		filepath.Join(cfg.ExecRoot, "containerd"),
1498 1498
 		cfg.ContainerdNamespace,
1499 1499
 		daemon,
... ...
@@ -576,7 +576,7 @@ func (daemon *Daemon) initLibcontainerd(ctx context.Context, cfg *config.Config)
576 576
 	case windowsV1RuntimeName:
577 577
 		daemon.containerd, err = local.NewClient(
578 578
 			ctx,
579
-			daemon.containerdCli,
579
+			daemon.containerdClient,
580 580
 			filepath.Join(cfg.ExecRoot, "containerd"),
581 581
 			cfg.ContainerdNamespace,
582 582
 			daemon,
... ...
@@ -587,7 +587,7 @@ func (daemon *Daemon) initLibcontainerd(ctx context.Context, cfg *config.Config)
587 587
 		}
588 588
 		daemon.containerd, err = remote.NewClient(
589 589
 			ctx,
590
-			daemon.containerdCli,
590
+			daemon.containerdClient,
591 591
 			filepath.Join(cfg.ExecRoot, "containerd"),
592 592
 			cfg.ContainerdNamespace,
593 593
 			daemon,
... ...
@@ -144,7 +144,7 @@ func (daemon *Daemon) cleanupContainer(container *container.Container, config ty
144 144
 		container.RWLayer = nil
145 145
 	} else {
146 146
 		if daemon.UsesSnapshotter() {
147
-			ls := daemon.containerdCli.LeasesService()
147
+			ls := daemon.containerdClient.LeasesService()
148 148
 			lease := leases.Lease{
149 149
 				ID: container.ID,
150 150
 			}
... ...
@@ -218,7 +218,7 @@ func (daemon *Daemon) ContainerExecStart(ctx context.Context, name string, optio
218 218
 
219 219
 	p := &specs.Process{}
220 220
 	if runtime.GOOS != "windows" {
221
-		ctr, err := daemon.containerdCli.LoadContainer(ctx, ec.Container.ID)
221
+		ctr, err := daemon.containerdClient.LoadContainer(ctx, ec.Container.ID)
222 222
 		if err != nil {
223 223
 			return err
224 224
 		}
... ...
@@ -55,7 +55,7 @@ func (daemon *Daemon) execSetPlatformOpt(ctx context.Context, daemonCfg *config.
55 55
 	if len(ec.User) > 0 {
56 56
 		var err error
57 57
 		if daemon.UsesSnapshotter() {
58
-			p.User, err = getUserFromContainerd(ctx, daemon.containerdCli, ec)
58
+			p.User, err = getUserFromContainerd(ctx, daemon.containerdClient, ec)
59 59
 			if err != nil {
60 60
 				return err
61 61
 			}
... ...
@@ -1116,7 +1116,7 @@ func (daemon *Daemon) createSpec(ctx context.Context, daemonCfg *configStore, c
1116 1116
 		snapshotKey = c.ID
1117 1117
 	}
1118 1118
 
1119
-	return &s, coci.ApplyOpts(ctx, daemon.containerdCli, &containers.Container{
1119
+	return &s, coci.ApplyOpts(ctx, daemon.containerdClient, &containers.Container{
1120 1120
 		ID:          c.ID,
1121 1121
 		Snapshotter: snapshotter,
1122 1122
 		SnapshotKey: snapshotKey,