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
kubelet/stats: deduplicate makePodStorageStats #108855
Conversation
|
/sig node |
|
/test pull-kubernetes-node-kubelet-serial-crio-cgroupv2 |
5175e27
to
b97948f
Compare
|
/retest |
|
/priority important-longterm |
| @@ -433,3 +435,29 @@ func addUsage(first, second *uint64) *uint64 { | |||
| total := *first + *second | |||
| return &total | |||
| } | |||
|
|
|||
| func makePodStorageStats(s *statsapi.PodStats, rootFsInfo *cadvisorapiv2.FsInfo, resourceAnalyzer stats.ResourceAnalyzer, hostStatsProvider HostStatsProvider, isCRIStatsProvider bool) { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Diff:
diff --git a/home/ehashman/tmp/foo2 b/home/ehashman/tmp/foo1
index 4ba09d2bead..2dc73b0ed5d 100644
--- a/home/ehashman/tmp/foo2
+++ b/home/ehashman/tmp/foo1
@@ -1,12 +1,12 @@
-func (p *criStatsProvider) makePodStorageStats(s *statsapi.PodStats, rootFsInfo *cadvisorapiv2.FsInfo) {
+func makePodStorageStats(s *statsapi.PodStats, rootFsInfo *cadvisorapiv2.FsInfo, resourceAnalyzer stats.ResourceAnalyzer, hostStatsProvider HostStatsProvider, isCRIStatsProvider bool) {
podNs := s.PodRef.Namespace
podName := s.PodRef.Name
podUID := types.UID(s.PodRef.UID)
- vstats, found := p.resourceAnalyzer.GetPodVolumeStats(podUID)
+ vstats, found := resourceAnalyzer.GetPodVolumeStats(podUID)
if !found {
return
}
- logStats, err := p.hostStatsProvider.getPodLogStats(podNs, podName, podUID, rootFsInfo)
+ logStats, err := hostStatsProvider.getPodLogStats(podNs, podName, podUID, rootFsInfo)
if err != nil {
klog.ErrorS(err, "Unable to fetch pod log stats", "pod", klog.KRef(podNs, podName))
// If people do in-place upgrade, there might be pods still using
@@ -14,12 +14,12 @@ func (p *criStatsProvider) makePodStorageStats(s *statsapi.PodStats, rootFsInfo
// We should continue generating other stats in that case.
// calcEphemeralStorage tolerants logStats == nil.
}
- etcHostsStats, err := p.hostStatsProvider.getPodEtcHostsStats(podUID, rootFsInfo)
+ etcHostsStats, err := hostStatsProvider.getPodEtcHostsStats(podUID, rootFsInfo)
if err != nil {
klog.ErrorS(err, "Unable to fetch pod etc hosts stats", "pod", klog.KRef(podNs, podName))
}
ephemeralStats := make([]statsapi.VolumeStats, len(vstats.EphemeralVolumes))
copy(ephemeralStats, vstats.EphemeralVolumes)
s.VolumeStats = append(append([]statsapi.VolumeStats{}, vstats.EphemeralVolumes...), vstats.PersistentVolumes...)
- s.EphemeralStorage = calcEphemeralStorage(s.Containers, ephemeralStats, rootFsInfo, logStats, etcHostsStats, true)
+ s.EphemeralStorage = calcEphemeralStorage(s.Containers, ephemeralStats, rootFsInfo, logStats, etcHostsStats, isCRIStatsProvider)
}|
@haircommander Any chance you could take a look at the comments raised in this PR if you got time to spare? Thanks! |
|
/retest |
|
I personally think this route still makes sense. the behavior change is consistent with the cri stats manager, and makes logical sense to me. I am open to more feedback though |
|
@andrewsykim @tallclair any chance you have some time to review this? It would be great to see some progress on this issue. Thanks! |
|
/assign @endocrimes @mrunalp @rphillips @saschagrunert Anyone have any feedback or can we move forward with this |
b97948f
to
b0aaf52
Compare
|
Alright, I've updated to: Thus standardizing behavior, keeping the old cadvisor behavior (as requested), and reducing verbosity for #106957 @dashpole @rphillips PTAL |
Signed-off-by: Peter Hunt <pehunt@redhat.com>
and by doing so, fix a bug where the stats providers report a directory is not found after a pod's storage is removed Signed-off-by: Peter Hunt <pehunt@redhat.com>
b0aaf52
to
d6ffca0
Compare
|
/lgtm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
|
/milestone v1.26 cc @mrunalp |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: endocrimes, haircommander, mrunalp The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
@haircommander: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
|
The Kubernetes project has merge-blocking tests that are currently too flaky to consistently pass. This bot retests PRs for certain kubernetes repos according to the following rules:
You can:
/retest |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
Deduplicates pod storage stats generation between CRI and cadvisor stats providers, and unifies their behavior. This fixes a bug where cadvisor stats provider excessively reported a GC'd directory as not found
Which issue(s) this PR fixes:
Fixes #106957
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: