Skip to content

Commit

Permalink
Start RayCluster controller only after CRD is established
Browse files Browse the repository at this point in the history
  • Loading branch information
astefanutti authored and openshift-merge-bot[bot] committed Apr 26, 2024
1 parent 54a7a90 commit 146b88d
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,15 @@ func waitForRayClusterAPIandSetupController(ctx context.Context, mgr ctrl.Manage
case watch.Error:
exitOnError(apierrors.FromObject(event.Object), "error watching for RayCluster API")

case watch.Added:
setupLog.Info("RayCluster API installed, setting up controller")
exitOnError(setupRayClusterController(mgr, cfg, isOpenShift, certsReady), "unable to setup RayCluster controller")
return
case watch.Added, watch.Modified:
if crd := event.Object.(*apiextensionsv1.CustomResourceDefinition); crd.Name == "rayclusters.ray.io" &&
slices.ContainsFunc(crd.Status.Conditions, func(condition apiextensionsv1.CustomResourceDefinitionCondition) bool {
return condition.Type == apiextensionsv1.Established && condition.Status == apiextensionsv1.ConditionTrue
}) {
setupLog.Info("RayCluster API installed, setting up controller")
exitOnError(setupRayClusterController(mgr, cfg, isOpenShift, certsReady), "unable to setup RayCluster controller")
return
}
}
}
}
Expand Down

0 comments on commit 146b88d

Please sign in to comment.