Skip to content

Add TTRPC client#3279

Merged
crosbymichael merged 2 commits intocontainerd:masterfrom
mxpv:ttrpc
May 21, 2019
Merged

Add TTRPC client#3279
crosbymichael merged 2 commits intocontainerd:masterfrom
mxpv:ttrpc

Conversation

@mxpv
Copy link
Copy Markdown
Member

@mxpv mxpv commented May 13, 2019

In firecracker-containerd project we use a GRPC plugin for containerd to accept requests from client and route them to a correct runtime shim (to manage microVMs). Both shim and plugin implement same protobuf interface. In order to make it work we have to implement both TTRPC and GRPC versions of this interface (GRPC for plugin to accept requests from client and ttrpc version for thim).

With recent merge of ttrpc plugins support in containerd we can avoid this problem and have just one ttrpc version, but we lack of a ttrpc client that can be used to make calls.

This PR adds the generic ttrpc client and refactors shim events publisher in favor of the new client. This can be used for plugins as well, or any other ttrpc communication (like task service).

Feedback is highly appreciated.

ref: firecracker-microvm/firecracker-containerd#180 and #3049

Signed-off-by: Maksym Pavlenko [email protected]

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented May 13, 2019

Build succeeded.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented May 13, 2019

Build succeeded.

@codecov-io
Copy link
Copy Markdown

codecov-io commented May 13, 2019

Codecov Report

Merging #3279 into master will increase coverage by 0.21%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3279      +/-   ##
==========================================
+ Coverage    44.4%   44.61%   +0.21%     
==========================================
  Files         113      112       -1     
  Lines       12231    12172      -59     
==========================================
  Hits         5431     5431              
+ Misses       5966     5907      -59     
  Partials      834      834
Flag Coverage Δ
#linux 48.51% <0%> (+0.18%) ⬆️
#windows 39.88% <0%> (+0.21%) ⬆️
Impacted Files Coverage Δ
runtime/v2/shim/shim_unix.go 0% <ø> (ø) ⬆️
runtime/v2/shim/shim_windows.go 43.5% <ø> (+5%) ⬆️
runtime/v2/shim/publisher.go 0% <0%> (ø) ⬆️
runtime/v2/shim/shim.go 0% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7acdb16...7f79fbb. Read the comment docs.

Copy link
Copy Markdown
Member

@fuweid fuweid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure that it is good way to import the containerd client package into the runtime package.
The containerd client is used to assemble components together. It maybe introduce cyclic issue here.

However, the change is look good basically. 👍

Comment thread client_ttrpc.go Outdated
Comment thread runtime/v2/shim/publisher.go Outdated
@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented May 14, 2019

Build succeeded.

  • containerd-build-arm64 : RETRY_LIMIT in 1m 00s (non-voting)

Signed-off-by: Maksym Pavlenko <[email protected]>
@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented May 14, 2019

Build succeeded.

@mxpv
Copy link
Copy Markdown
Member Author

mxpv commented May 14, 2019

I am not sure that it is good way to import the containerd client package into the runtime package.

The client package has no dependencies on shim sub-package, but your point make sense. ttrpc client doesn't have lots of dependencies, but regular client does, and it's hard to track them. So potentially the client can be moved to a sub-package to avoid cyclic dependencies.

@Yikun
Copy link
Copy Markdown
Contributor

Yikun commented May 14, 2019

recheck

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented May 14, 2019

Build succeeded.

@fuweid
Copy link
Copy Markdown
Member

fuweid commented May 20, 2019

The client package has no dependencies on shim sub-package, but your point make sense. ttrpc client doesn't have lots of dependencies, but regular client does, and it's hard to track them. So potentially the client can be moved to a sub-package to avoid cyclic dependencies.

Yeah!. We can move it to the sub-package in next time. The change is LGTM.

@crosbymichael
Copy link
Copy Markdown
Member

Oh, sorry I didn't catch the containerd import the first time. We cannot do this. The shim's cannot import the main containerd package as that brings in GRPC and the overhead, The shim sizes more than double with this change:

-rwxrwxr-x 1 michael michael  16M May 20 20:08 containerd-shim-runc-v1
-rwxrwxr-x 1 michael michael  16M May 20 20:08 containerd-shim-runc-v2

It has to be broken out and the dependency on the containerd package removed before merging

Signed-off-by: Maksym Pavlenko <[email protected]>
@mxpv
Copy link
Copy Markdown
Member Author

mxpv commented May 20, 2019

Moved the client to pkg/ttrpcutil.
note: I didn't move client tests as they heavily depend on TestMain and containerd daemon to be up and running.

@theopenlab-ci
Copy link
Copy Markdown

theopenlab-ci Bot commented May 20, 2019

Build succeeded.

@estesp
Copy link
Copy Markdown
Member

estesp commented May 21, 2019

Moving to subpackage solved the import of containerd:

-rwxrwxr-x 1 estesp estesp  8579008 May 21 02:03 containerd-shim-runc-v1
-rwxrwxr-x 1 estesp estesp  8579072 May 21 02:03 containerd-shim-runc-v2

Copy link
Copy Markdown
Member

@estesp estesp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@crosbymichael
Copy link
Copy Markdown
Member

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants