Skip to content

Commit

Permalink
Set CPU metrics for init containers under containerd
Browse files Browse the repository at this point in the history
Copies PR kubernetes#76503 for release-1.11.

metrics-server doesn't return metrics for pods with init containers
under containerd because they have incomplete CPU metrics returned by
the kubelet /stats/summary API.

This problem has been fixed in 1.14 (kubernetes#74336), but the cherry-picks
dropped the usageNanoCores metric.

This change adds the missing usageNanoCores metric for init containers
in Kubernetes v1.11.

Fixes kubernetes#76292
  • Loading branch information
jmcmeek committed Apr 18, 2019
1 parent 633fb4d commit 330523c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions pkg/kubelet/stats/cri_stats_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ func (p *criStatsProvider) makeContainerStats(
} else {
result.CPU.Time = metav1.NewTime(time.Unix(0, time.Now().UnixNano()))
result.CPU.UsageCoreNanoSeconds = Uint64Ptr(0)
result.CPU.UsageNanoCores = Uint64Ptr(0)
}
if stats.Memory != nil {
result.Memory.Time = metav1.NewTime(time.Unix(0, stats.Memory.Timestamp))
Expand Down

0 comments on commit 330523c

Please sign in to comment.