Use the correct DNS service name for OKD clusters
On okd clusters, the DNS service is deployed in a different
namespace, and has a different name.
This patch addresses that difference, allowing the functional tests
to work both on k8s and okd clusters.
@@ -4529,7 +4529,13 @@ func FormatIPForURL(ip string) string {
}
func getClusterDnsServiceIP(virtClient kubecli.KubevirtClient) (string, error) {
- kubeDNSService, err := virtClient.CoreV1().Services("kube-system").Get("kube-dns", metav1.GetOptions{})
+ dnsServiceName := "kube-dns"
+ dnsNamespace := "kube-system"
+ if IsOpenShift() {
+ dnsServiceName = "dns-default"
+ dnsNamespace = "openshift-dns"
+ }
+ kubeDNSService, err := virtClient.CoreV1().Services(dnsNamespace).Get(dnsServiceName, metav1.GetOptions{})
if err != nil {
return "", err
}
