Skip to content
This repository was archived by the owner on Mar 9, 2022. It is now read-only.

Conversation

@Random-Liu
Copy link
Member

@Random-Liu Random-Liu commented May 24, 2017

Based on #41 and #46.

This PR let sandbox container use pause image and applies image config.

Only the last commit is new. Will rebase the PR and previous PRs soon.

@Random-Liu
Copy link
Member Author

This PR passes sandbox and image CRI validation test:

Running Suite: E2ECRI Suite
===========================
Random Seed: 1495659802 - Will randomize all specs
Will run 3 of 36 specs

SSSSSSSS
------------------------------
[k8s.io] PodSandbox runtime should support basic operations on PodSandbox 
  runtime should support removing PodSandbox [Conformance]
  /home/lantaol/workspace/src/github.com/kubernetes-incubator/cri-tools/pkg/validate/pod.go:77
[BeforeEach] [k8s.io] PodSandbox
  /home/lantaol/workspace/src/github.com/kubernetes-incubator/cri-tools/pkg/framework/framework.go:50
[BeforeEach] [k8s.io] PodSandbox
  /home/lantaol/workspace/src/github.com/kubernetes-incubator/cri-tools/pkg/validate/pod.go:39
[It] runtime should support removing PodSandbox [Conformance]
  /home/lantaol/workspace/src/github.com/kubernetes-incubator/cri-tools/pkg/validate/pod.go:77
STEP: run PodSandbox
STEP: stop PodSandbox
STEP: Stop PodSandbox for podID: 866db5b0e01ad81f9ba6452c3dfddb704999a7e5ef8e6112ae15e95b017fea4a
May 24 21:03:23.405: INFO: Stopped PodSandbox "866db5b0e01ad81f9ba6452c3dfddb704999a7e5ef8e6112ae15e95b017fea4a"

STEP: test remove PodSandbox
STEP: Remove PodSandbox for podID: 866db5b0e01ad81f9ba6452c3dfddb704999a7e5ef8e6112ae15e95b017fea4a
May 24 21:03:23.406: INFO: Removed PodSandbox "866db5b0e01ad81f9ba6452c3dfddb704999a7e5ef8e6112ae15e95b017fea4a"

STEP: List PodSandbox for podID: 866db5b0e01ad81f9ba6452c3dfddb704999a7e5ef8e6112ae15e95b017fea4a
STEP: List PodSandbox.
May 24 21:03:23.407: INFO: List PodSandbox succeed
[AfterEach] runtime should support basic operations on PodSandbox
  /home/lantaol/workspace/src/github.com/kubernetes-incubator/cri-tools/pkg/validate/pod.go:49
STEP: stop PodSandbox
E0524 21:03:23.407719   29060 remote_runtime.go:109] StopPodSandbox "866db5b0e01ad81f9ba6452c3dfddb704999a7e5ef8e6112ae15e95b017fea4a" from runtime service failed: rpc error: code = 2 desc = an error occurred when try to find sandbox "866db5b0e01ad81f9ba6452c3dfddb704999a7e5ef8e6112ae15e95b017fea4a": does not exist
STEP: delete PodSandbox
[AfterEach] [k8s.io] PodSandbox
  /home/lantaol/workspace/src/github.com/kubernetes-incubator/cri-tools/pkg/framework/framework.go:51
•SSSSSSSSSSSSSSSS
------------------------------
[k8s.io] PodSandbox runtime should support basic operations on PodSandbox 
  runtime should support stopping PodSandbox [Conformance]
  /home/lantaol/workspace/src/github.com/kubernetes-incubator/cri-tools/pkg/validate/pod.go:66
[BeforeEach] [k8s.io] PodSandbox
  /home/lantaol/workspace/src/github.com/kubernetes-incubator/cri-tools/pkg/framework/framework.go:50
[BeforeEach] [k8s.io] PodSandbox
  /home/lantaol/workspace/src/github.com/kubernetes-incubator/cri-tools/pkg/validate/pod.go:39
[It] runtime should support stopping PodSandbox [Conformance]
  /home/lantaol/workspace/src/github.com/kubernetes-incubator/cri-tools/pkg/validate/pod.go:66
STEP: run PodSandbox
STEP: test stop PodSandbox
STEP: Stop PodSandbox for podID: 0cb6f01e0c9e647e3d9759a211b6072578a8a7adc9f389365af06751929cc57f
May 24 21:03:23.797: INFO: Stopped PodSandbox "0cb6f01e0c9e647e3d9759a211b6072578a8a7adc9f389365af06751929cc57f"

