ceph: add operator option to disable hotplug

this adds a new operator environment variable that allows automatic
orchestration triggered by device discovery to be disabled.

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
This commit is contained in:
Noah Watkins committed 2019-04-23 13:44:30 -07:00
1 parent 1f2e558191
commit f2fc644190
5 files changed
+35 -16

No files matched your search

@@ -77,6 +77,10 @@ spec:
value: {{ .Values.logLevel }}
- name: ROOK_ENABLE_SELINUX_RELABELING
value: {{ .Values.enableSelinuxRelabeling | quote }}
{{- if .Values.disableDeviceHotplug }}
- name: ROOK_DISABLE_DEVICE_HOTPLUG
value: {{ .Values.disableDeviceHotplug }}
{{- end }}
- name: NODE_NAME
valueFrom:
fieldRef:
@@ -79,3 +79,6 @@ enableSelinuxRelabeling: true
# Writing to the hostPath is required for the Ceph mon and osd pods. Given the restricted permissions in OpenShift with SELinux,
# the pod must be running privileged in order to write to the hostPath volume, this must be set to true then.
hostpathRequiresPrivileged: false
# Disable automatic orchestration when new devices are discovered.
disableDeviceHotplug: false
@@ -150,6 +150,9 @@ spec:
# For more details see https://github.com/rook/rook/issues/2254
- name: ROOK_ENABLE_FSGROUP
value: "true"
# Disable automatic orchestration when new devices are discovered
- name: ROOK_DISABLE_DEVICE_HOTPLUG
value: "false"
# The name of the node to pass with the downward API
- name: NODE_NAME
valueFrom:
@@ -113,6 +113,9 @@ spec:
# For more details see https://github.com/rook/rook/issues/2254
- name: ROOK_ENABLE_FSGROUP
value: "true"
# Disable automatic orchestration when new devices are discovered
- name: ROOK_DISABLE_DEVICE_HOTPLUG
value: "false"
# The name of the node to pass with the downward API
- name: NODE_NAME
valueFrom:
+22 -16
View File
@@ -63,6 +63,7 @@ const (
DefaultClusterName = "rook-ceph"
clusterDeleteRetryInterval = 2 //seconds
clusterDeleteMaxRetries = 15
disableHotplugEnv = "ROOK_DISABLE_DEVICE_HOTPLUG"
)
var (
@@ -143,24 +144,29 @@ func (c *ClusterController) StartWatch(namespace string, stopCh chan struct{}) e
)
go nodeController.Run(stopCh)
// watch for updates to the device discovery configmap
operatorNamespace := os.Getenv(k8sutil.PodNamespaceEnvVar)
_, deviceCMController := cache.NewInformer(
cache.NewFilteredListWatchFromClient(c.context.Clientset.CoreV1().RESTClient(),
"configmaps", operatorNamespace, func(options *metav1.ListOptions) {
options.LabelSelector = fmt.Sprintf("%s=%s", k8sutil.AppAttr, discoverDaemon.AppName)
if disableVal := os.Getenv(disableHotplugEnv); disableVal != "true" {
// watch for updates to the device discovery configmap
logger.Infof("Enabling hotplug orchestration: %s=%s", disableHotplugEnv, disableVal)
operatorNamespace := os.Getenv(k8sutil.PodNamespaceEnvVar)
_, deviceCMController := cache.NewInformer(
cache.NewFilteredListWatchFromClient(c.context.Clientset.CoreV1().RESTClient(),
"configmaps", operatorNamespace, func(options *metav1.ListOptions) {
options.LabelSelector = fmt.Sprintf("%s=%s", k8sutil.AppAttr, discoverDaemon.AppName)
},
),
&v1.ConfigMap{},
0,
cache.ResourceEventHandlerFuncs{
AddFunc: nil,
UpdateFunc: c.onDeviceCMUpdate,
DeleteFunc: nil,
},
),
&v1.ConfigMap{},
0,
cache.ResourceEventHandlerFuncs{
AddFunc: nil,
UpdateFunc: c.onDeviceCMUpdate,
DeleteFunc: nil,
},
)
)
go deviceCMController.Run(stopCh)
go deviceCMController.Run(stopCh)
} else {
logger.Infof("Disabling hotplug orchestration via %s", disableHotplugEnv)
}
// watch for events on all legacy types too
c.watchLegacyClusters(namespace, stopCh, resourceHandlerFuncs)