*: store sandbox IP
Don't call into net namespace on every status call Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
parent
8538c4067a
commit
5d637f015d
5 changed files with 30 additions and 18 deletions
|
@ -18,16 +18,6 @@ func (s *Server) PodSandboxStatus(ctx context.Context, req *pb.PodSandboxStatusR
|
|||
podInfraContainer := sb.InfraContainer()
|
||||
cState := s.Runtime().ContainerStatus(podInfraContainer)
|
||||
|
||||
netNsPath, err := podInfraContainer.NetNsPath()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ip, err := s.netPlugin.GetContainerNetworkStatus(netNsPath, sb.Namespace(), sb.KubeName(), sb.ID())
|
||||
if err != nil {
|
||||
// ignore the error on network status
|
||||
ip = ""
|
||||
}
|
||||
|
||||
rStatus := pb.PodSandboxState_SANDBOX_NOTREADY
|
||||
if cState.Status == oci.ContainerStateRunning {
|
||||
rStatus = pb.PodSandboxState_SANDBOX_READY
|
||||
|
@ -38,7 +28,7 @@ func (s *Server) PodSandboxStatus(ctx context.Context, req *pb.PodSandboxStatusR
|
|||
Status: &pb.PodSandboxStatus{
|
||||
Id: sandboxID,
|
||||
CreatedAt: podInfraContainer.CreatedAt().UnixNano(),
|
||||
Network: &pb.PodSandboxNetworkStatus{Ip: ip},
|
||||
Network: &pb.PodSandboxNetworkStatus{Ip: sb.IP()},
|
||||
State: rStatus,
|
||||
Labels: sb.Labels(),
|
||||
Annotations: sb.Annotations(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue