mirror of
https://github.com/aljazceru/kata-containers.git
synced 2026-02-23 15:34:28 +01:00
runtime: Add "none" as a shared_fs option
Currently, even when using devmapper, if the VMM supports virtio-fs / virtio-9p, that's used to share a few files between the host and the guest. This *needed*, as we need to share with the guest contents like secrets, certificates, and configurations, via Kubernetes objects like configMaps or secrets, and those are rotated and must be updated into the guest whenever the rotation happens. However, there are still use-cases users can live with just copying those files into the guest at the pod creation time, and for those there's absolutely no need to have a shared filesystem process running with no extra obvious benefit, consuming memory and even increasing the attack surface used by Kata Containers. For the case mentioned above, we should allow users, making it very clear which limitations it'll bring, to run Kata Containers with devmapper without actually having to use a shared file system, which is already the approach taken when using Firecracker as the VMM. Fixes: #7207 Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
This commit is contained in:
@@ -81,6 +81,17 @@ const (
|
||||
|
||||
// VirtioFSNydus means use nydus for the shared file system
|
||||
VirtioFSNydus = "virtio-fs-nydus"
|
||||
|
||||
// NoSharedFS means *no* shared file system solution will be used
|
||||
// and files will be copied into the guest system.
|
||||
//
|
||||
// WARNING: This should be carefully used, and only used in very few
|
||||
// specific cases, as any update to the mount will *NOT* be reflected
|
||||
// during the lifecycle of the pod, causing issues with rotation of
|
||||
// secrets, certs, or configurations via kubernetes objects like
|
||||
// configMaps or secrets, as those will be copied into the guest at
|
||||
// *pod* *creation* *time*.
|
||||
NoSharedFS = "none"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -512,7 +512,7 @@ func (h hypervisor) blockDeviceAIO() (string, error) {
|
||||
}
|
||||
|
||||
func (h hypervisor) sharedFS() (string, error) {
|
||||
supportedSharedFS := []string{config.Virtio9P, config.VirtioFS, config.VirtioFSNydus}
|
||||
supportedSharedFS := []string{config.Virtio9P, config.VirtioFS, config.VirtioFSNydus, config.NoSharedFS}
|
||||
|
||||
if h.SharedFS == "" {
|
||||
return config.VirtioFS, nil
|
||||
@@ -1009,11 +1009,12 @@ func newClhHypervisorConfig(h hypervisor) (vc.HypervisorConfig, error) {
|
||||
return vc.HypervisorConfig{}, err
|
||||
}
|
||||
|
||||
if sharedFS != config.VirtioFS && sharedFS != config.VirtioFSNydus {
|
||||
return vc.HypervisorConfig{}, errors.New("clh only support virtio-fs or virtio-fs-nydus")
|
||||
if sharedFS != config.VirtioFS && sharedFS != config.VirtioFSNydus && sharedFS != config.NoSharedFS {
|
||||
return vc.HypervisorConfig{},
|
||||
fmt.Errorf("Cloud Hypervisor does not support %s shared filesystem option", sharedFS)
|
||||
}
|
||||
|
||||
if h.VirtioFSDaemon == "" {
|
||||
if (sharedFS == config.VirtioFS || sharedFS == config.VirtioFSNydus) && h.VirtioFSDaemon == "" {
|
||||
return vc.HypervisorConfig{},
|
||||
fmt.Errorf("cannot enable %s without daemon path in configuration file", sharedFS)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user