Skip to content

Commit f412445

Browse files
sutaakaropenshift-merge-bot[bot]
authored andcommitted
Use Dnsmasq to provide DNS for KinD
1 parent c37c4b2 commit f412445

File tree

2 files changed

+44
-4
lines changed

2 files changed

+44
-4
lines changed

pkg/controllers/support.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,6 @@ func (r *RayClusterReconciler) getIngressHost(ctx context.Context, clientset *ku
146146
} else {
147147
return "", fmt.Errorf("missing IngressDomain configuration in ConfigMap 'codeflare-operator-config'")
148148
}
149-
if ingressDomain == "kind" {
150-
return ingressDomain, nil
151-
}
152149
return fmt.Sprintf("%s-%s.%s", ingressNameFromCluster, cluster.Namespace, ingressDomain), nil
153150
}
154151

test/e2e/mnist_rayjob_raycluster_test.go

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ limitations under the License.
1717
package e2e
1818

1919
import (
20+
"crypto/tls"
21+
"net/http"
22+
"net/url"
2023
"testing"
2124

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

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

226229
test.T().Logf("Connecting to Ray cluster at: %s", rayDashboardURL.String())
227230
rayClient := NewRayClusterClient(rayDashboardURL)
@@ -241,3 +244,43 @@ func TestMNISTRayJobRayCluster(t *testing.T) {
241244
test.Expect(GetRayJob(test, rayJob.Namespace, rayJob.Name)).
242245
To(WithTransform(RayJobStatus, Equal(rayv1.JobStatusSucceeded)))
243246
}
247+
248+
func getRayDashboardURL(test Test, namespace, rayClusterName string) url.URL {
249+
dashboardName := "ray-dashboard-" + rayClusterName
250+
251+
if IsOpenShift(test) {
252+
route := GetRoute(test, namespace, dashboardName)
253+
hostname := route.Status.Ingress[0].Host
254+
255+
// Wait for expected HTTP code
256+
test.T().Logf("Waiting for Route %s/%s to be available", route.Namespace, route.Name)
257+
tr := &http.Transport{
258+
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
259+
}
260+
client := &http.Client{Transport: tr}
261+
262+
test.Eventually(func() (int, error) {
263+
resp, err := client.Get("https://" + hostname)
264+
if err != nil {
265+
return -1, err
266+
}
267+
return resp.StatusCode, nil
268+
}, TestTimeoutShort).Should(Not(Equal(503)))
269+
270+
return url.URL{
271+
Scheme: "https",
272+
Host: hostname,
273+
}
274+
}
275+
276+
ingress := GetIngress(test, namespace, dashboardName)
277+
278+
test.T().Logf("Waiting for Ingress %s/%s to be admitted", ingress.Namespace, ingress.Name)
279+
test.Eventually(Ingress(test, ingress.Namespace, ingress.Name), TestTimeoutShort).
280+
Should(WithTransform(LoadBalancerIngresses, HaveLen(1)))
281+
282+
return url.URL{
283+
Scheme: "http",
284+
Host: ingress.Spec.Rules[0].Host,
285+
}
286+
}

0 commit comments

Comments
 (0)