STEP: Get PodSandbox status for podID: 0cb6f01e0c9e647e3d9759a211b6072578a8a7adc9f389365af06751929cc57f
[AfterEach] runtime should support basic operations on PodSandbox
  /home/lantaol/workspace/src/github.com/kubernetes-incubator/cri-tools/pkg/validate/pod.go:49
STEP: stop PodSandbox
STEP: delete PodSandbox
[AfterEach] [k8s.io] PodSandbox
  /home/lantaol/workspace/src/github.com/kubernetes-incubator/cri-tools/pkg/framework/framework.go:51
•SSSSSSSSS
------------------------------
[k8s.io] PodSandbox runtime should support basic operations on PodSandbox 
  runtime should support running PodSandbox [Conformance]
  /home/lantaol/workspace/src/github.com/kubernetes-incubator/cri-tools/pkg/validate/pod.go:58
[BeforeEach] [k8s.io] PodSandbox
  /home/lantaol/workspace/src/github.com/kubernetes-incubator/cri-tools/pkg/framework/framework.go:50
[BeforeEach] [k8s.io] PodSandbox
  /home/lantaol/workspace/src/github.com/kubernetes-incubator/cri-tools/pkg/validate/pod.go:39
[It] runtime should support running PodSandbox [Conformance]
  /home/lantaol/workspace/src/github.com/kubernetes-incubator/cri-tools/pkg/validate/pod.go:58
STEP: test run a default PodSandbox
STEP: Get PodSandbox status for podID: 33881cd78a6f5116a4509a72591de046790978dd947c8579734efee1bc50f068
STEP: test list PodSandbox
STEP: List PodSandbox for podID: 33881cd78a6f5116a4509a72591de046790978dd947c8579734efee1bc50f068
STEP: List PodSandbox.
May 24 21:03:24.052: INFO: List PodSandbox succeed
[AfterEach] runtime should support basic operations on PodSandbox
  /home/lantaol/workspace/src/github.com/kubernetes-incubator/cri-tools/pkg/validate/pod.go:49
STEP: stop PodSandbox
STEP: delete PodSandbox
[AfterEach] [k8s.io] PodSandbox
  /home/lantaol/workspace/src/github.com/kubernetes-incubator/cri-tools/pkg/framework/framework.go:51
•
Ran 3 of 36 Specs in 1.954 seconds
SUCCESS! -- 3 Passed | 0 Failed | 0 Pending | 33 Skipped PASS
Running Suite: E2ECRI Suite
===========================
Random Seed: 1495659814 - Will randomize all specs
Will run 6 of 36 specs

SSSSSSS
------------------------------
[k8s.io] Image Manager 
  listImage should get exactly 3 image in the result list [Conformance]
  /home/lantaol/workspace/src/github.com/kubernetes-incubator/cri-tools/pkg/validate/image.go:103
[BeforeEach] [k8s.io] Image Manager
  /home/lantaol/workspace/src/github.com/kubernetes-incubator/cri-tools/pkg/framework/framework.go:50
[BeforeEach] [k8s.io] Image Manager
  /home/lantaol/workspace/src/github.com/kubernetes-incubator/cri-tools/pkg/validate/image.go:48
[It] listImage should get exactly 3 image in the result list [Conformance]
  /home/lantaol/workspace/src/github.com/kubernetes-incubator/cri-tools/pkg/validate/image.go:103
STEP: Pull image : busybox:1-uclibc
STEP: Pull image : busybox:1-musl
STEP: Pull image : busybox:1-glibc
STEP: Remove image : busybox:1-uclibc
STEP: Remove image : busybox:1-musl
STEP: Remove image : busybox:1-glibc
[AfterEach] [k8s.io] Image Manager
  /home/lantaol/workspace/src/github.com/kubernetes-incubator/cri-tools/pkg/framework/framework.go:51
•SSSS
------------------------------
[k8s.io] Image Manager 
  image status get image fields should not be empty [Conformance]
  /home/lantaol/workspace/src/github.com/kubernetes-incubator/cri-tools/pkg/validate/image.go:71
[BeforeEach] [k8s.io] Image Manager
  /home/lantaol/workspace/src/github.com/kubernetes-incubator/cri-tools/pkg/framework/framework.go:50
[BeforeEach] [k8s.io] Image Manager
  /home/lantaol/workspace/src/github.com/kubernetes-incubator/cri-tools/pkg/validate/image.go:48
[It] image status get image fields should not be empty [Conformance]
  /home/lantaol/workspace/src/github.com/kubernetes-incubator/cri-tools/pkg/validate/image.go:71
STEP: Pull image : busybox:1.26.2
STEP: Get image status
STEP: Remove image : busybox:1.26.2
[AfterEach] [k8s.io] Image Manager
  /home/lantaol/workspace/src/github.com/kubernetes-incubator/cri-tools/pkg/framework/framework.go:51
