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

adding verbose debug output for inspect & inspects #206

Merged
merged 3 commits into from
Dec 4, 2017

Conversation

mikebrow
Copy link
Contributor

@mikebrow mikebrow commented Nov 29, 2017

See kubernetes/kubernetes#53965

Changes inspect (container) and inspects (sandbox) to be verbose by default, and using json format by default per discussion below.

Verbose is a new option for the subject status requests afforded by the CRI api.

I've also added "quiet" options to the these two inspect(s) in case someone does not want verbose, and to otherwise exercise the non verbose status requests.

Signed-off-by: Mike Brown brownwm@us.ibm.com

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Nov 29, 2017
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Nov 29, 2017
@Random-Liu
Copy link
Contributor

Random-Liu commented Nov 29, 2017

Take a look at https://github.com/kubernetes-incubator/cri-tools/blob/master/cmd/crictl/info.go
We should generate similar output, basically json/yaml of status+info.

@mikebrow
Copy link
Contributor Author

Look at https://github.com/kubernetes-incubator/cri-tools/blob/master/cmd/crictl/info.go
We should generate similar output.

It does..

@Random-Liu Random-Liu self-assigned this Nov 29, 2017
@@ -221,6 +221,10 @@ var containerStatusCommand = cli.Command{
Name: "output, o",
Usage: "Output format, One of: json|yaml|table",
},
cli.BoolFlag{
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 for inspect, we should always set verbose=true in crictl.
verbose=false is for kubelet using CRI.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Random-Liu so you are saying you want a --quiet option for less verbose? or take out the option all-together? There were already other verbose flags so I figured that's what we would want with this verbose option.

Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like by default we should enable verbose, or else it's really troublesome to do -v every time. :)

As for whether we need a quiet option, I'm not sure.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Random-Liu I hear ya.. think it over no rush, easy enough to switch it to verbose by default, or quiet mode option. But I think when you see the verbose mode from the CRI-O team you'll be begging to turn down the volume :-) @runcom

Copy link
Contributor

Choose a reason for hiding this comment

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

? Not following, what about CRI-O? We aren't even using that verbose stuff and we have no plan to output anything.
In any case, I'm in favor of going verbose by default like Lantao

Copy link
Member

Choose a reason for hiding this comment

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

+1 of enabling verbose.

Copy link
Contributor Author

@mikebrow mikebrow Nov 30, 2017

Choose a reason for hiding this comment

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

I was just making light of the amount of metadata CRI-O keeps around that could possibly used in a verbose output of status about the container, thus the smiley face :-)

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah but that's exactly the verbose intention, despite what runtimes want to output

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 vote inspect to be verbose by default for crictl (and provide a silent flag to turn verbose off).
I vote to make the json format the default (and I don't care if you want to kill the table format or keep it as an option).

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..

@@ -221,6 +221,10 @@ var containerStatusCommand = cli.Command{
Name: "output, o",
Usage: "Output format, One of: json|yaml|table",
Copy link
Contributor

@Random-Liu Random-Liu Nov 29, 2017

Choose a reason for hiding this comment

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

@feiskyer @mrunalp @runcom @mikebrow Do you still think we should have the table format?
I think for inspect, we may just need json|yaml. Just like crictl info. See an example here
The problem is that timestamp in CRI is unix timestamp, we may want to do a conversion in crictl.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not a big fan of table, let's drop it in favor of machine readable output

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'm not a big fan of table formats either, but as @Random-Liu says the unix timestamp is not human readable output:

crictl --runtime-endpoint /var/run/cri-containerd.sock inspect -v -o json 44025055b48da66cb67bfc221f800fe50f1256d3e22f1cf714294344b29d582e 
{
  "status": {
    "id": "44025055b48da66cb67bfc221f800fe50f1256d3e22f1cf714294344b29d582e",
    "metadata": {
      "name": "busybox",
      "attempt": 0
    },
    "state": "CONTAINER_CREATED",
    "createdAt": "1511994785429097447",
    "startedAt": "0",
    "finishedAt": "0",
    "exitCode": 0,
    "image": {
      "image": "docker.io/library/busybox:latest"
    },
    "imageRef": "docker.io/library/busybox@sha256:bbc3a03235220b170ba48a157dd097dd1379299370e1ed99ce976df0355d24f0",
    "reason": "",
    "message": "",
    "logPath": ""
  },

vs:

crictl --runtime-endpoint /var/run/cri-containerd.sock inspect -v 44025055b48da66cb67bfc221f800fe50f1256d3e22f1cf714294344b29d582e 
ID: 44025055b48da66cb67bfc221f800fe50f1256d3e22f1cf714294344b29d582e
Name: busybox
State: CONTAINER_CREATED
Created: 28 minutes ago

Copy link
Contributor

Choose a reason for hiding this comment

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

We can do some conversion there, not a big deal

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, we should do some conversion. :)

Copy link
Member

Choose a reason for hiding this comment

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

Agreed, table is not useful for inspect.

Copy link
Contributor Author

@mikebrow mikebrow Dec 1, 2017

Choose a reason for hiding this comment

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

so.. @Random-Liu @runcom @feiskyer wrt. "some conversion"
I suggest converting the timestamps to RFC3339Nano
"2006-01-02T15:04:05.999999999Z07:00"
Thoughts?

Signed-off-by: Mike Brown <brownwm@us.ibm.com>
@mikebrow
Copy link
Contributor Author

mikebrow commented Dec 1, 2017

Ok I've changed inspect to use json format by default, made the default output verbose, and introduced a quiet flag just because. @Random-Liu @runcom @feiskyer

Signed-off-by: Mike Brown <brownwm@us.ibm.com>
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Dec 1, 2017
@mikebrow
Copy link
Contributor Author

mikebrow commented Dec 1, 2017

I've added a new commit for the inspects (sandbox inspect) changes.

@mikebrow mikebrow changed the title adding verbose output switch for inspect adding verbose debug output for inspect & inspects Dec 1, 2017
@Random-Liu
Copy link
Contributor

/lgtm

I think we don't need the table output, but let's keep it for now in case that someone may like it.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Dec 4, 2017
Signed-off-by: Mike Brown <brownwm@us.ibm.com>
@Random-Liu Random-Liu merged commit 6462875 into kubernetes-sigs:master Dec 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants