Skip to content

container_spec_cpu_shares will use wrong cgroups v2 conversion formula for runc v1.3.2+ #3737

@CatMachina

Description

@CatMachina

cadvisor uses the linear conversion metric when converting from cgroups v2 cpu.weight to the correct cpu limit share value (ref).

Although kubelet has this conversion, it's not being used anywhere, so presumably the cpu resource request is being converted into cgroup v2 cpu.weight in the containerization layer. runc 1.3.2 will use a different conversion formula, when they bump their cgroups dependency from 0.0.1 to 0.0.4 (ref), as the new conversion is done in 0.0.3 (ref).

This would result in container_spec_cpu_shares to become inaccurate as the container runtime layer would use the new conversion to convert shares to weight, and cadvisor the old conversion from weight to shares. I did some calculation to see what the discrepancy would be, and it seems quite big (feel free to double check my math on this):
https://www.desmos.com/calculator/jwnh1p4fov

Is there a plan in place to have a stable version with this new formula from runc?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions