From af258c819d83517477bed60aafac052b712544a4 Mon Sep 17 00:00:00 2001 From: Miciah Masters Date: Thu, 22 Dec 2022 13:42:11 -0500 Subject: [PATCH] e2e: Remove kubeadm-ism in DNS HostNetwork test The "[sig-network] DNS HostNetwork should resolve DNS of partial qualified names for services on hostNetwork pods with dnsPolicy: ClusterFirstWithHostNet" test assumes that a service named "kube-dns" exists in the "kube-system" namespace. This assumption is valid if the cluster was configured using kubeadm, but the assumption may be invalid otherwise. As the test uses dnsPolicy: ClusterFirst (as opposed to dnsPolicy: None), it does not need to specify the name server in dnsConfig. Omitting dnsConfig.nameservers obviates the need to look up the service. Follow-up to commit add46523526f4b342b1d0ad9f472b6ff8fb9eda6. * test/e2e/network/dns.go: Don't look up or use the kube-dns cluster IP address as it might not exist on clusters that were not configured using kubeadm. --- test/e2e/network/dns.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/test/e2e/network/dns.go b/test/e2e/network/dns.go index d9ebec996dd..53877629d23 100644 --- a/test/e2e/network/dns.go +++ b/test/e2e/network/dns.go @@ -559,11 +559,6 @@ var _ = common.SIGDescribe("DNS", func() { }) ginkgo.It("should work with the pod containing more than 6 DNS search paths and longer than 256 search list characters", func(ctx context.Context) { - ginkgo.By("Getting the kube-dns IP") - svc, err := f.ClientSet.CoreV1().Services("kube-system").Get(ctx, "kube-dns", metav1.GetOptions{}) - framework.ExpectNoError(err, "Failed to get kube-dns service") - kubednsIP := svc.Spec.ClusterIP - // All the names we need to be able to resolve. namesToResolve := []string{ "kubernetes.default", @@ -590,8 +585,7 @@ var _ = common.SIGDescribe("DNS", func() { pod := createDNSPod(f.Namespace.Name, wheezyProbeCmd, jessieProbeCmd, dnsTestPodHostName, dnsTestServiceName) pod.Spec.DNSPolicy = v1.DNSClusterFirst pod.Spec.DNSConfig = &v1.PodDNSConfig{ - Nameservers: []string{kubednsIP}, - Searches: testSearchPaths, + Searches: testSearchPaths, Options: []v1.PodDNSConfigOption{ { Name: "ndots",