Merge pull request #4211 from nizamial09/discoverconfig

ceph: make the discover daemon filter configurable
This commit is contained in:
Sébastien Han authored and GitHub committed 2019-12-10 10:05:28 +01:00
commit a081a802a4
5 files changed
+38 -1

No files matched your search

+3
View File
@@ -26,6 +26,9 @@
- nfs: [samples](Documentation/ceph-nfs-crd.md#samples)
- When the operator is upgraded, the mgr and osd (not running on PVC) won't be restarted if the Rook binary version changes
- Rook is now able to create and manage Ceph clients [client crd](Documentation/ceph-client-crd.html).
- Device Filtering made configurable for the user by adding an environment variable, and also by keeping the default filters intact
- A new environment variable `DISCOVER_DAEMON_UDEV_BLACKLIST` is added through which the user can blacklist the devices
- If no device is specified, the default values will be used to blacklist the devices
### EdgeFS
+3
View File
@@ -138,6 +138,9 @@ hostpathRequiresPrivileged: false
# Disable automatic orchestration when new devices are discovered.
disableDeviceHotplug: false
# Blacklist certain disks according to the regex provided.
discoverDaemonUdev:
# imagePullSecrets option allow to pull docker images from private docker registry. Option will be passed to all service accounts.
# imagePullSecrets:
# - name: my-registry-secret
@@ -202,6 +202,13 @@ spec:
# Disable automatic orchestration when new devices are discovered
- name: ROOK_DISABLE_DEVICE_HOTPLUG
value: "false"
# Provide customised regex as the values using comma. For eg. regex for rbd based volume, value will be like "(?i)rbd[0-9]+".
# In case of more than one regex, use comma to seperate between them.
# Default regex will be "(?i)dm-[0-9]+,(?i)rbd[0-9]+,(?i)nbd[0-9]+"
# add regex expression after putting a comma to blacklist a disk
# If value is empty, the default regex will be used.
- name: DISCOVER_DAEMON_UDEV_BLACKLIST
value: "(?i)dm-[0-9]+,(?i)rbd[0-9]+,(?i)nbd[0-9]+"
# Whether to enable the flex driver. By default it is enabled and is fully supported, but will be deprecated in some future release
# in favor of the CSI driver.
@@ -155,6 +155,14 @@ spec:
- name: ROOK_DISABLE_DEVICE_HOTPLUG
value: "false"
# Provide customised regex as the values using comma. For eg. regex for rbd based volume, value will be like "(?i)rbd[0-9]+".
# In case of more than one regex, use comma to seperate between them.
# Default regex will be "(?i)dm-[0-9]+,(?i)rbd[0-9]+,(?i)nbd[0-9]+"
# Add regex expression after putting a comma to blacklist a disk
# If value is empty, the default regex will be used.
- name: DISCOVER_DAEMON_UDEV_BLACKLIST
value: "(?i)dm-[0-9]+,(?i)rbd[0-9]+,(?i)nbd[0-9]+"
# Whether to enable the flex driver. By default it is enabled and is fully supported, but will be deprecated in some future release
# in favor of the CSI driver.
- name: ROOK_ENABLE_FLEX_DRIVER
+17 -1
View File
@@ -40,6 +40,10 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
const (
discoverDaemonUdev = "DISCOVER_DAEMON_UDEV_BLACKLIST"
)
var (
logger = capnslog.NewPackageLogger("github.com/rook/rook", "rook-discover")
AppName = "rook-discover"
@@ -176,13 +180,25 @@ func rawUdevBlockMonitor(c chan string, matches, exclusions []string) {
// only one event is emitted per period in order to deal with flapping.
func udevBlockMonitor(c chan string, period time.Duration) {
defer close(c)
var udevFilter []string
// return any add or remove events, but none that match device mapper
// events. string matching is case-insensitve
events := make(chan string)
// get discoverDaemonUdevBlacklist from the enviornment variable
// if user doesnt provide any regex; generate the default regex
// else use the regex provided by user
discoverUdev := os.Getenv(discoverDaemonUdev)
if discoverUdev == "" {
discoverUdev = "(?i)dm-[0-9]+,(?i)rbd[0-9]+,(?i)nbd[0-9]+"
}
udevFilter = strings.Split(discoverUdev, ",")
logger.Infof("using the regular expressions %q", udevFilter)
go rawUdevBlockMonitor(events,
[]string{"(?i)add", "(?i)remove"},
[]string{"(?i)dm-[0-9]+", "(?i)rbd[0-9]+", "(?i)nbd[0-9]+"})
udevFilter)
for {
event, ok := <-events