-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Support for cgroups blockio #5490
Conversation
Hi @askervin. Thanks for your PR. I'm waiting for a containerd member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
Build succeeded.
|
Build succeeded.
|
Build succeeded.
|
Build succeeded.
|
pkg/blockio/blockio.go
Outdated
Config: &Config{}, | ||
InitFn: initBlockio, | ||
}) | ||
} |
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.
Rather than adding a new subsystem, can we use NRI? https://github.com/containerd/nri
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.
@AkihiroSuda, happy that you asked! Actually I initially planned implementing blockio as an NRI plugin.
However, what changed my mind was the fact that OCI spec LinuxResources already had a blockio field, and that runc was already working fine with the CFQ I/O scheduler. Furthermore, Runc v1.0 (released today) supports both CFQ and BFQ schedulers in both cgroups v1 and v2. It obviously provides consistent blockio configuration behavior and low-level error messages to all container runtimes using it.
If NRI allowed a plugin to fill in OCI spec fields and thereby use runc, it would be a clear benefit in architectural perspective. In ideal case NRI would be supported by other container runtimes, too. Then NRI would definitely be the number one option for blockio: there would be a single plugin that you could install to any node running any container runtime that supports NRI. As this is not yet the case, we decided to go with runtime-internal blockio implementations but so that they are very light-weight in the runtime perspective: they use a common class-based blockio configuration and pretty much all the logic is in a library that is common to runtimes.
Related to this, you might be interested in our NRI prototype that enables OCI spec modifications from plugins - among other goodies. But that's a separate discussion.
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.
Rather than adding a new subsystem, can we use NRI? https://github.com/containerd/nri
@AkihiroSuda Sorry if this is slightly off topic, but we have been playing around with a prototype of extending the scope of NRI to allow more versatile plugin functionality, for instance allowing us to implement container resource assignment algorithms as NRI plugins. AFAIK @askervin has taken a look at implementing functionality equivalent to this PR with that extended NRI scope, but we haven't taken a look at whether and how that would be possible with the currently available NRI plugin interface.
Build succeeded.
|
|
Build succeeded.
|
b4d2947
to
fed7280
Compare
Build succeeded.
|
1c55b4f
to
38243f0
Compare
Build succeeded.
|
38243f0
to
5190b1c
Compare
Build succeeded.
|
Rebased. @dmcgowan @AkihiroSuda @samuelkarp, would you have time to take a look, please? |
@askervin quick question, does this work for hosts running cgroups v2 only? Thanks! |
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
We can update the BUILDING.md in follow-up
discussion in containerd community meeting.. leaned to not provide the extra no_blockio tags |
This patch adds support for a container annotation and two separate pod annotations for controlling the blockio class of containers. The container annotation can be used by a CRI client: "io.kubernetes.cri.blockio-class" Pod annotations specify the blockio class in the K8s pod spec level: "blockio.resources.beta.kubernetes.io/pod" (pod-wide default for all containers within) "blockio.resources.beta.kubernetes.io/container.<container_name>" (container-specific overrides) Correspondingly, this patch adds support for --blockio-class and --blockio-config-file to ctr, too. This implementation follows the resource class annotation pattern introduced in RDT and merged in commit 8937012. Signed-off-by: Antti Kervinen <antti.kervinen@intel.com>
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
This PR isn't included in any of any 1.6.x releases so far, right? Is there a plan to release it anytime soon? |
This will be included in v1.7. |
Do we have unit tests or e2e tests for this feature? |
This PR implements support for the cgroup blockio controller.
How it is used
/etc/containers/blockio.yaml
contains:/etc/containerd/config.toml
contains:When a container in this pod is created, containerd assigns blockio parameters based its class configuration.
How it is implemented
The goresctrl library understands blockio class configurations, block devices in the system and the OCI BlockIO format. When containerd starts, the blockio plugin sets effective user-defined blockio class configuration to goresctrl.
containerd looks for container's blockio class from pod and container annotations. The annotation syntax is similar to container RDT class annotations in PR #5439.
If containerd finds a class, it uses goresctrl to get corresponding OCI BlockIO data and includes it in the OCI runtime-spec.
ctr
is extended with--blockio-config-file
and--blockio-class
for direct command-line support and testing.