mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-08 06:15:45 +00:00
Automatic merge from submit-queue (batch tested with PRs 67100, 67426). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. should check all error in ResourceCollector.Start() Signed-off-by: yanxuean <yan.xuean@zte.com.cn> **What this PR does / why we need it**: 1. We should check both errors. test/e2e_node/resource_collector.go ``` func (r *ResourceCollector) Start() { // Get the cgroup container names for kubelet and runtime kubeletContainer, err := getContainerNameForProcess(kubeletProcessName, "") runtimeContainer, err := getContainerNameForProcess(framework.TestContext.ContainerRuntimeProcessName, framework.TestContext.ContainerRuntimePidFile) if err == nil { systemContainers = map[string]string{ stats.SystemContainerKubelet: kubeletContainer, stats.SystemContainerRuntime: runtimeContainer, } } ``` 2. redundant compare The Timestamp.Equal is unlikely to occur, because we have met Timestamp.Before. ``` if oldStats, ok := oldStatsMap[name]; ok && oldStats.Timestamp.Before(newStats.Timestamp) { if oldStats.Timestamp.Equal(newStats.Timestamp) { continue } r.buffers[name] = append(r.buffers[name], computeContainerResourceUsage(name, oldStats, newStats)) } ``` **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes # **Special notes for your reviewer**: **Release note**: ```release-note NONE ``` /sig-node