@@ -48,11 +48,13 @@ import (
4848// RayClusterReconciler reconciles a RayCluster object
4949type RayClusterReconciler struct {
5050 client.Client
51- kubeClient * kubernetes.Clientset
52- routeClient * routev1client.RouteV1Client
53- Scheme * runtime.Scheme
54- CookieSalt string
55- Config * config.CodeFlareOperatorConfiguration
51+ kubeClient * kubernetes.Clientset
52+ routeClient * routev1client.RouteV1Client
53+ Scheme * runtime.Scheme
54+ CookieSalt string
55+ Config * config.KubeRayConfiguration
56+ IsOpenShift bool
57+ IsOpenShiftInitialized bool
5658}
5759
5860const (
@@ -105,8 +107,10 @@ func (r *RayClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request)
105107 }
106108
107109 isLocalInteractive := annotationBoolVal (ctx , & cluster , "sdk.codeflare.dev/local_interactive" , false )
108- ingressDomain := "" // FIX - CFO will retrieve it.
109- isOpenShift , ingressHost := getClusterType (ctx , r .kubeClient , & cluster , ingressDomain )
110+ if ! r .IsOpenShiftInitialized {
111+ r .IsOpenShift = isOpenShift (ctx , r .kubeClient , & cluster )
112+ r .IsOpenShiftInitialized = true
113+ }
110114
111115 if cluster .ObjectMeta .DeletionTimestamp .IsZero () {
112116 if ! controllerutil .ContainsFinalizer (& cluster , oAuthFinalizer ) {
@@ -141,7 +145,7 @@ func (r *RayClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request)
141145 return ctrl.Result {}, nil
142146 }
143147
144- if cluster .Status .State != "suspended" && r .isRayDashboardOAuthEnabled () && isOpenShift {
148+ if cluster .Status .State != "suspended" && r .isRayDashboardOAuthEnabled () && r . IsOpenShift {
145149 logger .Info ("Creating OAuth Objects" )
146150 _ , err := r .routeClient .Routes (cluster .Namespace ).Apply (ctx , desiredClusterRoute (& cluster ), metav1.ApplyOptions {FieldManager : controllerName , Force : true })
147151 if err != nil {
@@ -182,9 +186,10 @@ func (r *RayClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request)
182186 }
183187 }
184188
185- } else if cluster .Status .State != "suspended" && ! r .isRayDashboardOAuthEnabled () && ! isOpenShift {
189+ } else if cluster .Status .State != "suspended" && ! r .isRayDashboardOAuthEnabled () && ! r .IsOpenShift {
190+ ingressDomain := ""
186191 logger .Info ("Creating Dashboard Ingress" )
187- _ , err := r .kubeClient .NetworkingV1 ().Ingresses (cluster .Namespace ).Apply (ctx , desiredClusterIngress (& cluster , ingressHost ), metav1.ApplyOptions {FieldManager : controllerName , Force : true })
192+ _ , err := r .kubeClient .NetworkingV1 ().Ingresses (cluster .Namespace ).Apply (ctx , desiredClusterIngress (& cluster , getIngressHost ( ctx , r . kubeClient , & cluster , ingressDomain ) ), metav1.ApplyOptions {FieldManager : controllerName , Force : true })
188193 if err != nil {
189194 // This log is info level since errors are not fatal and are expected
190195 logger .Info ("WARN: Failed to update Dashboard Ingress" , "error" , err .Error (), logRequeueing , true )
0 commit comments