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: update cadvisor stats provider with new log location #108115
kubelet/stats: update cadvisor stats provider with new log location #108115
Conversation
/sig node |
dcdfe6b
to
89251ab
Compare
a unit test is likely in order, but I'll need to tackle that tomorrow |
in kubernetes#74441, the namespace and name were added to the pod log location. However, cAdvisor stats provider wasn't correspondingly updated. since CRI-O uses cAdvisor stats provider by default, despite being a CRI implementation, eviction with ephemeral storage and container logs doesn't work as expected, until now! Signed-off-by: Peter Hunt <pehunt@redhat.com>
…hemeral stats this commit updates checkEphemeralStorage to be able to add container log stats, if applicable. It also updates the old check when container log stats aren't found to be more accurate. Specifically, this check previously worked because of a fluke programming accident: according to this block in pkg/kubelet/stats/helper.go:113 ``` if result.Rootfs != nil { rootfsUsage := *cfs.BaseUsageBytes result.Rootfs.UsedBytes = &rootfsUsage } ``` BaseUsageBytes should be the value added, not TotalUsageBytes. However, since in this case one also needs to account for the calculated log size, which is TotalUsageBytes - BaseUsageBytes using TotalUsageBytes value accidentally worked. Updating the case to use the correct value AND log offset fixes this accident and makes the behavior more in line with what happens when calculating ephemeral storage. Signed-off-by: Peter Hunt <pehunt@redhat.com>
Signed-off-by: Peter Hunt <pehunt@redhat.com>
89251ab
to
0b7629d
Compare
/retest |
/triage accepted |
Thanks for the fix! /lgtm |
/assign @dashpole for approval. |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dashpole, haircommander 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 |
What type of PR is this?
/kind bug
What this PR does / why we need it:
in #74441,
the namespace and name were added to the pod log location.
However, cAdvisor stats provider wasn't correspondingly updated.
since CRI-O uses cAdvisor stats provider by default, despite being a CRI implementation,
eviction with ephemeral storage and container logs doesn't work as expected, until now!
Signed-off-by: Peter Hunt pehunt@redhat.com
Which issue(s) this PR fixes:
Fixes #107447
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: