Skip to content

Commit a0c88dc

Browse files
committed
Create oauth objects when RayCluster spec suspend is false
1 parent ef70cf9 commit a0c88dc

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Diff for: pkg/controllers/raycluster_controller.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ func (r *RayClusterReconciler) Reconcile(ctx context.Context, req ctrl.Request)
193193
}
194194
}
195195

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

242-
} else if cluster.Status.State != "suspended" && !isRayDashboardOAuthEnabled(r.Config) && !r.IsOpenShift {
242+
} else if cluster.Spec.Suspend != nil && !*cluster.Spec.Suspend && !isRayDashboardOAuthEnabled(r.Config) && !r.IsOpenShift {
243243
logger.Info("We detected being on Vanilla Kubernetes!")
244244
logger.Info("Creating Dashboard Ingress")
245245
dashboardName := dashboardNameFromCluster(cluster)

Diff for: pkg/controllers/raycluster_controller_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121

2222
. "github.com/onsi/ginkgo/v2"
2323
. "github.com/onsi/gomega"
24+
"github.com/project-codeflare/codeflare-common/support"
2425
rayv1 "github.com/ray-project/kuberay/ray-operator/apis/ray/v1"
2526

2627
corev1 "k8s.io/api/core/v1"
@@ -65,6 +66,7 @@ var _ = Describe("RayCluster controller", func() {
6566
},
6667
RayStartParams: map[string]string{},
6768
},
69+
Suspend: support.Ptr(false),
6870
},
6971
}
7072
_, err = rayClient.RayV1().RayClusters(namespace.Name).Create(ctx, raycluster, metav1.CreateOptions{})
@@ -209,6 +211,7 @@ var _ = Describe("RayCluster controller", func() {
209211
},
210212
RayStartParams: map[string]string{},
211213
},
214+
Suspend: support.Ptr(false),
212215
},
213216
}
214217
_, err := rayClient.RayV1().RayClusters(namespaceName).Create(ctx, rayclusterWithPullSecret, metav1.CreateOptions{})

0 commit comments

Comments
 (0)