Skip to content

Commit 29e8539

Browse files
authored
Merge pull request #3301 from harche/retry_pid
Request the pid of another container if current pid is not longer valid
2 parents 4bed263 + 409a493 commit 29e8539

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

container/crio/handler.go

+11-5
Original file line numberDiff line numberDiff line change
@@ -305,14 +305,20 @@ func (h *crioContainerHandler) GetStats() (*info.ContainerStats, error) {
305305
if err != nil {
306306
return stats, err
307307
}
308-
// Clean up stats for containers that don't have their own network - this
309-
// includes containers running in Kubernetes pods that use the network of the
310-
// infrastructure container. This stops metrics being reported multiple times
311-
// for each container in a pod.
308+
312309
if !h.needNet() {
310+
// Clean up stats for containers that don't have their own network - this
311+
// includes containers running in Kubernetes pods that use the network of the
312+
// infrastructure container. This stops metrics being reported multiple times
313+
// for each container in a pod.
313314
stats.Network = info.NetworkStats{}
315+
} else if len(stats.Network.Interfaces) == 0 {
316+
// No network related information indicates that the pid of the
317+
// container is not longer valid and we need to ask crio to
318+
// provide the pid of another container from that pod
319+
h.pidKnown = false
320+
return stats, nil
314321
}
315-
316322
// Get filesystem stats.
317323
err = h.getFsStats(stats)
318324
if err != nil {

0 commit comments

Comments
 (0)