mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Work around heapster panic.
This commit is contained in:
parent
9feabbdaeb
commit
b037be6c19
@ -22,6 +22,7 @@ go_library(
|
||||
"//pkg/kubelet/server/stats:go_default_library",
|
||||
"//pkg/kubelet/types:go_default_library",
|
||||
"//vendor/github.com/golang/glog:go_default_library",
|
||||
"//vendor/github.com/golang/protobuf/proto:go_default_library",
|
||||
"//vendor/github.com/google/cadvisor/fs:go_default_library",
|
||||
"//vendor/github.com/google/cadvisor/info/v1:go_default_library",
|
||||
"//vendor/github.com/google/cadvisor/info/v2:go_default_library",
|
||||
|
@ -21,6 +21,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"github.com/golang/protobuf/proto"
|
||||
cadvisorfs "github.com/google/cadvisor/fs"
|
||||
|
||||
cadvisorapiv2 "github.com/google/cadvisor/info/v2"
|
||||
@ -221,9 +222,15 @@ func (p *criStatsProvider) makeContainerStats(
|
||||
Name: stats.Attributes.Metadata.Name,
|
||||
// The StartTime in the summary API is the container creation time.
|
||||
StartTime: metav1.NewTime(time.Unix(0, container.CreatedAt)),
|
||||
CPU: &statsapi.CPUStats{},
|
||||
Memory: &statsapi.MemoryStats{},
|
||||
Rootfs: &statsapi.FsStats{},
|
||||
// Work around heapster bug. https://github.com/kubernetes/kubernetes/issues/54962
|
||||
// TODO(random-liu): Remove this after heapster is updated to newer than 1.5.0-beta.0.
|
||||
CPU: &statsapi.CPUStats{
|
||||
UsageNanoCores: proto.Uint64(0),
|
||||
},
|
||||
Memory: &statsapi.MemoryStats{
|
||||
RSSBytes: proto.Uint64(0),
|
||||
},
|
||||
Rootfs: &statsapi.FsStats{},
|
||||
Logs: &statsapi.FsStats{
|
||||
Time: metav1.NewTime(rootFsInfo.Timestamp),
|
||||
AvailableBytes: &rootFsInfo.Available,
|
||||
|
@ -235,13 +235,13 @@ func makeFakeImageFsUsage(fsUUID string) *runtimeapi.FilesystemUsage {
|
||||
func checkCRICPUAndMemoryStats(assert *assert.Assertions, actual statsapi.ContainerStats, cs *runtimeapi.ContainerStats) {
|
||||
assert.Equal(cs.Cpu.Timestamp, actual.CPU.Time.UnixNano())
|
||||
assert.Equal(cs.Cpu.UsageCoreNanoSeconds.Value, *actual.CPU.UsageCoreNanoSeconds)
|
||||
assert.Nil(actual.CPU.UsageNanoCores)
|
||||
assert.Zero(*actual.CPU.UsageNanoCores)
|
||||
|
||||
assert.Equal(cs.Memory.Timestamp, actual.Memory.Time.UnixNano())
|
||||
assert.Nil(actual.Memory.AvailableBytes)
|
||||
assert.Nil(actual.Memory.UsageBytes)
|
||||
assert.Equal(cs.Memory.WorkingSetBytes.Value, *actual.Memory.WorkingSetBytes)
|
||||
assert.Nil(actual.Memory.RSSBytes)
|
||||
assert.Zero(*actual.Memory.RSSBytes)
|
||||
assert.Nil(actual.Memory.PageFaults)
|
||||
assert.Nil(actual.Memory.MajorPageFaults)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user