Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automated cherry pick of #24015 #24003 #24205 #24227

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions pkg/kubelet/api/v1alpha1/stats/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ type MemoryStats struct {
// The amount of working set memory. This includes recently accessed memory,
// dirty memory, and kernel memory. UsageBytes is <= TotalBytes.
WorkingSetBytes *uint64 `json:"workingSetBytes,omitempty"`
// The amount of anonymous and swap cache memory (includes transparent
// hugepages).
RSSBytes *uint64 `json:"rssBytes,omitempty"`
// Cumulative number of minor page faults.
PageFaults *uint64 `json:"pageFaults,omitempty"`
// Cumulative number of major page faults.
Expand Down
1 change: 1 addition & 0 deletions pkg/kubelet/server/stats/summary.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ func (sb *summaryBuilder) containerInfoV2ToStats(
Time: unversioned.NewTime(cstat.Timestamp),
UsageBytes: &cstat.Memory.Usage,
WorkingSetBytes: &cstat.Memory.WorkingSet,
RSSBytes: &cstat.Memory.RSS,
PageFaults: &pageFaults,
MajorPageFaults: &majorPageFaults,
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/kubelet/server/stats/summary_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const (
offsetMemPageFaults
offsetMemMajorPageFaults
offsetMemUsageBytes
offsetMemRSSBytes
offsetMemWorkingSetBytes
offsetNetRxBytes
offsetNetRxErrors
Expand Down Expand Up @@ -258,6 +259,7 @@ func summaryTestContainerInfo(seed int, podName string, podNamespace string, con
Memory: &v1.MemoryStats{
Usage: uint64(seed + offsetMemUsageBytes),
WorkingSet: uint64(seed + offsetMemWorkingSetBytes),
RSS: uint64(seed + offsetMemRSSBytes),
ContainerData: v1.MemoryStatsMemoryData{
Pgfault: uint64(seed + offsetMemPageFaults),
Pgmajfault: uint64(seed + offsetMemMajorPageFaults),
Expand Down Expand Up @@ -310,6 +312,7 @@ func checkMemoryStats(t *testing.T, label string, seed int, stats *kubestats.Mem
assert.EqualValues(t, testTime(timestamp, seed).Unix(), stats.Time.Time.Unix(), label+".Mem.Time")
assert.EqualValues(t, seed+offsetMemUsageBytes, *stats.UsageBytes, label+".Mem.UsageBytes")
assert.EqualValues(t, seed+offsetMemWorkingSetBytes, *stats.WorkingSetBytes, label+".Mem.WorkingSetBytes")
assert.EqualValues(t, seed+offsetMemRSSBytes, *stats.RSSBytes, label+".Mem.RSSBytes")
assert.EqualValues(t, seed+offsetMemPageFaults, *stats.PageFaults, label+".Mem.PageFaults")
assert.EqualValues(t, seed+offsetMemMajorPageFaults, *stats.MajorPageFaults, label+".Mem.MajorPageFaults")
}
Expand Down
18 changes: 9 additions & 9 deletions test/e2e/kubelet_perf.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"time"

client "k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/stats"
"k8s.io/kubernetes/pkg/util"
"k8s.io/kubernetes/pkg/util/sets"

Expand All @@ -31,7 +32,7 @@ import (

const (
// Interval to poll /stats/container on a node
containerStatsPollingPeriod = 3 * time.Second
containerStatsPollingPeriod = 10 * time.Second
// The monitoring time for one test.
monitoringTime = 20 * time.Minute
// The periodic reporting period.
Expand Down Expand Up @@ -210,27 +211,26 @@ var _ = Describe("Kubelet [Serial] [Slow]", func() {
{
podsPerNode: 0,
cpuLimits: containersCPUSummary{
"/kubelet": {0.50: 0.06, 0.95: 0.08},
"/docker-daemon": {0.50: 0.05, 0.95: 0.06},
stats.SystemContainerKubelet: {0.50: 0.06, 0.95: 0.08},
stats.SystemContainerRuntime: {0.50: 0.05, 0.95: 0.06},
},
// We set the memory limits generously because the distribution
// of the addon pods affect the memory usage on each node.
memLimits: resourceUsagePerContainer{
"/kubelet": &containerResourceUsage{MemoryRSSInBytes: 70 * 1024 * 1024},
"/docker-daemon": &containerResourceUsage{MemoryRSSInBytes: 85 * 1024 * 1024},
stats.SystemContainerKubelet: &containerResourceUsage{MemoryRSSInBytes: 70 * 1024 * 1024},
stats.SystemContainerRuntime: &containerResourceUsage{MemoryRSSInBytes: 85 * 1024 * 1024},
},
},
{
podsPerNode: 35,
cpuLimits: containersCPUSummary{
"/kubelet": {0.50: 0.12, 0.95: 0.14},
"/docker-daemon": {0.50: 0.06, 0.95: 0.08},
stats.SystemContainerKubelet: {0.50: 0.12, 0.95: 0.14},
stats.SystemContainerRuntime: {0.50: 0.06, 0.95: 0.08},
},
// We set the memory limits generously because the distribution
// of the addon pods affect the memory usage on each node.
memLimits: resourceUsagePerContainer{
"/kubelet": &containerResourceUsage{MemoryRSSInBytes: 75 * 1024 * 1024},
"/docker-daemon": &containerResourceUsage{MemoryRSSInBytes: 100 * 1024 * 1024},
stats.SystemContainerRuntime: &containerResourceUsage{MemoryRSSInBytes: 100 * 1024 * 1024},
},
},
{
Expand Down