Skip to content

Commit 348e838

Browse files
Rayclient Route to resolve its own ingress domain, and enable local_interactive by default
1 parent da57f8c commit 348e838

File tree

2 files changed

+6
-25
lines changed

2 files changed

+6
-25
lines changed

pkg/controllers/raycluster_controller.go

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ func (r *RayClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request)
106106
return ctrl.Result{}, client.IgnoreNotFound(err)
107107
}
108108

109-
isLocalInteractive := annotationBoolVal(ctx, &cluster, "sdk.codeflare.dev/local_interactive", false)
110109
if !r.IsOpenShiftInitialized {
111110
r.IsOpenShift = isOpenShift(ctx, r.kubeClient, &cluster)
112111
r.IsOpenShiftInitialized = true
@@ -177,13 +176,11 @@ func (r *RayClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request)
177176
return ctrl.Result{RequeueAfter: requeueTime}, err
178177
}
179178

180-
if isLocalInteractive {
181-
logger.Info("Creating RayClient Route")
182-
_, err := r.routeClient.Routes(cluster.Namespace).Apply(ctx, desiredRayClientRoute(&cluster), metav1.ApplyOptions{FieldManager: controllerName, Force: true})
183-
if err != nil {
184-
logger.Error(err, "Failed to update RayClient Route")
185-
return ctrl.Result{RequeueAfter: requeueTime}, err
186-
}
179+
logger.Info("Creating RayClient Route")
180+
_, err = r.routeClient.Routes(cluster.Namespace).Apply(ctx, desiredRayClientRoute(&cluster), metav1.ApplyOptions{FieldManager: controllerName, Force: true})
181+
if err != nil {
182+
logger.Error(err, "Failed to update RayClient Route")
183+
return ctrl.Result{RequeueAfter: requeueTime}, err
187184
}
188185

189186
} else if cluster.Status.State != "suspended" && !r.isRayDashboardOAuthEnabled() && !r.IsOpenShift {
@@ -195,7 +192,7 @@ func (r *RayClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request)
195192
logger.Info("WARN: Failed to update Dashboard Ingress", "error", err.Error(), logRequeueing, true)
196193
return ctrl.Result{RequeueAfter: requeueTime}, err
197194
}
198-
if isLocalInteractive && ingressDomain != "" {
195+
if ingressDomain != "" {
199196
logger.Info("Creating RayClient Ingress")
200197
_, err := r.kubeClient.NetworkingV1().Ingresses(cluster.Namespace).Apply(ctx, desiredRayClientIngress(&cluster, ingressDomain), metav1.ApplyOptions{FieldManager: controllerName, Force: true})
201198
if err != nil {

pkg/controllers/support.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package controllers
33
import (
44
"context"
55
"fmt"
6-
"strconv"
76
"strings"
87

98
rayv1 "github.com/ray-project/kuberay/ray-operator/apis/ray/v1"
@@ -30,7 +29,6 @@ func desiredRayClientRoute(cluster *rayv1.RayCluster) *routeapply.RouteApplyConf
3029
return routeapply.Route(rayClientNameFromCluster(cluster), cluster.Namespace).
3130
WithLabels(map[string]string{"ray.io/cluster-name": cluster.Name}).
3231
WithSpec(routeapply.RouteSpec().
33-
WithHost(rayClientNameFromCluster(cluster) + "-" + cluster.Namespace).
3432
WithTo(routeapply.RouteTargetReference().WithKind("Service").WithName(serviceNameFromCluster(cluster)).WithWeight(100)).
3533
WithPort(routeapply.RoutePort().WithTargetPort(intstr.FromString("client"))).
3634
WithTLS(routeapply.TLSConfig().WithTermination("passthrough")),
@@ -172,17 +170,3 @@ func (r *RayClusterReconciler) isRayDashboardOAuthEnabled() bool {
172170
}
173171
return true
174172
}
175-
176-
func annotationBoolVal(ctx context.Context, cluster *rayv1.RayCluster, annotation string, defaultValue bool) bool {
177-
logger := ctrl.LoggerFrom(ctx)
178-
val, exists := cluster.ObjectMeta.Annotations[annotation]
179-
if !exists || val == "" {
180-
return defaultValue
181-
}
182-
boolVal, err := strconv.ParseBool(val)
183-
if err != nil {
184-
logger.Error(err, "Could not convert annotation value to bool", "annotation", annotation, "value", val)
185-
return defaultValue
186-
}
187-
return boolVal
188-
}

0 commit comments

Comments
 (0)