Skip to content

Commit

Permalink
Merge branch 'tke/v1.20.6' into 'tke/v1.20.6' (merge request !480)
Browse files Browse the repository at this point in the history
移植upstream对kubelet及cadvisor的修改,修复使用cgroupv2时指标收集统计的问题
1. port cadvisor pr google/cadvisor#2839 reading cpu stats on cgroup v2
2. port cadvisor pr google/cadvisor#2837 read "max" value for cgroup v2
3. port cadvisor pr google/cadvisor#2801 gathering of stats for root cgroup on v2
4. port cadvisor pr google/cadvisor#2800: Update heuristic for container creation time
5. Fix cgroup handling for systemd with cgroup v2
6. test: adjust summary test for cgroup v2
  • Loading branch information
borgerli committed Jul 15, 2021
2 parents af19637 + 4d24cc7 commit 75b8cf9
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 52 deletions.
2 changes: 1 addition & 1 deletion pkg/kubelet/cm/cgroup_manager_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ func (m *cgroupManagerImpl) Update(cgroupConfig *CgroupConfig) error {

unified := libcontainercgroups.IsCgroup2UnifiedMode()
if unified {
libcontainerCgroupConfig.Path = cgroupConfig.Name.ToCgroupfs()
libcontainerCgroupConfig.Path = m.Name(cgroupConfig.Name)
} else {
libcontainerCgroupConfig.Paths = m.buildCgroupPaths(cgroupConfig.Name)
}
Expand Down
7 changes: 6 additions & 1 deletion test/e2e_node/summary_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ var _ = framework.KubeDescribe("Summary API [NodeConformance]", func() {
"UserDefinedMetrics": gomega.BeEmpty(),
})
}
expectedMajorPageFaultsUpperBound := 10
if IsCgroup2UnifiedMode() {
expectedMajorPageFaultsUpperBound = 1000
}

podsContExpectations := sysContExpectations().(*gstruct.FieldsMatcher)
podsContExpectations.Fields["Memory"] = ptrMatchAllFields(gstruct.Fields{
"Time": recent(maxStatsAge),
Expand All @@ -123,7 +128,7 @@ var _ = framework.KubeDescribe("Summary API [NodeConformance]", func() {
"WorkingSetBytes": bounded(10*e2evolume.Kb, memoryLimit),
"RSSBytes": bounded(1*e2evolume.Kb, memoryLimit),
"PageFaults": bounded(0, 1000000),
"MajorPageFaults": bounded(0, 10),
"MajorPageFaults": bounded(0, expectedMajorPageFaultsUpperBound),
})
runtimeContExpectations := sysContExpectations().(*gstruct.FieldsMatcher)
if systemdutil.IsRunningSystemd() && framework.TestContext.ContainerRuntime == "docker" {
Expand Down
141 changes: 100 additions & 41 deletions vendor/github.com/google/cadvisor/container/common/helpers.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 75b8cf9

Please sign in to comment.