@@ -52,6 +52,7 @@ type RayClusterReconciler struct {
52
52
routeClient * routev1client.RouteV1Client
53
53
Scheme * runtime.Scheme
54
54
CookieSalt string
55
+ Config * config.CodeFlareOperatorConfiguration
55
56
}
56
57
57
58
const (
@@ -60,14 +61,13 @@ const (
60
61
oAuthFinalizer = "ray.openshift.ai/oauth-finalizer"
61
62
oAuthServicePort = 443
62
63
oAuthServicePortName = "oauth-proxy"
63
- regularServicePortName = "dashboard"
64
+ ingressServicePortName = "dashboard"
64
65
logRequeueing = "requeueing"
65
66
)
66
67
67
68
var (
68
- deletePolicy = metav1 .DeletePropagationForeground
69
- deleteOptions = client.DeleteOptions {PropagationPolicy : & deletePolicy }
70
- configInstance * config.CodeFlareOperatorConfiguration
69
+ deletePolicy = metav1 .DeletePropagationForeground
70
+ deleteOptions = client.DeleteOptions {PropagationPolicy : & deletePolicy }
71
71
)
72
72
73
73
// +kubebuilder:rbac:groups=ray.io,resources=rayclusters,verbs=get;list;watch;create;update;patch;delete
@@ -103,7 +103,7 @@ func (r *RayClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request)
103
103
104
104
isLocalInteractive := annotationBoolVal (logger , & cluster , "sdk.codeflare.dev/local_interactive" )
105
105
isOpenShift , ingressHost := getClusterType (logger , r .kubeClient , & cluster )
106
- ingressDomain := cluster . ObjectMeta . Annotations [ "sdk.codeflare.dev/ingress_domain" ]
106
+ ingressDomain := getIngressDomain ( & cluster )
107
107
108
108
if cluster .ObjectMeta .DeletionTimestamp .IsZero () {
109
109
if ! controllerutil .ContainsFinalizer (& cluster , oAuthFinalizer ) {
@@ -138,7 +138,7 @@ func (r *RayClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request)
138
138
return ctrl.Result {}, nil
139
139
}
140
140
141
- if cluster .Status .State != "suspended" && isRayDashboardOAuthEnabled () && isOpenShift {
141
+ if cluster .Status .State != "suspended" && r . isRayDashboardOAuthEnabled () && isOpenShift {
142
142
logger .Info ("Creating OAuth Objects" )
143
143
_ , err := r .routeClient .Routes (cluster .Namespace ).Apply (ctx , desiredClusterRoute (& cluster ), metav1.ApplyOptions {FieldManager : controllerName , Force : true })
144
144
if err != nil {
@@ -165,22 +165,15 @@ func (r *RayClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request)
165
165
logger .Error (err , "Failed to update OAuth ClusterRoleBinding" )
166
166
}
167
167
168
- } else if cluster .Status .State != "suspended" && ! isRayDashboardOAuthEnabled () && isOpenShift {
169
- logger .Info ("Creating Dashboard Route" )
170
- _ , err := r .routeClient .Routes (cluster .Namespace ).Apply (ctx , createRoute (& cluster ), metav1.ApplyOptions {FieldManager : controllerName , Force : true })
171
- if err != nil {
172
- logger .Error (err , "Failed to update Dashboard Route" )
173
- }
174
168
if isLocalInteractive && ingressDomain != "" {
175
169
logger .Info ("Creating RayClient Route" )
176
170
_ , err := r .routeClient .Routes (cluster .Namespace ).Apply (ctx , createRayClientRoute (& cluster ), metav1.ApplyOptions {FieldManager : controllerName , Force : true })
177
171
if err != nil {
178
172
logger .Error (err , "Failed to update RayClient Route" )
179
173
}
180
174
}
181
- return ctrl.Result {}, nil
182
175
183
- } else if cluster .Status .State != "suspended" && ! isRayDashboardOAuthEnabled () && ! isOpenShift {
176
+ } else if cluster .Status .State != "suspended" && ! r . isRayDashboardOAuthEnabled () && ! isOpenShift {
184
177
logger .Info ("Creating Dashboard Ingress" )
185
178
_ , err := r .kubeClient .NetworkingV1 ().Ingresses (cluster .Namespace ).Apply (ctx , createIngressApplyConfiguration (& cluster , ingressHost ), metav1.ApplyOptions {FieldManager : controllerName , Force : true })
186
179
if err != nil {
0 commit comments