core: continue and create an initial cluster info or fail

Let's catch the correct error when no cluster info exists yet. If we
have another error, we fail the orchestration and try again. This could
help up catching small API hiccups for example.

Signed-off-by: Sébastien Han <seb@redhat.com>
This commit is contained in:
Sébastien Han committed 2021-12-08 17:31:44 +01:00
1 parent 4f1a2d47a4
commit e5ce6abac0
1 file changed
+5 -1
+5 -1
View File
@@ -168,7 +168,11 @@ func (c *ClusterController) initializeCluster(cluster *cluster) error {
clusterInfo, _, _, err := mon.LoadClusterInfo(c.context, c.OpManagerCtx, cluster.Namespace)
if err != nil {
logger.Infof("clusterInfo not yet found, must be a new cluster")
if errors.Is(err, mon.ClusterInfoNoClusterNoSecret) {
logger.Info("clusterInfo not yet found, must be a new cluster.")
} else {
return errors.Wrap(err, "failed to load cluster info")
}
} else {
clusterInfo.OwnerInfo = cluster.ownerInfo
clusterInfo.SetName(c.namespacedName.Name)