-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[release-1.21] Properly implement metrics for Kata Containers when using CRI stats. #4776
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
[release-1.21] Properly implement metrics for Kata Containers when using CRI stats. #4776
Conversation
There's no reason for us to keep maintaining our own copy of typeurl, let's directly rely on the `github.com/containerd/typeurl` instead. Signed-off-by: Fabiano Fidêncio <[email protected]>
As this function is only used by runtimeVM::ContainerStats(), let's move it to the runtime_vm.go file, making our life easier when doing upcoming changes on runtimeVM::ContainerStats(). Signed-off-by: Fabiano Fidêncio <[email protected]>
CRI-O has been using `containers/libpod/pkg/cgroups` in order to get metrics and, later on, convert it to CRI Stats. Although this approach is fine (and desired) for the OCI runtime type. we can't rely on that for the VM runtime type as the data sent by Kata Containers comes from `containerd/cgroup`. Signed-off-by: Fabiano Fidêncio <[email protected]>
WorkingSetBytes is the bit that needs to be set in order to provide
kubelet the pod's memory information.
Although it's calculated in a slightly different way for "oci" runtime
type, the logic is quite similar for the "vm" runtime type, with the
only difference being where the TotalInactiveFile information comes
from.
This is the last bit needed in order to have `kubectl top pod $pod`
working, as shown below:
```
[fidencio@localhost cri-o]$ kubectl get pods
NAME READY STATUS RESTARTS AGE
example-fedora 1/1 Running 0 130m
[fidencio@localhost cri-o]$ kubectl get pod example-fedora -o yaml | grep runtimeClassName
{"apiVersion":"v1","kind":"Pod","metadata":{"annotations":{},"labels":{"app":"example-fedora-app"},"name":"example-fedora","namespace":"default"},"spec":{"containers":[{"args":["-m","http.server","8080"],"command":["python3"],"image":"fedora:33","name":"example-fedora","ports":[{"containerPort":8080}]}],"runtimeClassName":"kata"}}
f:runtimeClassName: {}
runtimeClassName: kata
[fidencio@localhost cri-o]$ kubectl top pod
NAME CPU(cores) MEMORY(bytes)
example-fedora 1m 9Mi
```
Signed-off-by: Fabiano Fidêncio <[email protected]>
Codecov Report
@@ Coverage Diff @@
## release-1.21 #4776 +/- ##
================================================
- Coverage 43.09% 43.05% -0.04%
================================================
Files 107 107
Lines 9754 9763 +9
================================================
Hits 4203 4203
- Misses 5098 5107 +9
Partials 453 453 |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: openshift-cherrypick-robot, saschagrunert The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
LGTM |
|
/retest |
|
/retest Please review the full test history for this PR and help us cut down flakes. |
|
@openshift-cherrypick-robot: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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. |
|
/retest Please review the full test history for this PR and help us cut down flakes. |
This is an automated cherry-pick of #4470
/assign fidencio