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 add4652352.

* 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.
This commit is contained in:
Miciah Masters 2022-12-22 13:42:11 -05:00 committed by Miciah Dashiel Butler Masters
parent 3a5829044c
commit af258c819d

View File

@ -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",