cri: remove sandbox controller from client
cri will call sandbox controller from the sandboxService, remove the dependency of client. Signed-off-by: Abel Feng <fshb1988@gmail.com>
This commit is contained in:
		| @@ -230,27 +230,3 @@ func WithInMemoryServices(ic *plugin.InitContext) Opt { | ||||
| 		return nil | ||||
| 	} | ||||
| } | ||||
|  | ||||
| func WithInMemorySandboxControllers(ic *plugin.InitContext) Opt { | ||||
| 	return func(c *clientOpts) error { | ||||
| 		sc := make(map[string]sandbox.Controller) | ||||
| 		sandboxers, err := ic.GetByType(plugins.SandboxControllerPlugin) | ||||
| 		if err != nil { | ||||
| 			return err | ||||
| 		} | ||||
| 		for name, p := range sandboxers { | ||||
| 			sc[name] = p.(sandbox.Controller) | ||||
| 		} | ||||
|  | ||||
| 		podSandboxers, err := ic.GetByType(plugins.PodSandboxPlugin) | ||||
| 		if err != nil { | ||||
| 			return err | ||||
| 		} | ||||
| 		for name, p := range podSandboxers { | ||||
| 			sc[name] = p.(sandbox.Controller) | ||||
| 		} | ||||
|  | ||||
| 		c.services.sandboxers = sc | ||||
| 		return nil | ||||
| 	} | ||||
| } | ||||
|   | ||||
| @@ -112,11 +112,10 @@ func (c *criService) recover(ctx context.Context) error { | ||||
|  | ||||
| 		var ( | ||||
| 			state    = sandboxstore.StateUnknown | ||||
| 			controller = c.client.SandboxController(sbx.Sandboxer) | ||||
| 			endpoint sandboxstore.Endpoint | ||||
| 		) | ||||
|  | ||||
| 		status, err := controller.Status(ctx, sbx.ID, false) | ||||
| 		status, err := c.sandboxService.SandboxStatus(ctx, sbx.Sandboxer, sbx.ID, false) | ||||
| 		if err != nil { | ||||
| 			log.G(ctx). | ||||
| 				WithError(err). | ||||
|   | ||||
| @@ -119,7 +119,6 @@ func initCRIService(ic *plugin.InitContext) (interface{}, error) { | ||||
| 		containerd.WithDefaultNamespace(constants.K8sContainerdNamespace), | ||||
| 		containerd.WithDefaultPlatform(platforms.Default()), | ||||
| 		containerd.WithInMemoryServices(ic), | ||||
| 		containerd.WithInMemorySandboxControllers(ic), | ||||
| 	) | ||||
| 	if err != nil { | ||||
| 		return nil, fmt.Errorf("failed to create containerd client: %w", err) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Abel Feng
					Abel Feng