ceph: stop monitoring health on cluster deletion

Stop the go routines on cluster deletion.

Signed-off-by: Sébastien Han <seb@redhat.com>
This commit is contained in:
Sébastien Han committed 2020-07-22 17:25:15 +02:00
1 parent 39931b1edf
commit 9b9141ee84
2 files changed
+22 -6

No files matched your search

+17 -4
View File
@@ -368,10 +368,23 @@ func (c *ClusterController) requestClusterDelete(cluster *cephv1.CephCluster) (r
logger.Infof("delete event for cluster %q in namespace %q", cluster.Name, cluster.Namespace)
if cluster, ok := c.clusterMap[cluster.Namespace]; ok && !cluster.closedStopCh {
// close the goroutines watching the health of the cluster (mons, osds, ceph status, etc)
close(cluster.stopCh)
cluster.closedStopCh = true
if cluster, ok := c.clusterMap[cluster.Namespace]; ok {
// if not already stopped, stop clientcontroller and bucketController
if !cluster.closedStopCh {
close(cluster.stopCh)
cluster.closedStopCh = true
}
// close the goroutines watching the health of the cluster (mons, osds, ceph status)
var isDisabled bool
for _, daemon := range monitorDaemonList {
isDisabled = isMonitoringDisabled(daemon, cluster.Spec)
if _, ok := cluster.monitoringChannels[daemon]; ok {
if !isDisabled {
close(cluster.monitoringChannels[daemon].stopChan)
}
}
}
}
err := c.checkIfVolumesExist(cluster)
+5 -2
View File
@@ -26,11 +26,14 @@ import (
"github.com/rook/rook/pkg/operator/ceph/object/bucket"
)
var (
monitorDaemonList = []string{"mon", "osd", "status"}
)
func (c *ClusterController) configureCephMonitoring(cluster *cluster, clusterInfo *cephclient.ClusterInfo) {
var isDisabled bool
daemons := []string{"mon", "osd", "status"}
for _, daemon := range daemons {
for _, daemon := range monitorDaemonList {
// Is the monitoring enabled for that daemon?
isDisabled = isMonitoringDisabled(daemon, cluster.Spec)
if health, ok := cluster.monitoringChannels[daemon]; ok {