@@ -18,20 +18,15 @@ package e2e
18
18
19
19
import (
20
20
"encoding/base64"
21
- "net/url"
22
21
"testing"
23
22
24
23
. "github.com/onsi/gomega"
25
24
mcadv1beta1 "github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/apis/controller/v1beta1"
26
25
rayv1alpha1 "github.com/ray-project/kuberay/ray-operator/apis/ray/v1alpha1"
27
26
28
27
corev1 "k8s.io/api/core/v1"
29
- networkingv1 "k8s.io/api/networking/v1"
30
28
"k8s.io/apimachinery/pkg/api/resource"
31
29
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
32
- "k8s.io/apimachinery/pkg/util/intstr"
33
-
34
- routev1 "github.com/openshift/api/route/v1"
35
30
36
31
. "github.com/project-codeflare/codeflare-operator/test/support"
37
32
)
@@ -257,98 +252,7 @@ func TestMNISTRayJobMCADRayCluster(t *testing.T) {
257
252
test .Expect (err ).NotTo (HaveOccurred ())
258
253
test .T ().Logf ("Created RayJob %s/%s successfully" , rayJob .Namespace , rayJob .Name )
259
254
260
- var rayDashboardURL url.URL
261
- if IsOpenShift (test ) {
262
- // Create a route to expose the Ray cluster API
263
- route := & routev1.Route {
264
- TypeMeta : metav1.TypeMeta {
265
- APIVersion : routev1 .GroupVersion .String (),
266
- Kind : "Route" ,
267
- },
268
- ObjectMeta : metav1.ObjectMeta {
269
- Namespace : namespace .Name ,
270
- Name : "ray-dashboard" ,
271
- },
272
- Spec : routev1.RouteSpec {
273
- To : routev1.RouteTargetReference {
274
- Name : "raycluster-head-svc" ,
275
- },
276
- Port : & routev1.RoutePort {
277
- TargetPort : intstr .FromString ("dashboard" ),
278
- },
279
- },
280
- }
281
-
282
- _ , err := test .Client ().Route ().RouteV1 ().Routes (namespace .Name ).Create (test .Ctx (), route , metav1.CreateOptions {})
283
- test .Expect (err ).NotTo (HaveOccurred ())
284
- test .T ().Logf ("Created Route %s/%s successfully" , route .Namespace , route .Name )
285
-
286
- test .T ().Logf ("Waiting for Route %s/%s to be admitted" , route .Namespace , route .Name )
287
- test .Eventually (Route (test , route .Namespace , route .Name ), TestTimeoutMedium ).
288
- Should (WithTransform (ConditionStatus (routev1 .RouteAdmitted ), Equal (corev1 .ConditionTrue )))
289
-
290
- route = GetRoute (test , route .Namespace , route .Name )
291
-
292
- rayDashboardURL = url.URL {
293
- Scheme : "http" ,
294
- Host : route .Status .Ingress [0 ].Host ,
295
- }
296
- } else {
297
- ingress := & networkingv1.Ingress {
298
- TypeMeta : metav1.TypeMeta {
299
- APIVersion : networkingv1 .SchemeGroupVersion .String (),
300
- Kind : "Ingress" ,
301
- },
302
- ObjectMeta : metav1.ObjectMeta {
303
- Namespace : namespace .Name ,
304
- Name : "ray-dashboard" ,
305
- Annotations : map [string ]string {
306
- "nginx.ingress.kubernetes.io/use-regex" : "true" ,
307
- "nginx.ingress.kubernetes.io/rewrite-target" : "/$2" ,
308
- },
309
- },
310
- Spec : networkingv1.IngressSpec {
311
- Rules : []networkingv1.IngressRule {
312
- {
313
- IngressRuleValue : networkingv1.IngressRuleValue {
314
- HTTP : & networkingv1.HTTPIngressRuleValue {
315
- Paths : []networkingv1.HTTPIngressPath {
316
- {
317
- Path : "/ray-dashboard(/|$)(.*)" ,
318
- PathType : Ptr (networkingv1 .PathTypePrefix ),
319
- Backend : networkingv1.IngressBackend {
320
- Service : & networkingv1.IngressServiceBackend {
321
- Name : "raycluster-head-svc" ,
322
- Port : networkingv1.ServiceBackendPort {
323
- Name : "dashboard" ,
324
- },
325
- },
326
- },
327
- },
328
- },
329
- },
330
- },
331
- },
332
- },
333
- },
334
- }
335
-
336
- _ , err := test .Client ().Core ().NetworkingV1 ().Ingresses (ingress .Namespace ).Create (test .Ctx (), ingress , metav1.CreateOptions {})
337
- test .Expect (err ).NotTo (HaveOccurred ())
338
- test .T ().Logf ("Created Ingress %s/%s successfully" , ingress .Namespace , ingress .Name )
339
-
340
- test .T ().Logf ("Waiting for Ingress %s/%s to be admitted" , ingress .Namespace , ingress .Name )
341
- test .Eventually (Ingress (test , ingress .Namespace , ingress .Name ), TestTimeoutMedium ).
342
- Should (WithTransform (LoadBalancerIngresses , HaveLen (1 )))
343
-
344
- ingress = GetIngress (test , ingress .Namespace , ingress .Name )
345
-
346
- rayDashboardURL = url.URL {
347
- Scheme : "http" ,
348
- Host : ingress .Status .LoadBalancer .Ingress [0 ].IP ,
349
- Path : "ray-dashboard" ,
350
- }
351
- }
255
+ rayDashboardURL := ExposeService (test , "ray-dashboard" , namespace .Name , "raycluster-head-svc" , "dashboard" )
352
256
353
257
test .T ().Logf ("Connecting to Ray cluster at: %s" , rayDashboardURL .String ())
354
258
rayClient := NewRayClusterClient (rayDashboardURL )
0 commit comments