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
3 changes: 0 additions & 3 deletions pkg/controllers/support.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,6 @@ func (r *RayClusterReconciler) getIngressHost(ctx context.Context, clientset *ku
} else {
return "", fmt.Errorf("missing IngressDomain configuration in ConfigMap 'codeflare-operator-config'")
}
if ingressDomain == "kind" {
return ingressDomain, nil
}
return fmt.Sprintf("%s-%s.%s", ingressNameFromCluster, cluster.Namespace, ingressDomain), nil
}

Expand Down
45 changes: 44 additions & 1 deletion test/e2e/mnist_rayjob_raycluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ limitations under the License.
package e2e

import (
"crypto/tls"
"net/http"
"net/url"
"testing"

. "github.com/onsi/gomega"
Expand Down Expand Up @@ -221,7 +224,7 @@ func TestMNISTRayJobRayCluster(t *testing.T) {
test.Expect(err).NotTo(HaveOccurred())
test.T().Logf("Created RayJob %s/%s successfully", rayJob.Namespace, rayJob.Name)

rayDashboardURL := ExposeService(test, "ray-dashboard", namespace.Name, "raycluster-head-svc", "dashboard")
rayDashboardURL := getRayDashboardURL(test, rayCluster.Namespace, rayCluster.Name)

test.T().Logf("Connecting to Ray cluster at: %s", rayDashboardURL.String())
rayClient := NewRayClusterClient(rayDashboardURL)
Expand All @@ -241,3 +244,43 @@ func TestMNISTRayJobRayCluster(t *testing.T) {
test.Expect(GetRayJob(test, rayJob.Namespace, rayJob.Name)).
To(WithTransform(RayJobStatus, Equal(rayv1.JobStatusSucceeded)))
}

func getRayDashboardURL(test Test, namespace, rayClusterName string) url.URL {
dashboardName := "ray-dashboard-" + rayClusterName

if IsOpenShift(test) {
route := GetRoute(test, namespace, dashboardName)
hostname := route.Status.Ingress[0].Host

// Wait for expected HTTP code
test.T().Logf("Waiting for Route %s/%s to be available", route.Namespace, route.Name)
tr := &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
}
client := &http.Client{Transport: tr}

test.Eventually(func() (int, error) {
resp, err := client.Get("https://" + hostname)
if err != nil {
return -1, err
}
return resp.StatusCode, nil
}, TestTimeoutShort).Should(Not(Equal(503)))

return url.URL{
Scheme: "https",
Host: hostname,
}
}

ingress := GetIngress(test, namespace, dashboardName)

test.T().Logf("Waiting for Ingress %s/%s to be admitted", ingress.Namespace, ingress.Name)
test.Eventually(Ingress(test, ingress.Namespace, ingress.Name), TestTimeoutShort).
Should(WithTransform(LoadBalancerIngresses, HaveLen(1)))

return url.URL{
Scheme: "http",
Host: ingress.Spec.Rules[0].Host,
}
}