From 26dbbdb244ed376eac5629f15c3c3f81942f3376 Mon Sep 17 00:00:00 2001 From: derekwaynecarr Date: Mon, 7 Mar 2016 13:33:40 -0500 Subject: [PATCH] kubelet stats should ignore .mount cgroups associated with container on systemd --- pkg/kubelet/server/stats/summary.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/kubelet/server/stats/summary.go b/pkg/kubelet/server/stats/summary.go index 6098c81bc7e..a288e7c7e29 100644 --- a/pkg/kubelet/server/stats/summary.go +++ b/pkg/kubelet/server/stats/summary.go @@ -19,6 +19,7 @@ package stats import ( "fmt" "runtime" + "strings" "time" "k8s.io/kubernetes/pkg/api" @@ -184,7 +185,13 @@ func (sb *summaryBuilder) latestContainerStats(info *cadvisorapiv2.ContainerInfo func (sb *summaryBuilder) buildSummaryPods() []stats.PodStats { // Map each container to a pod and update the PodStats with container data podToStats := map[stats.PodReference]*stats.PodStats{} - for _, cinfo := range sb.infos { + for key, cinfo := range sb.infos { + // on systemd using devicemapper each mount into the container has an associated cgroup. + // we ignore them to ensure we do not get duplicate entries in our summary. + // for details on .mount units: http://man7.org/linux/man-pages/man5/systemd.mount.5.html + if strings.HasSuffix(key, ".mount") { + continue + } // Build the Pod key if this container is managed by a Pod if !sb.isPodManagedContainer(&cinfo) { continue