-
Notifications
You must be signed in to change notification settings - Fork 147
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
Add policy for KubeVirt #802
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signed-off-by: Kenton Groombridge <[email protected]>
Signed-off-by: Kenton Groombridge <[email protected]>
When multus creates a new network, iptables rules get written to /tmp and iptables will be called to load them. Signed-off-by: Kenton Groombridge <[email protected]>
container_kvm_t is the type for containers with access to KVM for running virtual machines. Signed-off-by: Kenton Groombridge <[email protected]>
Signed-off-by: Kenton Groombridge <[email protected]>
pebenito
reviewed
Aug 14, 2024
I can't remember if this will work, but did you try making |
Trying this, it seems not unfortunately. selint gives this error:
Ignoring the above, trying to build the policy results in:
|
Signed-off-by: Kenton Groombridge <[email protected]>
pebenito
approved these changes
Aug 16, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add policy rules required for KubeVirt and Multus.
Add a new container type
container_kvm_t
which does not have the extra rules a genericcontainer_t
would have, but rather just enough to be able to run a virtual machine. This also means it needs RW access to/dev/kvm
. A type with the same name also exists incontainer-selinux
which to my knowledge is similar in functionality. However, typical KubeVirt installations withcontainer-selinux
(e.g. on OpenShift) will use an external type provided by a CIL policy module (virt_launcher.process
). To use this policy with KubeVirt we need to apply the following config to the KubeVirt installation on the cluster:The
DisableCustomSELinuxPolicy
tells KubeVirt not to install its custom SELinux policy (which will be denied under refpolicy) andselinuxLauncherType
tells KubeVirt to use thecontainer_kvm_t
type for VM pods.Add various rules required for Multus to function, which is a container networking plugin for running other container network plugins. This is useful for KubeVirt where a the KVM container may need to join the VM to multiple networks on the host, e.g. to a bridge or masqueraded so that it can access networks outside of the kubernetes internal pod network.
Add a few rules required for data volume (DV) manipulation on
rook-ceph
. KubeVirt provides a few ways to upload VM disk images for use by VMs in the cluster. In this case a pod is created with the volume mounted as a block device within the container which will be written to as the VM disk image is uploaded.Note that we also add a
container_tmp_t
type here which is used for very short-lived files written by Multus on the host/tmp
. Despite the name,spc_t
is the only domain with this access currently.