Browse Source

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 1 year ago
parent
commit
034e7e153f
7 changed files with 15 additions and 15 deletions
  1. 8 8
      daemon/daemon.go
  2. 1 1
      daemon/daemon_unix.go
  3. 2 2
      daemon/daemon_windows.go
  4. 1 1
      daemon/delete.go
  5. 1 1
      daemon/exec.go
  6. 1 1
      daemon/exec_linux.go
  7. 1 1
      daemon/oci_linux.go

+ 8 - 8
daemon/daemon.go

@@ -110,7 +110,7 @@ type Daemon struct {
 	PluginStore           *plugin.Store // TODO: remove
 	PluginStore           *plugin.Store // TODO: remove
 	pluginManager         *plugin.Manager
 	pluginManager         *plugin.Manager
 	linkIndex             *linkIndex
 	linkIndex             *linkIndex
-	containerdCli         *containerd.Client
+	containerdClient      *containerd.Client
 	containerd            libcontainerdtypes.Client
 	containerd            libcontainerdtypes.Client
 	defaultIsolation      containertypes.Isolation // Default isolation mode on Windows
 	defaultIsolation      containertypes.Isolation // Default isolation mode on Windows
 	clusterProvider       cluster.Provider
 	clusterProvider       cluster.Provider
@@ -944,7 +944,7 @@ func NewDaemon(ctx context.Context, config *config.Config, pluginStore *plugin.S
 	}
 	}
 
 
 	if configStore.ContainerdAddr != "" {
 	if configStore.ContainerdAddr != "" {
-		d.containerdCli, err = containerd.New(configStore.ContainerdAddr, containerd.WithDefaultNamespace(configStore.ContainerdNamespace), containerd.WithDialOpts(gopts), containerd.WithTimeout(60*time.Second))
+		d.containerdClient, err = containerd.New(configStore.ContainerdAddr, containerd.WithDefaultNamespace(configStore.ContainerdNamespace), containerd.WithDialOpts(gopts), containerd.WithTimeout(60*time.Second))
 		if err != nil {
 		if err != nil {
 			return nil, errors.Wrapf(err, "failed to dial %q", configStore.ContainerdAddr)
 			return nil, errors.Wrapf(err, "failed to dial %q", configStore.ContainerdAddr)
 		}
 		}
@@ -1059,7 +1059,7 @@ func NewDaemon(ctx context.Context, config *config.Config, pluginStore *plugin.S
 			return nil, err
 			return nil, err
 		}
 		}
 		d.imageService = ctrd.NewService(ctrd.ImageServiceConfig{
 		d.imageService = ctrd.NewService(ctrd.ImageServiceConfig{
-			Client:          d.containerdCli,
+			Client:          d.containerdClient,
 			Containers:      d.containers,
 			Containers:      d.containers,
 			Snapshotter:     driverName,
 			Snapshotter:     driverName,
 			RegistryHosts:   d.RegistryHosts,
 			RegistryHosts:   d.RegistryHosts,
@@ -1137,9 +1137,9 @@ func NewDaemon(ctx context.Context, config *config.Config, pluginStore *plugin.S
 		// containerd is not currently supported with Windows.
 		// containerd is not currently supported with Windows.
 		// So sometimes d.containerdCli will be nil
 		// So sometimes d.containerdCli will be nil
 		// In that case we'll create a local content store... but otherwise we'll use containerd
 		// In that case we'll create a local content store... but otherwise we'll use containerd
-		if d.containerdCli != nil {
-			imgSvcConfig.Leases = d.containerdCli.LeasesService()
-			imgSvcConfig.ContentStore = d.containerdCli.ContentStore()
+		if d.containerdClient != nil {
+			imgSvcConfig.Leases = d.containerdClient.LeasesService()
+			imgSvcConfig.ContentStore = d.containerdClient.ContentStore()
 		} else {
 		} else {
 			cs, lm, err := d.configureLocalContentStore(config.ContainerdNamespace)
 			cs, lm, err := d.configureLocalContentStore(config.ContainerdNamespace)
 			if err != nil {
 			if err != nil {
@@ -1316,8 +1316,8 @@ func (daemon *Daemon) Shutdown(ctx context.Context) error {
 		daemon.netController.Stop()
 		daemon.netController.Stop()
 	}
 	}
 
 
-	if daemon.containerdCli != nil {
-		daemon.containerdCli.Close()
+	if daemon.containerdClient != nil {
+		daemon.containerdClient.Close()
 	}
 	}
 
 
 	if daemon.mdDB != nil {
 	if daemon.mdDB != nil {

+ 1 - 1
daemon/daemon_unix.go

@@ -1493,7 +1493,7 @@ func (daemon *Daemon) initLibcontainerd(ctx context.Context, cfg *config.Config)
 	var err error
 	var err error
 	daemon.containerd, err = remote.NewClient(
 	daemon.containerd, err = remote.NewClient(
 		ctx,
 		ctx,
-		daemon.containerdCli,
+		daemon.containerdClient,
 		filepath.Join(cfg.ExecRoot, "containerd"),
 		filepath.Join(cfg.ExecRoot, "containerd"),
 		cfg.ContainerdNamespace,
 		cfg.ContainerdNamespace,
 		daemon,
 		daemon,

+ 2 - 2
daemon/daemon_windows.go

@@ -576,7 +576,7 @@ func (daemon *Daemon) initLibcontainerd(ctx context.Context, cfg *config.Config)
 	case windowsV1RuntimeName:
 	case windowsV1RuntimeName:
 		daemon.containerd, err = local.NewClient(
 		daemon.containerd, err = local.NewClient(
 			ctx,
 			ctx,
-			daemon.containerdCli,
+			daemon.containerdClient,
 			filepath.Join(cfg.ExecRoot, "containerd"),
 			filepath.Join(cfg.ExecRoot, "containerd"),
 			cfg.ContainerdNamespace,
 			cfg.ContainerdNamespace,
 			daemon,
 			daemon,
@@ -587,7 +587,7 @@ func (daemon *Daemon) initLibcontainerd(ctx context.Context, cfg *config.Config)
 		}
 		}
 		daemon.containerd, err = remote.NewClient(
 		daemon.containerd, err = remote.NewClient(
 			ctx,
 			ctx,
-			daemon.containerdCli,
+			daemon.containerdClient,
 			filepath.Join(cfg.ExecRoot, "containerd"),
 			filepath.Join(cfg.ExecRoot, "containerd"),
 			cfg.ContainerdNamespace,
 			cfg.ContainerdNamespace,
 			daemon,
 			daemon,

+ 1 - 1
daemon/delete.go

@@ -144,7 +144,7 @@ func (daemon *Daemon) cleanupContainer(container *container.Container, config ty
 		container.RWLayer = nil
 		container.RWLayer = nil
 	} else {
 	} else {
 		if daemon.UsesSnapshotter() {
 		if daemon.UsesSnapshotter() {
-			ls := daemon.containerdCli.LeasesService()
+			ls := daemon.containerdClient.LeasesService()
 			lease := leases.Lease{
 			lease := leases.Lease{
 				ID: container.ID,
 				ID: container.ID,
 			}
 			}

+ 1 - 1
daemon/exec.go

@@ -218,7 +218,7 @@ func (daemon *Daemon) ContainerExecStart(ctx context.Context, name string, optio
 
 
 	p := &specs.Process{}
 	p := &specs.Process{}
 	if runtime.GOOS != "windows" {
 	if runtime.GOOS != "windows" {
-		ctr, err := daemon.containerdCli.LoadContainer(ctx, ec.Container.ID)
+		ctr, err := daemon.containerdClient.LoadContainer(ctx, ec.Container.ID)
 		if err != nil {
 		if err != nil {
 			return err
 			return err
 		}
 		}

+ 1 - 1
daemon/exec_linux.go

@@ -55,7 +55,7 @@ func (daemon *Daemon) execSetPlatformOpt(ctx context.Context, daemonCfg *config.
 	if len(ec.User) > 0 {
 	if len(ec.User) > 0 {
 		var err error
 		var err error
 		if daemon.UsesSnapshotter() {
 		if daemon.UsesSnapshotter() {
-			p.User, err = getUserFromContainerd(ctx, daemon.containerdCli, ec)
+			p.User, err = getUserFromContainerd(ctx, daemon.containerdClient, ec)
 			if err != nil {
 			if err != nil {
 				return err
 				return err
 			}
 			}

+ 1 - 1
daemon/oci_linux.go

@@ -1116,7 +1116,7 @@ func (daemon *Daemon) createSpec(ctx context.Context, daemonCfg *configStore, c
 		snapshotKey = c.ID
 		snapshotKey = c.ID
 	}
 	}
 
 
-	return &s, coci.ApplyOpts(ctx, daemon.containerdCli, &containers.Container{
+	return &s, coci.ApplyOpts(ctx, daemon.containerdClient, &containers.Container{
 		ID:          c.ID,
 		ID:          c.ID,
 		Snapshotter: snapshotter,
 		Snapshotter: snapshotter,
 		SnapshotKey: snapshotKey,
 		SnapshotKey: snapshotKey,