containerd-shim-runc-v2 启动了一个ttrpc server(类似grpc)
containerd 通过 ttrpc和containerd-shim-runc-v2 通信来管理容器
service Task { rpc State(StateRequest) returns (StateResponse); rpc Create(CreateTaskRequest) returns (CreateTaskResponse); rpc Start(StartRequest) returns (StartResponse); rpc Delete(DeleteRequest) returns (DeleteResponse); rpc Pids(PidsRequest) returns (PidsResponse); rpc Pause(PauseRequest) returns (google.protobuf.Empty); rpc Resume(ResumeRequest) returns (google.protobuf.Empty); rpc Checkpoint(CheckpointTaskRequest) returns (google.protobuf.Empty); rpc Kill(KillRequest) returns (google.protobuf.Empty); rpc Exec(ExecProcessRequest) returns (google.protobuf.Empty); rpc ResizePty(ResizePtyRequest) returns (google.protobuf.Empty); rpc CloseIO(CloseIORequest) returns (google.protobuf.Empty); rpc Update(UpdateTaskRequest) returns (google.protobuf.Empty); rpc Wait(WaitRequest) returns (WaitResponse); rpc Stats(StatsRequest) returns (StatsResponse); rpc Connect(ConnectRequest) returns (ConnectResponse); rpc Shutdown(ShutdownRequest) returns (google.protobuf.Empty); }
containerd-shim-runc-v2 通过调用 containerd 的api把事件进行上报
root@nmx-NUC8i5BEH:/home/nmx/containerd# containerd-shim-runc-v2 --help Usage of containerd-shim-runc-v2: -address string grpc address back to main containerd -bundle string path to the bundle if not workdir -debug enable debug output in logs -id string id of the task -namespace string namespace that owns the shim -publish-binary string path to publish binary (used for publishing events) (default "containerd") -socket string socket path to serve -v show the shim version and exit
调用publish进行上报
events.Publish(ctx, runtime.TaskDeleteEventTopic, &eventstypes.TaskDelete{ ContainerID: id, Pid: pid, ExitStatus: exitStatus, ExitedAt: exitedAt, })
标签:google,shim,containerd,returns,通信,rpc,Empty From: https://www.cnblogs.com/rincloud/p/16860058.html