Retrieve sandbox creation time from store.
All pause container object references must be removed from sbserver. This is an implementation detail of podsandbox package. Added TODOs for remaining work. Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
This commit is contained in:
parent
4b32819823
commit
3ddaa34445
@ -45,12 +45,13 @@ func (c *criService) PodSandboxStatus(ctx context.Context, r *runtime.PodSandbox
|
|||||||
status := toCRISandboxStatus(sandbox.Metadata, sandbox.Status.Get(), ip, additionalIPs)
|
status := toCRISandboxStatus(sandbox.Metadata, sandbox.Status.Get(), ip, additionalIPs)
|
||||||
if status.GetCreatedAt() == 0 {
|
if status.GetCreatedAt() == 0 {
|
||||||
// CRI doesn't allow CreatedAt == 0.
|
// CRI doesn't allow CreatedAt == 0.
|
||||||
info, err := sandbox.Container.Info(ctx)
|
sandboxInfo, err := c.client.SandboxStore().Get(ctx, r.GetPodSandboxId())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to get CreatedAt for sandbox container in %q state: %w", status.State, err)
|
return nil, fmt.Errorf("failed to get sandbox %q from metadata store: %w", r.GetPodSandboxId(), err)
|
||||||
}
|
}
|
||||||
status.CreatedAt = info.CreatedAt.UnixNano()
|
status.CreatedAt = sandboxInfo.CreatedAt.UnixNano()
|
||||||
}
|
}
|
||||||
|
|
||||||
if !r.GetVerbose() {
|
if !r.GetVerbose() {
|
||||||
return &runtime.PodSandboxStatusResponse{Status: status}, nil
|
return &runtime.PodSandboxStatusResponse{Status: status}, nil
|
||||||
}
|
}
|
||||||
@ -76,10 +77,15 @@ func (c *criService) getIPs(sandbox sandboxstore.Sandbox) (string, []string, err
|
|||||||
// responsible for reporting the IP.
|
// responsible for reporting the IP.
|
||||||
return "", nil, nil
|
return "", nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if goruntime.GOOS == "windows" && config.GetWindows().GetSecurityContext().GetHostProcess() {
|
if goruntime.GOOS == "windows" && config.GetWindows().GetSecurityContext().GetHostProcess() {
|
||||||
return "", nil, nil
|
return "", nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if goruntime.GOOS == "darwin" {
|
||||||
|
return "", nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
if closed, err := sandbox.NetNS.Closed(); err != nil {
|
if closed, err := sandbox.NetNS.Closed(); err != nil {
|
||||||
return "", nil, fmt.Errorf("check network namespace closed: %w", err)
|
return "", nil, fmt.Errorf("check network namespace closed: %w", err)
|
||||||
} else if closed {
|
} else if closed {
|
||||||
|
Loading…
Reference in New Issue
Block a user