ceph: skip orch on non-ready clusters

the k8s Node add/update events can fire before a cluster is fully
configured, which may leave some state undefined. skip orchestration
when the cluster is in this state.

fixes: #3001

Signed-off-by: Noah Watkins <noahwatkins@gmail.com>
This commit is contained in:
Noah Watkins committed 2019-04-16 10:39:55 -07:00
1 parent b7622d0fe5
commit 48e86d6bf7
1 file changed
+8
+8
View File
@@ -174,6 +174,10 @@ func (c *ClusterController) onK8sNodeAdd(obj interface{}) {
logger.Debugf("Skipping -> Do not use all Nodes")
continue
}
if cluster.Info == nil {
logger.Info("Cluster %s is not ready. Skipping orchestration.", cluster.Namespace)
continue
}
if valid, _ := k8sutil.ValidNode(*newNode, cluster.Spec.Placement.All()); valid == true {
logger.Debugf("Adding %s to cluster %s", newNode.Labels[apis.LabelHostname], cluster.Namespace)
@@ -354,6 +358,10 @@ func (c *ClusterController) onK8sNodeUpdate(oldObj, newObj interface{}) {
}
for _, cluster := range c.clusterMap {
if cluster.Info == nil {
logger.Info("Cluster %s is not ready. Skipping orchestration.", cluster.Namespace)
continue
}
if valid, _ := k8sutil.ValidNode(*newNode, cephv1.GetOSDPlacement(cluster.Spec.Placement)); valid == true {
logger.Debugf("Adding %s to cluster %s", newNode.Labels[apis.LabelHostname], cluster.Namespace)
err := cluster.createInstance(c.rookImage, cluster.Info.CephVersion)