•SSSSS
------------------------------
[k8s.io] Image Manager 
  listImage should get exactly 3 repoTags in the result image [Conformance]
  /home/lantaol/workspace/src/github.com/kubernetes-incubator/cri-tools/pkg/validate/image.go:137
[BeforeEach] [k8s.io] Image Manager
  /home/lantaol/workspace/src/github.com/kubernetes-incubator/cri-tools/pkg/framework/framework.go:50
[BeforeEach] [k8s.io] Image Manager
  /home/lantaol/workspace/src/github.com/kubernetes-incubator/cri-tools/pkg/validate/image.go:48
[It] listImage should get exactly 3 repoTags in the result image [Conformance]
  /home/lantaol/workspace/src/github.com/kubernetes-incubator/cri-tools/pkg/validate/image.go:137
STEP: Pull image : busybox:1.26.2-uclibc
STEP: Pull image : busybox:1-uclibc
STEP: Pull image : busybox:1
STEP: Remove image : busybox:1.26.2-uclibc
STEP: Remove image : busybox:1-uclibc
STEP: Remove image : busybox:1
[AfterEach] [k8s.io] Image Manager
  /home/lantaol/workspace/src/github.com/kubernetes-incubator/cri-tools/pkg/framework/framework.go:51
•SSSSSSSSS
------------------------------
[k8s.io] Image Manager 
  public image without tag should be pulled and removed [Conformance]
  /home/lantaol/workspace/src/github.com/kubernetes-incubator/cri-tools/pkg/validate/image.go:56
[BeforeEach] [k8s.io] Image Manager
  /home/lantaol/workspace/src/github.com/kubernetes-incubator/cri-tools/pkg/framework/framework.go:50
[BeforeEach] [k8s.io] Image Manager
  /home/lantaol/workspace/src/github.com/kubernetes-incubator/cri-tools/pkg/validate/image.go:48
[It] public image without tag should be pulled and removed [Conformance]
  /home/lantaol/workspace/src/github.com/kubernetes-incubator/cri-tools/pkg/validate/image.go:56
STEP: Pull image : busybox:latest
STEP: Check image list to make sure pulling image success : busybox:latest
STEP: Get image status
STEP: Remove image : busybox:latest
STEP: Remove image : busybox:latest
STEP: Check image list empty
STEP: Get image status
[AfterEach] [k8s.io] Image Manager
  /home/lantaol/workspace/src/github.com/kubernetes-incubator/cri-tools/pkg/framework/framework.go:51
•SSSSS
------------------------------
[k8s.io] Image Manager 
  public image with tag should be pulled and removed [Conformance]
  /home/lantaol/workspace/src/github.com/kubernetes-incubator/cri-tools/pkg/validate/image.go:52
[BeforeEach] [k8s.io] Image Manager
  /home/lantaol/workspace/src/github.com/kubernetes-incubator/cri-tools/pkg/framework/framework.go:50
[BeforeEach] [k8s.io] Image Manager
  /home/lantaol/workspace/src/github.com/kubernetes-incubator/cri-tools/pkg/validate/image.go:48
[It] public image with tag should be pulled and removed [Conformance]
  /home/lantaol/workspace/src/github.com/kubernetes-incubator/cri-tools/pkg/validate/image.go:52
STEP: Pull image : busybox:1.26.2
STEP: Check image list to make sure pulling image success : busybox:1.26.2
STEP: Get image status
STEP: Remove image : busybox:1.26.2
STEP: Remove image : busybox:1.26.2
STEP: Check image list empty
STEP: Get image status
[AfterEach] [k8s.io] Image Manager
  /home/lantaol/workspace/src/github.com/kubernetes-incubator/cri-tools/pkg/framework/framework.go:51
•
------------------------------
[k8s.io] Image Manager 
  public image with digest should be pulled and removed [Conformance]
  /home/lantaol/workspace/src/github.com/kubernetes-incubator/cri-tools/pkg/validate/image.go:60
[BeforeEach] [k8s.io] Image Manager
  /home/lantaol/workspace/src/github.com/kubernetes-incubator/cri-tools/pkg/framework/framework.go:50
[BeforeEach] [k8s.io] Image Manager
  /home/lantaol/workspace/src/github.com/kubernetes-incubator/cri-tools/pkg/validate/image.go:48
[It] public image with digest should be pulled and removed [Conformance]
  /home/lantaol/workspace/src/github.com/kubernetes-incubator/cri-tools/pkg/validate/image.go:60
