Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ctrd,cli,daemon,pkg: update to adapt with containerd@v1.2.5 #2725

Merged
merged 2 commits into from
Mar 14, 2019
Merged

ctrd,cli,daemon,pkg: update to adapt with containerd@v1.2.5 #2725

merged 2 commits into from
Mar 14, 2019

Conversation

fuweid
Copy link
Contributor

@fuweid fuweid commented Feb 25, 2019

Ⅰ. Describe what this PR did

The containerd has been improved a lot in v1.2, which makes the service
stable than before. Based on this, we need to do the upgrade.

using following commands to update the vendor

govendor fetch github.com/containerd/containerd/...@v1.2.5
govendor fetch github.com/gogo/protobuf/...@v1.0.0
govendor fetch github.com/gogo/googleapis/...@08a7655d27152912db7aaf4f983275eaf8d128ef
govendor fetch google.golang.org/grpc/...@v1.12.0
govendor fetch github.com/golang/protobuf/...@v1.1.0

Basically, both the contaienrd and shim API interfaces are stable so
that we don't need to worry about the remote API calls. However, the
package level interface has been changed a lot. The commit is used to
align with containerd@v1.2.0.

1. events part:
   using exchange event helper instead of raw grpc conn

2. image part:
  a. import:
     new Import interface makes the import easier without Importer.

  b. commit:
     content helper has been upgraded with less arguments for caller.
     and `diff` package separates the Applier and Comparer interfaces.
     The changes can make the code clear in PouchContainer

3. lease:
  containerd client doesn't provide ListLeases interface directly.
  PouchContainer needs to get LeasesService and make the call by itself.

4. container IO:
  remove codes which comes from containerd. The code was used to align
  with containerd v1.2, which can make upgrade work easier. For now, we
  can remove this.

I also use subshell to run the integration::ping_pouchd command so that the error log can show up in CI.

Ⅱ. Does this pull request fix one issue?

NONE

Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)

no need

NOTE: I change the save and load case because the containerd v1.2.x doesn't contains the related patch for multiple manifest cases. Based on this, I replace helloworld image with busybox:1.25.

Ⅳ. Describe how to verify it

use existing CI testing case

Ⅴ. Special notes for reviews

I separate the change into two commits because the vendor change is too big.
There are somethings need to do after this PR, for example, it is time to remove the ctrd/wrapper_client.go because the grpc has been updated and it can support the defaultMaxStreamsClient

after this patch, the #1897 will be fixed.

➜  /tmp docker pull alpine

➜  /tmp docker save alpine -o alpine.tar

➜  /tmp pouch images
IMAGE ID   IMAGE NAME   SIZE

➜  /tmp pouch load -i alpine.tar docker.io/library/alpine

➜  /tmp pouch images
IMAGE ID       IMAGE NAME                        SIZE
caf27325b298   docker.io/library/alpine:latest   5.53 MB

fix #1897 #1713

@codecov
Copy link

codecov bot commented Feb 25, 2019

Codecov Report

Merging #2725 into master will increase coverage by 0.08%.
The diff coverage is 83.87%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2725      +/-   ##
==========================================
+ Coverage   69.32%   69.41%   +0.08%     
==========================================
  Files         278      277       -1     
  Lines       17448    17391      -57     
==========================================
- Hits        12096    12072      -24     
+ Misses       4025     3998      -27     
+ Partials     1327     1321       -6
Flag Coverage Δ
#criv1alpha2_test 39.39% <40.32%> (-0.08%) ⬇️
#integration_test_0 36.57% <56.45%> (-0.03%) ⬇️
#integration_test_1 35.46% <82.25%> (-0.07%) ⬇️
#integration_test_2 36.5% <40.32%> (-0.06%) ⬇️
#integration_test_3 35.4% <74.19%> (ø) ⬆️
#node_e2e_test 35.19% <40.32%> (-0.11%) ⬇️
#unittest 28.54% <0%> (+0.1%) ⬆️
Impacted Files Coverage Δ
pkg/jsonstream/image_progress.go 0% <ø> (ø) ⬆️
daemon/mgr/image.go 59.45% <0%> (ø) ⬆️
daemon/mgr/image_utils.go 85.45% <100%> (ø) ⬆️
daemon/mgr/image_load.go 41.17% <100%> (-8.83%) ⬇️
ctrd/image.go 69.96% <100%> (+0.7%) ⬆️
ctrd/utils.go 83.17% <100%> (+0.82%) ⬆️
daemon/containerio/cio.go 70% <100%> (+1.32%) ⬆️
ctrd/snapshot.go 56.14% <100%> (+8.77%) ⬆️
daemon/containerio/io.go 74.75% <100%> (ø) ⬆️
ctrd/image_commit.go 68.02% <66.66%> (ø) ⬆️
... and 10 more

