Show runtime handler in sandbox debug info.

Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
Lantao Liu 2018-09-16 21:27:51 -07:00
parent e402ae2f02
commit 4b45e16a4b
4 changed files with 20 additions and 16 deletions

View File

@ -113,7 +113,6 @@ type containerInfo struct {
} }
// toCRIContainerInfo converts internal container object information to CRI container status response info map. // toCRIContainerInfo converts internal container object information to CRI container status response info map.
// TODO(random-liu): Return error instead of logging.
func toCRIContainerInfo(ctx context.Context, container containerstore.Container, verbose bool) (map[string]string, error) { func toCRIContainerInfo(ctx context.Context, container containerstore.Container, verbose bool) (map[string]string, error) {
if !verbose { if !verbose {
return nil, nil return nil, nil

View File

@ -74,9 +74,10 @@ func (c *criService) RunPodSandbox(ctx context.Context, r *runtime.RunPodSandbox
// Create initial internal sandbox object. // Create initial internal sandbox object.
sandbox := sandboxstore.NewSandbox( sandbox := sandboxstore.NewSandbox(
sandboxstore.Metadata{ sandboxstore.Metadata{
ID: id, ID: id,
Name: name, Name: name,
Config: config, Config: config,
RuntimeHandler: r.GetRuntimeHandler(),
}, },
sandboxstore.Status{ sandboxstore.Status{
State: sandboxstore.StateUnknown, State: sandboxstore.StateUnknown,

View File

@ -102,15 +102,16 @@ func toCRISandboxStatus(meta sandboxstore.Metadata, status sandboxstore.Status,
// TODO (mikebrow): discuss predefining constants structures for some or all of these field names in CRI // TODO (mikebrow): discuss predefining constants structures for some or all of these field names in CRI
type sandboxInfo struct { type sandboxInfo struct {
Pid uint32 `json:"pid"` Pid uint32 `json:"pid"`
Status string `json:"processStatus"` Status string `json:"processStatus"`
NetNSClosed bool `json:"netNamespaceClosed"` NetNSClosed bool `json:"netNamespaceClosed"`
Image string `json:"image"` Image string `json:"image"`
SnapshotKey string `json:"snapshotKey"` SnapshotKey string `json:"snapshotKey"`
Snapshotter string `json:"snapshotter"` Snapshotter string `json:"snapshotter"`
Runtime *criconfig.Runtime `json:"runtime"` RuntimeHandler string `json:"runtimeHandler"`
Config *runtime.PodSandboxConfig `json:"config"` Runtime *criconfig.Runtime `json:"runtime"`
RuntimeSpec *runtimespec.Spec `json:"runtimeSpec"` Config *runtime.PodSandboxConfig `json:"config"`
RuntimeSpec *runtimespec.Spec `json:"runtimeSpec"`
} }
// toCRISandboxInfo converts internal container object information to CRI sandbox status response info map. // toCRISandboxInfo converts internal container object information to CRI sandbox status response info map.
@ -132,9 +133,10 @@ func toCRISandboxInfo(ctx context.Context, sandbox sandboxstore.Sandbox) (map[st
} }
si := &sandboxInfo{ si := &sandboxInfo{
Pid: sandbox.Status.Get().Pid, Pid: sandbox.Status.Get().Pid,
Status: string(processStatus), RuntimeHandler: sandbox.RuntimeHandler,
Config: sandbox.Config, Status: string(processStatus),
Config: sandbox.Config,
} }
if si.Status == "" { if si.Status == "" {

View File

@ -54,6 +54,8 @@ type Metadata struct {
NetNSPath string NetNSPath string
// IP of Pod if it is attached to non host network // IP of Pod if it is attached to non host network
IP string IP string
// RuntimeHandler is the runtime handler name of the pod.
RuntimeHandler string
} }
// MarshalJSON encodes Metadata into bytes in json format. // MarshalJSON encodes Metadata into bytes in json format.