rbd: enable mapping and unmapping from a network namespace

Make rbdplugin pod work in a non-initial network namespace (i.e. with
"hostNetwork: false") by skipping waiting for udev events when mapping
and unmapping images.  CSI use case is very simple: all that is needed
is a device node which is immediately fed to mkfs, so we should be able
to tolerate udev not being finished with the device just fine.

Fixes: #1323
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
This commit is contained in:
Ilya Dryomov 2020-09-22 10:07:10 +02:00 committed by mergify[bot]
parent c2493686b7
commit 04644c1d58

View File

@ -215,7 +215,15 @@ func appendDeviceTypeAndOptions(cmdArgs []string, isNbd bool, userOptions string
} }
cmdArgs = append(cmdArgs, "--device-type", accessType) cmdArgs = append(cmdArgs, "--device-type", accessType)
if !isNbd {
// Enable mapping and unmapping images from a non-initial network
// namespace (e.g. for Multus CNI). The network namespace must be
// owned by the initial user namespace.
cmdArgs = append(cmdArgs, "--options", "noudev")
}
if userOptions != "" { if userOptions != "" {
// userOptions is appended after, possibly overriding the above
// default options.
cmdArgs = append(cmdArgs, "--options", userOptions) cmdArgs = append(cmdArgs, "--options", userOptions)
} }