-
Notifications
You must be signed in to change notification settings - Fork 349
adding info map for verbose pod status #452
Conversation
verbose sand box inspect output:
|
Can be tested via the changes here: |
Build error:
|
Signed-off-by: Mike Brown <brownwm@us.ibm.com>
@miaoyq yeah was in the middle of rebasing and correcting... pushed the merge first :-) All fixes in. Updated to reflect the changes made in the other debug PRs. Should've tagged it WIP.. ready for review now! |
Updated example output:
|
return &runtime.PodSandboxStatusResponse{Status: status}, nil | ||
info, err := toCRISandboxContainerInfo(ctx, sandbox.Container, r.GetVerbose()) | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to get verbose sandbox container info: %v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we log the error and Include it into info
instead of return directly?
Even if the error is not nil, we should return status information and indicate the cause of the error in info.
Also #470, :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docker do it like this:
# docker inspect ec
[
{
"Id": "ec864d7a574eef3958a142944d37f764617ea8d2c994d0012a6e45ed31ab0a5e",
"Created": "2017-12-06T03:43:34.739382517Z",
"Path": "top-dfsaf",
"Args": [],
"State": {
"Status": "created",
"Running": false,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 0,
"ExitCode": 127,
// "Error" indicates the reason of the error
"Error": "oci runtime error: container_linux.go:247: starting container process caused \"exec: \\\"top-dfsaf\\\": executable file not found in $PATH\"\n",
"StartedAt": "0001-01-01T00:00:00Z",
"FinishedAt": "0001-01-01T00:00:00Z"
},
... ...
We can include this in info
, wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we log the error and Include it into info instead of return directly?
Even if the error is not nil, we should return status information and indicate the cause of the error in info.
Currently there is no way to include the error message, but I agree we should not fail in most cases. We should do something similar with https://github.com/kubernetes-incubator/cri-containerd/pull/475/files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docker do it like this
We've included most of the information for container status. We just don't save information for sandbox container. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah probably don't need it for the sandbox pause container... but will need to comb over the inspect for containers to make sure we're not missing anything useful.
return nil, nil | ||
} | ||
|
||
task, err := container.Task(ctx, nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've got task status in PodSandboxStatus
, we should pass it in.
if err == nil { | ||
info["info"] = string(m) | ||
} else { | ||
glog.Errorf("failed to marshal info %v: %v", si, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still think fail to marshal is a logic issue, we should return error and fail loudly instead of hiding the failure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
depends who's calling and what they can do with the error. I think the important thing is to make sure the errors are displayed and since it's extra info I didn't want this extra verbose info to be the reason for someone's cluster failing... So I'm torn on which way to go.
Pid: pid, | ||
State: string(status.Status), | ||
SnapshotKey: snapshotkey, | ||
Snapshotter: snapshotter, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should include sandbox config, network namespace.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree.. was tired when I did the sandbox one
return &runtime.PodSandboxStatusResponse{Status: status}, nil | ||
info, err := toCRISandboxContainerInfo(ctx, sandbox.Container, r.GetVerbose()) | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to get verbose sandbox container info: %v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we log the error and Include it into info instead of return directly?
Even if the error is not nil, we should return status information and indicate the cause of the error in info.
Currently there is no way to include the error message, but I agree we should not fail in most cases. We should do something similar with https://github.com/kubernetes-incubator/cri-containerd/pull/475/files.
return &runtime.PodSandboxStatusResponse{Status: status}, nil | ||
info, err := toCRISandboxContainerInfo(ctx, sandbox.Container, r.GetVerbose()) | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to get verbose sandbox container info: %v", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docker do it like this
We've included most of the information for container status. We just don't save information for sandbox container. :)
/lgtm LGTM overall. I'll merge this and send another PR to address the comments I mentioned above. |
#359
Commit 1: adds verbose info to pod status request
So far the additional info provided is the verbose "container" status.
There's a lot of good stuff already in the pod status response struct.
Commit 1: also adds sandboxID to the container status to allow for back tracking from the container to the pod sandbox.
Commit 2: fixes the pid reported by container status.
Signed-off-by: Mike Brown brownwm@us.ibm.com