Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions pkg/controllers/raycluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ func (r *RayClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request)
}
}

if cluster.Status.State != "suspended" && isRayDashboardOAuthEnabled(r.Config) && r.IsOpenShift {
if !isRayClusterSuspended(cluster) && isRayDashboardOAuthEnabled(r.Config) && r.IsOpenShift {
logger.Info("Creating OAuth Objects")
_, err := r.routeClient.Routes(cluster.Namespace).Apply(ctx, desiredClusterRoute(cluster), metav1.ApplyOptions{FieldManager: controllerName, Force: true})
if err != nil {
Expand Down Expand Up @@ -239,7 +239,7 @@ func (r *RayClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request)
return ctrl.Result{RequeueAfter: requeueTime}, err
}

} else if cluster.Status.State != "suspended" && !isRayDashboardOAuthEnabled(r.Config) && !r.IsOpenShift {
} else if !isRayClusterSuspended(cluster) && !isRayDashboardOAuthEnabled(r.Config) && !r.IsOpenShift {
logger.Info("We detected being on Vanilla Kubernetes!")
logger.Info("Creating Dashboard Ingress")
dashboardName := dashboardNameFromCluster(cluster)
Expand Down Expand Up @@ -312,6 +312,10 @@ func isMTLSEnabled(cfg *config.KubeRayConfiguration) bool {
return cfg == nil || ptr.Deref(cfg.MTLSEnabled, true)
}

func isRayClusterSuspended(cluster *rayv1.RayCluster) bool {
return cluster.Spec.Suspend != nil && ptr.Deref(cluster.Spec.Suspend, false)
}

func crbNameFromCluster(cluster *rayv1.RayCluster) string {
if shouldUseOldName(cluster) {
return cluster.Name + "-" + cluster.Namespace + "-auth"
Expand Down
3 changes: 3 additions & 0 deletions pkg/controllers/raycluster_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/project-codeflare/codeflare-common/support"
rayv1 "github.com/ray-project/kuberay/ray-operator/apis/ray/v1"

corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -65,6 +66,7 @@ var _ = Describe("RayCluster controller", func() {
},
RayStartParams: map[string]string{},
},
Suspend: support.Ptr(false),
},
}
_, err = rayClient.RayV1().RayClusters(namespace.Name).Create(ctx, raycluster, metav1.CreateOptions{})
Expand Down Expand Up @@ -209,6 +211,7 @@ var _ = Describe("RayCluster controller", func() {
},
RayStartParams: map[string]string{},
},
Suspend: support.Ptr(false),
},
}
_, err := rayClient.RayV1().RayClusters(namespaceName).Create(ctx, rayclusterWithPullSecret, metav1.CreateOptions{})
Expand Down