-
Notifications
You must be signed in to change notification settings - Fork 347
support DisableCgroup, DisableApparmor, RestrictOOMScoreAdj #970
Conversation
mikebrow
left a comment
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.
See comments, I missed containerd/containerd#2766 going in, sry. If we want this back ported to earlier releases we'll want to keep these changes you made and walk them back as deprecated.. then do a follow up commit putting them in as runc options vs cri root options.
|
In OCI spec, both As for
@AkihiroSuda Are these options only useful for |
I was sort of thinking these are runtime config options required for filtering oci spec generation to make sure it will run rootless. But I don't see why we would want to filter/force all pods on the host to be rootless. Is that the goal here? Push rootless up the stack or to support running the shims/runc/containerd as rootless? Switching to rootless at the host/containerd/cri level seems like a pretty big switch. It might be better to return error if an apparmor profile is specified and is disabled, than to filter the profile option. How will these changes effect kata support? |
If I understand correctly, "Rootless" means run containerd as a non-root user. If that is the case, it is a daemon level thing to me. It is "rootless" containerd, not running a non-root container. |
|
In this context I mean running everything (runc, containerd, kubelet) as a non-root user. I can explain the details in person and show you demo during KubeCon Shanghai |
|
ok. Even kubelet, interesting. |
|
Maybe what's needed here is a single check to see if we are running as root or not then use that as flag to filter out any attempt to do something that is known to fail when not running as root. For example, if !runningAsRoot && apparmorProfile != "" return err.."apparmor is not supported when running as non-root..." |
|
It might be complicating, if we want to support automatic detection, maybe we should change the variable type from |
|
@Random-Liu @mikebrow any thought? |
|
Suggest: using a string for a rootless option, "auto" should be default. False would make sure we are running as root otherwise throw error on init, true would make sure we are not running as root otherwise error on init. Agree to implementing NoCgroup, NoAppArmor, and RestrictOOMScoreAdj as daemon level options. See @Random-Liu's comment above regarding:
Thoughts? |
4d8509c to
21f1d7a
Compare
|
thanks, updated |
mikebrow
left a comment
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
| g.SetProcessNoNewPrivileges(securityContext.GetNoNewPrivs()) | ||
|
|
||
| // TODO(random-liu): [P1] Set selinux options (privileged or not). | ||
|
|
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.
Add unit test cases for this logic.
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.
Can we cover this in an integrated test (in a follow-up PR)?
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.
It is current hard to write an integration test with different containerd configurations.
I think a unit test would be easier. You can check existing unit tests, it should be simple to add a similar one. :)
21f1d7a to
2c75686
Compare
|
updated |
2c75686 to
9b6f2fb
Compare
| g.SetProcessNoNewPrivileges(securityContext.GetNoNewPrivs()) | ||
|
|
||
| // TODO(random-liu): [P1] Set selinux options (privileged or not). | ||
|
|
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.
It is current hard to write an integration test with different containerd configurations.
I think a unit test would be easier. You can check existing unit tests, it should be simple to add a similar one. :)
|
LGTM other than the comments. |
|
thanks, updated |
Add following config for supporting "rootless" mode * DisableCgroup: disable cgroup * DisableApparmor: disable Apparmor * RestrictOOMScoreAdj: restrict the lower bound of OOMScoreAdj Signed-off-by: Akihiro Suda <suda.akihiro@lab.ntt.co.jp>
Random-Liu
left a comment
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
Add following config for supporting "rootless" mode
Signed-off-by: Akihiro Suda suda.akihiro@lab.ntt.co.jp
A quick way to test this PR is to use Usernetes v20181109.0 ( https://github.com/rootless-containers/usernetes )
cc @giuseppe for consistency with CRI-O implementation (https://github.com/kubernetes-sigs/cri-o/blob/2accad9fab352c445bb4c414d9d3c8cdf351c524/server/rootless.go could be simplified as in this PR with the latest runc IIUC)