@fuweid fuweid changed the title Me containerd v1.2.x ctrd,cli,daemon,pkg: update to adapt with containerd@v1.2.4 Feb 25, 2019
@fuweid fuweid requested a review from zhuangqh February 25, 2019 11:28
hack/install/install_containerd.sh Outdated Show resolved Hide resolved
hack/testing/run_daemon_integration.sh Show resolved Hide resolved
@@ -25,20 +25,20 @@ func init() {
func (suite *APIImageSaveLoadSuite) SetUpTest(c *check.C) {
SkipIfFalse(c, environment.IsLinux)

PullImage(c, helloworldImage)
PullImage(c, busyboxImage125)
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we use image busyboxImage128?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure. will do

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done. I will file other pr to replace all the busyboxImage125 because the 128 tag is stable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I roll it back because 125 tag has only one manifest, not a list.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think define busyboxImage is enough, without tag, or we need change lots of places, we have done these times

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we cannot use the latest one, because the latest has no stable digest and ID. we don't know what the real ID is.

Copy link
Contributor

Choose a reason for hiding this comment

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

What I mean is busyboxImage=xxx125 or xxx128, I do not like busyboxImage128 define with tag at all. It can be fix in another pr.

Copy link
Contributor

Choose a reason for hiding this comment

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

Or can we reset these change in test.

Copy link
Contributor Author

@fuweid fuweid Mar 5, 2019

Choose a reason for hiding this comment

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

I will change it to busyboxLegacyImage instead of 125 in the following pr.
cc @rudyfly

switch cfg.MediaType {
case ocispec.MediaTypeImageConfig, images.MediaTypeDockerSchema2Config:
data, err := content.ReadBlob(ctx, img.ContentStore(), cfg.Digest)
case ocispec.MediaTypeImageConfig, images.MediaTypeDockerSchema2Config,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

ping @HusterWan and @Ace-Tang , there is used to support existing downloaded images, for example, redis:2 with the application/octet-stream media type. if we don't support it here, we will miss the image.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Agree that

ctrd/image.go Outdated Show resolved Hide resolved
ctrd/image_commit.go Show resolved Hide resolved
ctrd/utils.go Outdated
"github.com/opencontainers/runtime-spec/specs-go"
"github.com/pkg/errors"
)

// NewDefaultSpec new a template spec with default.
func NewDefaultSpec(ctx context.Context, id string) (*specs.Spec, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We do not need default spec from containerd now

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will do.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

// NewCioFIFOSet prepares fifo files.
func NewCioFIFOSet(processID string, withStdin bool, withTerminal bool) (*CioFIFOSet, error) {
// NewFIFOSet prepares fifo files.
func NewFIFOSet(processID string, withStdin bool, withTerminal bool) (*cio.FIFOSet, error) {
root := "/run/containerd/fifo"
Copy link
Contributor

Choose a reason for hiding this comment

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

Let make it a variable ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it was my plan. I will do that in next pr.

e, err := events.Recv()
if err != nil {
logrus.Errorf("failed to receive event: %v", err)
var e *events.Envelope
Copy link
Contributor

Choose a reason for hiding this comment

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

How about combine var define with below:

		var (
			action      string
			containerID string
			attributes  = map[string]string{}
		)

Copy link
Contributor

@zhuangqh zhuangqh left a comment

Choose a reason for hiding this comment

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

LGTM

@fuweid fuweid changed the title ctrd,cli,daemon,pkg: update to adapt with containerd@v1.2.4 [RFC|DONOTMERGE] ctrd,cli,daemon,pkg: update to adapt with containerd@v1.2.4 Mar 4, 2019
using following commands:
govendor fetch github.com/containerd/containerd/...@v1.2.5
govendor fetch github.com/gogo/protobuf/...@v1.0.0
govendor fetch github.com/gogo/googleapis/...@08a7655d27152912db7aaf4f983275eaf8d128ef
govendor fetch google.golang.org/grpc/...@v1.12.0
govendor fetch github.com/golang/protobuf/...@v1.1.0

Signed-off-by: Wei Fu <fuweid89@gmail.com>
The containerd has been improved a lot in v1.2, which makes the service
stable before. Based on this, we need to do the upgrade.

Basically, both the contaienrd and shim API interfaces are stable so
that we don't need to worry about the remote API calls. However, the
package level interface has been changed a lot. The commit is used to
align with containerd@v1.2.5.

1. events part:
   using exchange event helper instead of raw grpc conn

2. image part:
  a. import:
     new Import interface makes the import easier without Importer.

  b. commit:
     content helper has been upgraded with less arguments for caller.
     and `diff` package separates the Applier and Comparer interfaces.
     The changes can make the code clear in PouchContainer

3. lease:
  containerd client doesn't provide ListLeases interface directly.
  PouchContainer needs to get LeasesService and make the call by itself.

4. container IO:
  remove codes which comes from containerd. The code was used to align
  with containerd v1.2, which can make upgrade work easier. For now, we
  can remove this.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
@fuweid fuweid changed the title [RFC|DONOTMERGE] ctrd,cli,daemon,pkg: update to adapt with containerd@v1.2.4 ctrd,cli,daemon,pkg: update to adapt with containerd@v1.2.5 Mar 13, 2019
@zhuangqh zhuangqh self-requested a review March 13, 2019 09:29
@Ace-Tang Ace-Tang merged commit ffeaa43 into AliyunContainerService:master Mar 14, 2019
@fuweid fuweid deleted the me-containerd-v1.2.x branch March 25, 2019 01:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[proposal] support loading docker format image
6 participants