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 ca3bd0e
Show file tree
Hide file tree
Showing 3 changed files with 7 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
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
2 changes: 2 additions & 0 deletions test/e2e/mnist_rayjob_raycluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ func runMnistRayJobRayCluster(t *testing.T, accelerator string, numberOfGpus int
test.Eventually(RayCluster(test, namespace.Name, rayCluster.Name), TestTimeoutMedium).
Should(WithTransform(RayClusterState, Equal(rayv1.Ready)))

test.T().Logf("RayCluster: %v", GetRayCluster(test, namespace.Name, rayCluster.Name))

// Create RayJob
rayJob := constructRayJob(test, namespace, rayCluster, accelerator, numberOfGpus)
rayJob, err = test.Client().Ray().RayV1().RayJobs(namespace.Name).Create(test.Ctx(), rayJob, metav1.CreateOptions{})
Expand Down

0 comments on commit ca3bd0e

Please sign in to comment.