Skip to content

Commit

Permalink
Create oauth objects when RayCluster spec suspend is false
Browse files Browse the repository at this point in the history
  • Loading branch information
sutaakar committed Feb 6, 2025
1 parent ef70cf9 commit 96ba6f3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 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 cluster.Spec.Suspend != nil && !*cluster.Spec.Suspend && 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 cluster.Spec.Suspend != nil && !*cluster.Spec.Suspend && !isRayDashboardOAuthEnabled(r.Config) && !r.IsOpenShift {
logger.Info("We detected being on Vanilla Kubernetes!")
logger.Info("Creating Dashboard Ingress")
dashboardName := dashboardNameFromCluster(cluster)
Expand Down
2 changes: 2 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

0 comments on commit 96ba6f3

Please sign in to comment.