Skip to content

Commit

Permalink
Use Dnsmasq to provide DNS for KinD
Browse files Browse the repository at this point in the history
  • Loading branch information
sutaakar authored and openshift-merge-bot[bot] committed Apr 16, 2024
1 parent c37c4b2 commit f412445
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 4 deletions.
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,
}
}

0 comments on commit f412445

Please sign in to comment.