STEP: Pull image : busybox@sha256:817a12c32a39bbe394944ba49de563e085f1d3c5266eb8e9723256bc4448680e
STEP: Check image list to make sure pulling image success : busybox@sha256:817a12c32a39bbe394944ba49de563e085f1d3c5266eb8e9723256bc4448680e
STEP: Get image status
STEP: Remove image : busybox@sha256:817a12c32a39bbe394944ba49de563e085f1d3c5266eb8e9723256bc4448680e
STEP: Remove image : busybox@sha256:817a12c32a39bbe394944ba49de563e085f1d3c5266eb8e9723256bc4448680e
STEP: Check image list empty
STEP: Get image status
[AfterEach] [k8s.io] Image Manager
  /home/lantaol/workspace/src/github.com/kubernetes-incubator/cri-tools/pkg/framework/framework.go:51
•
Ran 6 of 36 Specs in 9.367 seconds
SUCCESS! -- 6 Passed | 0 Failed | 0 Pending | 30 Skipped PASS

@Random-Liu Random-Liu force-pushed the apply-sandbox-image-config branch from c6b9ac4 to aa1ffe4 Compare May 24, 2017 21:15
return &uid, ""
}

// getImageMetadata returns corresponding metadata of the image reference, if image is not
Copy link
Member

Choose a reason for hiding this comment

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

pulling the image makes getting metadata for the image expensive... Is there a use case for getting metadata for images that have not yet been pulled for containers?

Copy link
Member Author

Choose a reason for hiding this comment

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

We need to pull image when running pod sandbox.
We may need a better function name here though.

Copy link
Member

Choose a reason for hiding this comment

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

Sure as long as it's clear that this is a variant of an image pull... and not just a metadata retrieval.. that works!

Copy link
Member Author

@Random-Liu Random-Liu May 26, 2017

Choose a reason for hiding this comment

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

Yeah, will update the function name, probably something like ensureImage.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done. Updated the function name to ensureImageExists.

This was referenced May 25, 2017
@Random-Liu Random-Liu force-pushed the apply-sandbox-image-config branch from aa1ffe4 to 33f4f14 Compare May 26, 2017 02:12
Signed-off-by: Lantao Liu <[email protected]>
@Random-Liu Random-Liu force-pushed the apply-sandbox-image-config branch from 33f4f14 to 4f6840c Compare May 27, 2017 00:36
@Random-Liu
Copy link
Member Author

Random-Liu commented May 30, 2017

@mikebrow @yujuhong PR rebased, ready for review.

// ensureImageExists returns corresponding metadata of the image reference, if image is not
// pulled yet, the function will pull the image when ensure is true, and return error when
// ensure if false.
func (c *criContainerdService) ensureImageExists(ctx context.Context, ref string, ensure bool) (*metadata.ImageMetadata, error) {
Copy link
Member

Choose a reason for hiding this comment

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

Can we break it up to two functions instead of relying on ensure to toggle the behavior? I think it's generally preferred making the functions more cohesive and easier to reuse.

You could also factor the logic the logic from 361 to 370 to check whether the image exists or not.

Copy link
Member 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
Member Author

Choose a reason for hiding this comment

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

Done.

if err == nil {
return meta, nil
}
if err != nil && !metadata.IsNotExistError(err) {
Copy link
Member

Choose a reason for hiding this comment

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

Nit: no need to check err != nil because if err is nil, the code would've returned in line 368.

Copy link
Member 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
Member Author

Choose a reason for hiding this comment

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

Done.

@Random-Liu Random-Liu added this to the v0.1.0-rc1 milestone May 30, 2017
@Random-Liu
Copy link
Member Author

@yujuhong Updated localResolve to return image metadata instead so as to simplify the code more and in the meantime address the comment.

@Random-Liu Random-Liu closed this May 31, 2017
@Random-Liu Random-Liu reopened this May 31, 2017
@Random-Liu
Copy link
Member Author

Close and reopen to trigger the test.

@yujuhong
Copy link
Member

LGTM

@Random-Liu Random-Liu force-pushed the apply-sandbox-image-config branch from a087112 to 6eb1ddb Compare May 31, 2017 00:39
@Random-Liu
Copy link
Member Author

Random-Liu commented May 31, 2017

Apply LGTM based on #48 (comment)

Will merge after test passed. It seems that travis is overloaded.

@Random-Liu Random-Liu merged commit 98bc3ed into containerd:master May 31, 2017
@Random-Liu Random-Liu deleted the apply-sandbox-image-config branch May 31, 2017 01:17
Copy link
Member

@mikebrow mikebrow left a comment

Choose a reason for hiding this comment

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

LGTM

lanchongyizu pushed a commit to lanchongyizu/cri-containerd that referenced this pull request Sep 3, 2017
adelina-t pushed a commit to adelina-t/cri that referenced this pull request Nov 1, 2019
Remove automange-vhd's on ContainerCreate failure
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants