Fix spammy CNI log.
Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
parent
0c1839047c
commit
73c2cb5632
@ -85,6 +85,11 @@ func (c *criContainerdService) getIP(sandbox sandboxstore.Sandbox) (string, erro
|
|||||||
return "", nil
|
return "", nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The network namespace has been closed.
|
||||||
|
if sandbox.NetNS == nil || sandbox.NetNS.Closed() {
|
||||||
|
return "", nil
|
||||||
|
}
|
||||||
|
|
||||||
podNetwork := ocicni.PodNetwork{
|
podNetwork := ocicni.PodNetwork{
|
||||||
Name: config.GetMetadata().GetName(),
|
Name: config.GetMetadata().GetName(),
|
||||||
Namespace: config.GetMetadata().GetNamespace(),
|
Namespace: config.GetMetadata().GetNamespace(),
|
||||||
|
@ -111,6 +111,13 @@ func (n *NetNS) Remove() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Closed checks whether the network namespace has been closed.
|
||||||
|
func (n *NetNS) Closed() bool {
|
||||||
|
n.Lock()
|
||||||
|
defer n.Unlock()
|
||||||
|
return n.closed
|
||||||
|
}
|
||||||
|
|
||||||
// GetPath returns network namespace path for sandbox container
|
// GetPath returns network namespace path for sandbox container
|
||||||
func (n *NetNS) GetPath() string {
|
func (n *NetNS) GetPath() string {
|
||||||
n.Lock()
|
n.Lock()
|
||||||
|
Loading…
Reference in New Issue
Block a user