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

feature: implement ContainerStatus and PodSandboxStatus of cri manager #573

Merged

Conversation

YaoZengzeng
Copy link
Contributor

Signed-off-by: YaoZengzeng [email protected]

1.Describe what this PR did

2.Does this pull request fix one issue?

fixes part of #420

3.Describe how you did it

4.Describe how to verify it

Maybe the cri-tools is what you need.

We may use the following method to verify that we can get status of sandboxes and containers:

// Now we must ensure the sandbox image has already exists.
[root@pouch-test cri-tools]# pouch pull k8s.gcr.io/pause-amd64:3.0
[root@pouch-test cri-tools]# cat sandbox-config.json
{
    "metadata": {
        "name": "nginx-sandbox",
        "namespace": "default",
        "attempt": 1,
        "uid": "hdishd83djaidwnduwk28bcsb"
    },
    "linux": {
    }
}
[root@pouch-test cri-tools]# crictl runs sandbox-config.json
6ca39d7986fce58e7fd7fabe17e4acf7e5220ed82deca119fe40218ef6803cc4
[root@pouch-test cri-tools]# crictl inspects 6ca39d7986fce58e7fd7fabe17e4acf7e5220ed82deca119fe40218ef6803cc4
{
  "status": {
    "id": "6ca39d7986fce58e7fd7fabe17e4acf7e5220ed82deca119fe40218ef6803cc4",
    "metadata": {
      "attempt": 1,
      "name": "nginx-sandbox",
      "namespace": "default",
      "uid": "hdishd83djaidwnduwk28bcsb"
    },
    "state": "SANDBOX_NOTREADY",
    "createdAt": "2018-01-12T07:52:38.529798965Z",
    "network": null,
    "linux": null,
    "labels": null,
    "annotations": null
  }
}
[root@pouch-test cri-tools]# cat container-config.json 
{
  "metadata": {
      "name": "busybox"
  },
  "image":{
      "image": "docker.io/library/busybox:latest"
  },
  "command": [
      "top"
  ],
  "linux": {
  }
}
[root@pouch-test cri-tools]# crictl create 6ca39d7986fce58e7fd7fabe17e4acf7e5220ed82deca119fe40218ef6803cc4 container-config.json sandbox-config.json
2b1ae5026fc784bd33f17680b39fa7aea2c68b22cb6bdbf2b74ac7172736ef34
[root@pouch-test cri-tools]# crictl inspect 2b1ae5026fc784bd33f17680b39fa7aea2c68b22cb6bdbf2b74ac7172736ef34
{
  "status": {
    "id": "2b1ae5026fc784bd33f17680b39fa7aea2c68b22cb6bdbf2b74ac7172736ef34",
    "metadata": {
      "attempt": 0,
      "name": "busybox"
    },
    "state": "CONTAINER_CREATED",
    "createdAt": "2018-01-12T07:53:07.935952223Z",
    "startedAt": "1970-01-01T00:00:00Z",
    "finishedAt": "1970-01-01T00:00:00Z",
    "exitCode": 0,
    "image": {
      "image": "docker.io/library/busybox:latest"
    },
    "imageRef": "docker.io/library/busybox:latest",
    "reason": "",
    "message": "",
    "labels": null,
    "annotations": null,
    "mounts": null,
    "logPath": ""
  }
}

5.Special notes for reviews

@YaoZengzeng
Copy link
Contributor Author

@allencloud PTAL.

@YaoZengzeng YaoZengzeng force-pushed the sandbox-container-status branch from a2d7eb5 to 19aba92 Compare January 12, 2018 08:14
@codecov-io
Copy link

codecov-io commented Jan 12, 2018

Codecov Report

Merging #573 into master will decrease coverage by 0.24%.
The diff coverage is 5.31%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #573      +/-   ##
==========================================
- Coverage   14.16%   13.92%   -0.25%     
==========================================
  Files          64       64              
  Lines        3226     3318      +92     
==========================================
+ Hits          457      462       +5     
- Misses       2722     2808      +86     
- Partials       47       48       +1
Impacted Files Coverage Δ
daemon/mgr/cri.go 0% <0%> (ø) ⬆️
daemon/mgr/cri_utils.go 42.37% <71.42%> (+1.19%) ⬆️

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 c93b953...19aba92. Read the comment docs.

@allencloud
Copy link
Collaborator

Do we add test case in critools? @YaoZengzeng

@YaoZengzeng
Copy link
Contributor Author

@allencloud It's ok for pouch to pass all the basic sandbox and container operation test in cri-tools if the image is ready.

So please to merge this one 😄

@@ -25,6 +25,22 @@ func TestParseUint32(t *testing.T) {
}
}

func TestToCriTimestamp(t *testing.T) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add some unit test cases to those returning a non-nil cases.
Maybe in a follow-up.

@allencloud
Copy link
Collaborator

LGTM

@pouchrobot pouchrobot added the LGTM one maintainer or community participant agrees to merge the pull reuqest. label Jan 17, 2018
@allencloud allencloud merged commit f88271c into AliyunContainerService:master Jan 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature LGTM one maintainer or community participant agrees to merge the pull reuqest. size/XL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants