From b228aebaf2e9a0c2c7b069b88724f0e36ab93751 Mon Sep 17 00:00:00 2001 From: Tim Hockin Date: Sat, 31 Aug 2024 13:34:55 -0700 Subject: [PATCH 1/3] Clean up DNS e2e wrt Jessie/Wheezy --- test/e2e/network/dns.go | 130 +++++++----------- test/e2e/network/dns_common.go | 14 +- test/e2e/storage/testsuites/multivolume.go | 4 +- test/images/.permitted-images | 1 - test/images/image-util.sh | 2 +- test/images/jessie-dnsutils/BASEIMAGE | 7 - test/images/jessie-dnsutils/Dockerfile | 32 ----- .../images/jessie-dnsutils/Dockerfile_windows | 28 ---- test/images/jessie-dnsutils/OWNERS | 3 - test/images/jessie-dnsutils/README.md | 4 - test/images/jessie-dnsutils/VERSION | 1 - test/images/jessie-dnsutils/fixup-apt-list.sh | 32 ----- test/utils/image/manifest.go | 3 - 13 files changed, 58 insertions(+), 203 deletions(-) delete mode 100644 test/images/jessie-dnsutils/BASEIMAGE delete mode 100644 test/images/jessie-dnsutils/Dockerfile delete mode 100644 test/images/jessie-dnsutils/Dockerfile_windows delete mode 100644 test/images/jessie-dnsutils/OWNERS delete mode 100644 test/images/jessie-dnsutils/README.md delete mode 100644 test/images/jessie-dnsutils/VERSION delete mode 100755 test/images/jessie-dnsutils/fixup-apt-list.sh diff --git a/test/e2e/network/dns.go b/test/e2e/network/dns.go index 54ce81f4133..3853daae2fe 100644 --- a/test/e2e/network/dns.go +++ b/test/e2e/network/dns.go @@ -58,15 +58,13 @@ var _ = common.SIGDescribe("DNS", func() { fmt.Sprintf("kubernetes.default.svc.%s", framework.TestContext.ClusterDNSDomain), } // TODO: Validate both IPv4 and IPv6 families for dual-stack - wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, nil, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) - jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, nil, "", "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) - ginkgo.By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") - ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n") + probeCmd, fileNames := createProbeCommand(namesToResolve, nil, "", "dns", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + ginkgo.By("Running these commands: " + probeCmd + "\n") // Run a pod which probes DNS and exposes the results by HTTP. ginkgo.By("creating a pod to probe DNS") - pod := createDNSPod(f.Namespace.Name, wheezyProbeCmd, jessieProbeCmd, dnsTestPodHostName, dnsTestServiceName) - validateDNSResults(ctx, f, pod, append(wheezyFileNames, jessieFileNames...)) + pod := createDNSPod(f.Namespace.Name, probeCmd, dnsTestPodHostName, dnsTestServiceName) + validateDNSResults(ctx, f, pod, fileNames) }) // Added due to #8512. This is critical for GCE and GKE deployments. @@ -80,15 +78,13 @@ var _ = common.SIGDescribe("DNS", func() { } // TODO: Validate both IPv4 and IPv6 families for dual-stack - wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, nil, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) - jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, nil, "", "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) - ginkgo.By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") - ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n") + probeCmd, fileNames := createProbeCommand(namesToResolve, nil, "", "dns", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + ginkgo.By("Running these commands: " + probeCmd + "\n") // Run a pod which probes DNS and exposes the results by HTTP. ginkgo.By("creating a pod to probe DNS") - pod := createDNSPod(f.Namespace.Name, wheezyProbeCmd, jessieProbeCmd, dnsTestPodHostName, dnsTestServiceName) - validateDNSResults(ctx, f, pod, append(wheezyFileNames, jessieFileNames...)) + pod := createDNSPod(f.Namespace.Name, probeCmd, dnsTestPodHostName, dnsTestServiceName) + validateDNSResults(ctx, f, pod, fileNames) }) // [LinuxOnly]: As Windows currently does not support resolving PQDNs. @@ -101,15 +97,13 @@ var _ = common.SIGDescribe("DNS", func() { hostFQDN := fmt.Sprintf("%s.%s.%s.svc.%s", dnsTestPodHostName, dnsTestServiceName, f.Namespace.Name, framework.TestContext.ClusterDNSDomain) hostEntries := []string{hostFQDN, dnsTestPodHostName} // TODO: Validate both IPv4 and IPv6 families for dual-stack - wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, hostEntries, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) - jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, hostEntries, "", "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) - ginkgo.By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") - ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n") + probeCmd, fileNames := createProbeCommand(namesToResolve, hostEntries, "", "dns", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + ginkgo.By("Running these commands: " + probeCmd + "\n") // Run a pod which probes DNS and exposes the results by HTTP. ginkgo.By("creating a pod to probe DNS") - pod := createDNSPod(f.Namespace.Name, wheezyProbeCmd, jessieProbeCmd, dnsTestPodHostName, dnsTestServiceName) - validateDNSResults(ctx, f, pod, append(wheezyFileNames, jessieFileNames...)) + pod := createDNSPod(f.Namespace.Name, probeCmd, dnsTestPodHostName, dnsTestServiceName) + validateDNSResults(ctx, f, pod, fileNames) }) /* @@ -121,15 +115,13 @@ var _ = common.SIGDescribe("DNS", func() { hostFQDN := fmt.Sprintf("%s.%s.%s.svc.%s", dnsTestPodHostName, dnsTestServiceName, f.Namespace.Name, framework.TestContext.ClusterDNSDomain) hostEntries := []string{hostFQDN, dnsTestPodHostName} // TODO: Validate both IPv4 and IPv6 families for dual-stack - wheezyProbeCmd, wheezyFileNames := createProbeCommand(nil, hostEntries, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) - jessieProbeCmd, jessieFileNames := createProbeCommand(nil, hostEntries, "", "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) - ginkgo.By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") - ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n") + probeCmd, fileNames := createProbeCommand(nil, hostEntries, "", "dns", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + ginkgo.By("Running these commands: " + probeCmd + "\n") // Run a pod which probes /etc/hosts and exposes the results by HTTP. ginkgo.By("creating a pod to probe /etc/hosts") - pod := createDNSPod(f.Namespace.Name, wheezyProbeCmd, jessieProbeCmd, dnsTestPodHostName, dnsTestServiceName) - validateDNSResults(ctx, f, pod, append(wheezyFileNames, jessieFileNames...)) + pod := createDNSPod(f.Namespace.Name, probeCmd, dnsTestPodHostName, dnsTestServiceName) + validateDNSResults(ctx, f, pod, fileNames) }) /* @@ -172,17 +164,15 @@ var _ = common.SIGDescribe("DNS", func() { } // TODO: Validate both IPv4 and IPv6 families for dual-stack - wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, nil, regularService.Spec.ClusterIP, "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) - jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, nil, regularService.Spec.ClusterIP, "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) - ginkgo.By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") - ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n") + probeCmd, fileNames := createProbeCommand(namesToResolve, nil, regularService.Spec.ClusterIP, "dns", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + ginkgo.By("Running these commands: " + probeCmd + "\n") // Run a pod which probes DNS and exposes the results by HTTP. ginkgo.By("creating a pod to probe DNS") - pod := createDNSPod(f.Namespace.Name, wheezyProbeCmd, jessieProbeCmd, dnsTestPodHostName, dnsTestServiceName) + pod := createDNSPod(f.Namespace.Name, probeCmd, dnsTestPodHostName, dnsTestServiceName) pod.ObjectMeta.Labels = testServiceSelector - validateDNSResults(ctx, f, pod, append(wheezyFileNames, jessieFileNames...)) + validateDNSResults(ctx, f, pod, fileNames) }) /* @@ -225,17 +215,15 @@ var _ = common.SIGDescribe("DNS", func() { } // TODO: Validate both IPv4 and IPv6 families for dual-stack - wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, nil, regularService.Spec.ClusterIP, "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) - jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, nil, regularService.Spec.ClusterIP, "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) - ginkgo.By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") - ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n") + probeCmd, fileNames := createProbeCommand(namesToResolve, nil, regularService.Spec.ClusterIP, "dns", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + ginkgo.By("Running these commands: " + probeCmd + "\n") // Run a pod which probes DNS and exposes the results by HTTP. ginkgo.By("creating a pod to probe DNS") - pod := createDNSPod(f.Namespace.Name, wheezyProbeCmd, jessieProbeCmd, dnsTestPodHostName, dnsTestServiceName) + pod := createDNSPod(f.Namespace.Name, probeCmd, dnsTestPodHostName, dnsTestServiceName) pod.ObjectMeta.Labels = testServiceSelector - validateDNSResults(ctx, f, pod, append(wheezyFileNames, jessieFileNames...)) + validateDNSResults(ctx, f, pod, fileNames) }) /* @@ -265,19 +253,17 @@ var _ = common.SIGDescribe("DNS", func() { hostFQDN := fmt.Sprintf("%s.%s.%s.svc.%s", podHostname, serviceName, f.Namespace.Name, framework.TestContext.ClusterDNSDomain) hostNames := []string{hostFQDN, podHostname} // TODO: Validate both IPv4 and IPv6 families for dual-stack - wheezyProbeCmd, wheezyFileNames := createProbeCommand(nil, hostNames, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) - jessieProbeCmd, jessieFileNames := createProbeCommand(nil, hostNames, "", "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) - ginkgo.By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") - ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n") + probeCmd, fileNames := createProbeCommand(nil, hostNames, "", "dns", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + ginkgo.By("Running these commands: " + probeCmd + "\n") // Run a pod which probes DNS and exposes the results by HTTP. ginkgo.By("creating a pod to probe DNS") - pod1 := createDNSPod(f.Namespace.Name, wheezyProbeCmd, jessieProbeCmd, dnsTestPodHostName, dnsTestServiceName) + pod1 := createDNSPod(f.Namespace.Name, probeCmd, dnsTestPodHostName, dnsTestServiceName) pod1.ObjectMeta.Labels = testServiceSelector pod1.Spec.Hostname = podHostname pod1.Spec.Subdomain = serviceName - validateDNSResults(ctx, f, pod1, append(wheezyFileNames, jessieFileNames...)) + validateDNSResults(ctx, f, pod1, fileNames) }) /* @@ -308,19 +294,17 @@ var _ = common.SIGDescribe("DNS", func() { subdomain := fmt.Sprintf("%s.%s.svc.%s", serviceName, f.Namespace.Name, framework.TestContext.ClusterDNSDomain) namesToResolve := []string{hostFQDN, subdomain} // TODO: Validate both IPv4 and IPv6 families for dual-stack - wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, nil, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) - jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, nil, "", "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) - ginkgo.By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") - ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n") + probeCmd, fileNames := createProbeCommand(namesToResolve, nil, "", "dns", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + ginkgo.By("Running these commands: " + probeCmd + "\n") // Run a pod which probes DNS and exposes the results by HTTP. ginkgo.By("creating a pod to probe DNS") - pod1 := createDNSPod(f.Namespace.Name, wheezyProbeCmd, jessieProbeCmd, dnsTestPodHostName, dnsTestServiceName) + pod1 := createDNSPod(f.Namespace.Name, probeCmd, dnsTestPodHostName, dnsTestServiceName) pod1.ObjectMeta.Labels = testServiceSelector pod1.Spec.Hostname = podHostname pod1.Spec.Subdomain = serviceName - validateDNSResults(ctx, f, pod1, append(wheezyFileNames, jessieFileNames...)) + validateDNSResults(ctx, f, pod1, fileNames) }) /* @@ -343,16 +327,14 @@ var _ = common.SIGDescribe("DNS", func() { return f.ClientSet.CoreV1().Services(f.Namespace.Name).Delete(ctx, externalNameService.Name, metav1.DeleteOptions{}) }) hostFQDN := fmt.Sprintf("%s.%s.svc.%s", serviceName, f.Namespace.Name, framework.TestContext.ClusterDNSDomain) - wheezyProbeCmd, wheezyFileName := createTargetedProbeCommand(hostFQDN, "CNAME", "wheezy") - jessieProbeCmd, jessieFileName := createTargetedProbeCommand(hostFQDN, "CNAME", "jessie") - ginkgo.By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") - ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n") + probeCmd, fileName := createTargetedProbeCommand(hostFQDN, "CNAME", "dns") + ginkgo.By("Running these commands: " + probeCmd + "\n") // Run a pod which probes DNS and exposes the results by HTTP. ginkgo.By("creating a pod to probe DNS") - pod1 := createDNSPod(f.Namespace.Name, wheezyProbeCmd, jessieProbeCmd, dnsTestPodHostName, dnsTestServiceName) + pod1 := createDNSPod(f.Namespace.Name, probeCmd, dnsTestPodHostName, dnsTestServiceName) - validateTargetedProbeOutput(ctx, f, pod1, []string{wheezyFileName, jessieFileName}, "foo.example.com.") + validateTargetedProbeOutput(ctx, f, pod1, []string{fileName}, "foo.example.com.") // Test changing the externalName field ginkgo.By("changing the externalName to bar.example.com") @@ -360,16 +342,14 @@ var _ = common.SIGDescribe("DNS", func() { s.Spec.ExternalName = "bar.example.com" }) framework.ExpectNoError(err, "failed to change externalName of service: %s", serviceName) - wheezyProbeCmd, wheezyFileName = createTargetedProbeCommand(hostFQDN, "CNAME", "wheezy") - jessieProbeCmd, jessieFileName = createTargetedProbeCommand(hostFQDN, "CNAME", "jessie") - ginkgo.By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") - ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n") + probeCmd, fileName = createTargetedProbeCommand(hostFQDN, "CNAME", "dns") + ginkgo.By("Running these commands: " + probeCmd + "\n") // Run a pod which probes DNS and exposes the results by HTTP. ginkgo.By("creating a second pod to probe DNS") - pod2 := createDNSPod(f.Namespace.Name, wheezyProbeCmd, jessieProbeCmd, dnsTestPodHostName, dnsTestServiceName) + pod2 := createDNSPod(f.Namespace.Name, probeCmd, dnsTestPodHostName, dnsTestServiceName) - validateTargetedProbeOutput(ctx, f, pod2, []string{wheezyFileName, jessieFileName}, "bar.example.com.") + validateTargetedProbeOutput(ctx, f, pod2, []string{fileName}, "bar.example.com.") // Test changing type from ExternalName to ClusterIP ginkgo.By("changing the service to type=ClusterIP") @@ -386,19 +366,17 @@ var _ = common.SIGDescribe("DNS", func() { } // TODO: For dual stack we can run from here two createTargetedProbeCommand() // one looking for an A record and another one for an AAAA record - wheezyProbeCmd, wheezyFileName = createTargetedProbeCommand(hostFQDN, targetRecord, "wheezy") - jessieProbeCmd, jessieFileName = createTargetedProbeCommand(hostFQDN, targetRecord, "jessie") - ginkgo.By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") - ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n") + probeCmd, fileName = createTargetedProbeCommand(hostFQDN, targetRecord, "dns") + ginkgo.By("Running these commands: " + probeCmd + "\n") // Run a pod which probes DNS and exposes the results by HTTP. ginkgo.By("creating a third pod to probe DNS") - pod3 := createDNSPod(f.Namespace.Name, wheezyProbeCmd, jessieProbeCmd, dnsTestPodHostName, dnsTestServiceName) + pod3 := createDNSPod(f.Namespace.Name, probeCmd, dnsTestPodHostName, dnsTestServiceName) svc, err := f.ClientSet.CoreV1().Services(f.Namespace.Name).Get(ctx, externalNameService.Name, metav1.GetOptions{}) framework.ExpectNoError(err, "failed to get service: %s", externalNameService.Name) - validateTargetedProbeOutput(ctx, f, pod3, []string{wheezyFileName, jessieFileName}, svc.Spec.ClusterIP) + validateTargetedProbeOutput(ctx, f, pod3, []string{fileName}, svc.Spec.ClusterIP) }) /* @@ -570,10 +548,8 @@ var _ = common.SIGDescribe("DNS", func() { hostFQDN := fmt.Sprintf("%s.%s.%s.svc.%s", dnsTestPodHostName, dnsTestServiceName, f.Namespace.Name, framework.TestContext.ClusterDNSDomain) hostEntries := []string{hostFQDN, dnsTestPodHostName} // TODO: Validate both IPv4 and IPv6 families for dual-stack - wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, hostEntries, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) - jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, hostEntries, "", "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) - ginkgo.By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") - ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n") + probeCmd, fileNames := createProbeCommand(namesToResolve, hostEntries, "", "dns", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + ginkgo.By("Running these commands: " + probeCmd + "\n") ginkgo.By("Creating a pod with expanded DNS configuration to probe DNS") testNdotsValue := "5" @@ -585,7 +561,7 @@ var _ = common.SIGDescribe("DNS", func() { fmt.Sprintf("%038d.k8s.io", 5), fmt.Sprintf("%038d.k8s.io", 6), // 260 characters } - pod := createDNSPod(f.Namespace.Name, wheezyProbeCmd, jessieProbeCmd, dnsTestPodHostName, dnsTestServiceName) + pod := createDNSPod(f.Namespace.Name, probeCmd, dnsTestPodHostName, dnsTestServiceName) pod.Spec.DNSPolicy = v1.DNSClusterFirst pod.Spec.DNSConfig = &v1.PodDNSConfig{ Searches: testSearchPaths, @@ -596,7 +572,7 @@ var _ = common.SIGDescribe("DNS", func() { }, }, } - validateDNSResults(ctx, f, pod, append(wheezyFileNames, jessieFileNames...)) + validateDNSResults(ctx, f, pod, fileNames) }) }) @@ -663,18 +639,16 @@ var _ = common.SIGDescribe("DNS HostNetwork", func() { } // TODO: Validate both IPv4 and IPv6 families for dual-stack - wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, nil, regularService.Spec.ClusterIP, "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) - jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, nil, regularService.Spec.ClusterIP, "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) - ginkgo.By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") - ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n") + probeCmd, fileNames := createProbeCommand(namesToResolve, nil, regularService.Spec.ClusterIP, "dns", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + ginkgo.By("Running these commands: " + probeCmd + "\n") // Run a pod which probes DNS and exposes the results by HTTP. ginkgo.By("creating a pod to probe DNS") - pod := createDNSPod(f.Namespace.Name, wheezyProbeCmd, jessieProbeCmd, dnsTestPodHostName, dnsTestServiceName) + pod := createDNSPod(f.Namespace.Name, probeCmd, dnsTestPodHostName, dnsTestServiceName) pod.ObjectMeta.Labels = testServiceSelector pod.Spec.HostNetwork = true pod.Spec.DNSPolicy = v1.DNSClusterFirstWithHostNet - validateDNSResults(ctx, f, pod, append(wheezyFileNames, jessieFileNames...)) + validateDNSResults(ctx, f, pod, fileNames) }) // https://issues.k8s.io/67019 diff --git a/test/e2e/network/dns_common.go b/test/e2e/network/dns_common.go index 9d64c5aae39..6e0f3830045 100644 --- a/test/e2e/network/dns_common.go +++ b/test/e2e/network/dns_common.go @@ -35,7 +35,6 @@ import ( clientset "k8s.io/client-go/kubernetes" "k8s.io/kubernetes/test/e2e/framework" e2epod "k8s.io/kubernetes/test/e2e/framework/pod" - imageutils "k8s.io/kubernetes/test/utils/image" dnsclient "k8s.io/kubernetes/third_party/forked/golang/net" admissionapi "k8s.io/pod-security-admission/api" @@ -352,7 +351,7 @@ func (t *dnsTestCommon) deleteDNSServerPod(ctx context.Context) { } } -func createDNSPod(namespace, wheezyProbeCmd, jessieProbeCmd, podHostName, serviceName string) *v1.Pod { +func createDNSPod(namespace, probeCmd, podHostName, serviceName string) *v1.Pod { podName := "dns-test-" + string(uuid.NewUUID()) volumes := []v1.Volume{ { @@ -373,17 +372,10 @@ func createDNSPod(namespace, wheezyProbeCmd, jessieProbeCmd, podHostName, servic dnsPod := e2epod.NewAgnhostPod(namespace, podName, volumes, mounts, nil, "test-webserver") dnsPod.Spec.Containers[0].Name = "webserver" - querier := e2epod.NewAgnhostContainer("querier", mounts, nil, wheezyProbeCmd) + querier := e2epod.NewAgnhostContainer("querier", mounts, nil, probeCmd) querier.Command = []string{"sh", "-c"} - jessieQuerier := v1.Container{ - Name: "jessie-querier", - Image: imageutils.GetE2EImage(imageutils.JessieDnsutils), - Command: []string{"sh", "-c", jessieProbeCmd}, - VolumeMounts: mounts, - } - - dnsPod.Spec.Containers = append(dnsPod.Spec.Containers, querier, jessieQuerier) + dnsPod.Spec.Containers = append(dnsPod.Spec.Containers, querier) dnsPod.Spec.Hostname = podHostName dnsPod.Spec.Subdomain = serviceName diff --git a/test/e2e/storage/testsuites/multivolume.go b/test/e2e/storage/testsuites/multivolume.go index 8c4363f0501..25c6fa89408 100644 --- a/test/e2e/storage/testsuites/multivolume.go +++ b/test/e2e/storage/testsuites/multivolume.go @@ -565,7 +565,7 @@ func TestConcurrentAccessToSingleVolume(ctx context.Context, f *framework.Framew SeLinuxLabel: e2epod.GetLinuxLabel(), NodeSelection: node, PVCsReadOnly: readOnly, - ImageID: e2epod.GetTestImageID(imageutils.JessieDnsutils), + ImageID: e2epod.GetTestImageID(imageutils.Agnhost), } pod, err := e2epod.CreateSecPodWithNodeSelection(ctx, cs, &podConfig, f.Timeouts.PodStart) framework.ExpectNoError(err) @@ -687,7 +687,7 @@ func TestConcurrentAccessToRelatedVolumes(ctx context.Context, f *framework.Fram SeLinuxLabel: e2epod.GetLinuxLabel(), NodeSelection: node, PVCsReadOnly: false, - ImageID: e2epod.GetTestImageID(imageutils.JessieDnsutils), + ImageID: e2epod.GetTestImageID(imageutils.Agnhost), } pod, err := e2epod.CreateSecPodWithNodeSelection(ctx, cs, &podConfig, f.Timeouts.PodStart) defer func() { diff --git a/test/images/.permitted-images b/test/images/.permitted-images index ec7dac61ab5..219cf73a460 100644 --- a/test/images/.permitted-images +++ b/test/images/.permitted-images @@ -14,7 +14,6 @@ registry.k8s.io/e2e-test-images/apparmor-loader registry.k8s.io/e2e-test-images/busybox registry.k8s.io/e2e-test-images/httpd registry.k8s.io/e2e-test-images/ipc-utils -registry.k8s.io/e2e-test-images/jessie-dnsutils registry.k8s.io/e2e-test-images/kitten registry.k8s.io/e2e-test-images/nautilus registry.k8s.io/e2e-test-images/nginx diff --git a/test/images/image-util.sh b/test/images/image-util.sh index 12c2d3e5933..cc0065c6b14 100755 --- a/test/images/image-util.sh +++ b/test/images/image-util.sh @@ -283,7 +283,7 @@ if [[ "${WHAT}" == "all-conformance" ]]; then # Discussed during Conformance Office Hours Meeting (2019.12.17): # https://docs.google.com/document/d/1W31nXh9RYAb_VaYkwuPLd1hFxuRX3iU0DmaQ4lkCsX8/edit#heading=h.l87lu17xm9bh shift - conformance_images=("busybox" "agnhost" "jessie-dnsutils" "kitten" "nautilus" "nonewprivs" "resource-consumer" "sample-apiserver") + conformance_images=("busybox" "agnhost" "kitten" "nautilus" "nonewprivs" "resource-consumer" "sample-apiserver") for image in "${conformance_images[@]}"; do "${TASK}" "${image}" "$@" done diff --git a/test/images/jessie-dnsutils/BASEIMAGE b/test/images/jessie-dnsutils/BASEIMAGE deleted file mode 100644 index 76dd97afd76..00000000000 --- a/test/images/jessie-dnsutils/BASEIMAGE +++ /dev/null @@ -1,7 +0,0 @@ -linux/amd64=debian:jessie -linux/arm=arm32v7/debian:jessie -linux/arm64=arm64v8/debian:jessie -linux/ppc64le=ppc64le/debian:jessie -linux/s390x=s390x/debian:jessie -windows/amd64/1809=REGISTRY/busybox:1.29-2-windows-amd64-1809 -windows/amd64/ltsc2022=REGISTRY/busybox:1.29-2-windows-amd64-ltsc2022 diff --git a/test/images/jessie-dnsutils/Dockerfile b/test/images/jessie-dnsutils/Dockerfile deleted file mode 100644 index 9fd6a276a05..00000000000 --- a/test/images/jessie-dnsutils/Dockerfile +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright 2016 The Kubernetes Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -ARG BASEIMAGE -FROM $BASEIMAGE - -CROSS_BUILD_COPY qemu-QEMUARCH-static /usr/bin/ - -# WARNING: Please note that the script below removes the security packages from arm64 and ppc64el images -# as they do not exist anymore in the debian repositories for jessie. So we do not recommend using this -# image for any production use and limit use of this image to just test scenarios. - -COPY fixup-apt-list.sh / -RUN ["/fixup-apt-list.sh"] - -RUN apt-get -q update && \ - apt-get install -y --force-yes dnsutils && \ - apt-get clean - -ADD https://github.com/coredns/coredns/releases/download/v1.5.0/coredns_1.5.0_linux_BASEARCH.tgz /coredns.tgz -RUN tar -xzvf /coredns.tgz && rm -f /coredns.tgz diff --git a/test/images/jessie-dnsutils/Dockerfile_windows b/test/images/jessie-dnsutils/Dockerfile_windows deleted file mode 100644 index 445852ad899..00000000000 --- a/test/images/jessie-dnsutils/Dockerfile_windows +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright 2020 The Kubernetes Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -ARG BASEIMAGE - -# We're using a Linux image to unpack the archive, then we're copying it over to Windows. -FROM --platform=linux/amd64 alpine:3.6 as prep - -ADD https://github.com/coredns/coredns/releases/download/v1.5.0/coredns_1.5.0_windows_amd64.tgz /coredns.tgz -RUN tar -xzvf /coredns.tgz - -FROM $BASEIMAGE - -COPY --from=prep /coredns.exe /coredns.exe - -# NOTE(claudiub): docker buildx sets the PATH env variable to a Linux-like PATH, which is not desirable. -ENV PATH="C:\dig\;C:\bin;C:\curl;C:\Windows\System32;C:\Windows;C:\Program Files\PowerShell;" diff --git a/test/images/jessie-dnsutils/OWNERS b/test/images/jessie-dnsutils/OWNERS deleted file mode 100644 index 11e4263977e..00000000000 --- a/test/images/jessie-dnsutils/OWNERS +++ /dev/null @@ -1,3 +0,0 @@ -approvers: - - dims - - mkumatag diff --git a/test/images/jessie-dnsutils/README.md b/test/images/jessie-dnsutils/README.md deleted file mode 100644 index b0c433127e9..00000000000 --- a/test/images/jessie-dnsutils/README.md +++ /dev/null @@ -1,4 +0,0 @@ -# jessie-dnsutils - -DNS utils but implemented in a different OS to have some basic check across OSes. -See issue #10161 for original issue and discussion. \ No newline at end of file diff --git a/test/images/jessie-dnsutils/VERSION b/test/images/jessie-dnsutils/VERSION deleted file mode 100644 index d3bdbdf1fda..00000000000 --- a/test/images/jessie-dnsutils/VERSION +++ /dev/null @@ -1 +0,0 @@ -1.7 diff --git a/test/images/jessie-dnsutils/fixup-apt-list.sh b/test/images/jessie-dnsutils/fixup-apt-list.sh deleted file mode 100755 index a9aa4f123dc..00000000000 --- a/test/images/jessie-dnsutils/fixup-apt-list.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env bash - -# Copyright 2017 The Kubernetes Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -DEB_ARCH=$(dpkg --print-architecture) - -# http://security.debian.org/debian-security/dists/jessie/updates/InRelease is missing -# entries for some platforms, so we just remove the last line in sources.list in -# /etc/apt/sources.list which is "deb http://deb.debian.org/debian jessie-updates main" - -case ${DEB_ARCH} in - s390x|arm64|ppc64el) - # We have to use the archive mirrors. - # See: https://lists.debian.org/debian-devel-announce/2019/03/msg00006.html - echo "deb http://archive.debian.org/debian/ jessie main contrib non-free" | tee /etc/apt/sources.list - echo "deb-src http://archive.debian.org/debian/ jessie main contrib non-free" | tee -a /etc/apt/sources.list - ;; -esac - -exit 0 diff --git a/test/utils/image/manifest.go b/test/utils/image/manifest.go index d08a9538f82..a0504cfd7ee 100644 --- a/test/utils/image/manifest.go +++ b/test/utils/image/manifest.go @@ -175,8 +175,6 @@ const ( InvalidRegistryImage // IpcUtils image IpcUtils - // JessieDnsutils image - JessieDnsutils // Kitten image Kitten // Nautilus image @@ -229,7 +227,6 @@ func initImageConfigs(list RegistryList) (map[ImageID]Config, map[ImageID]Config configs[HttpdNew] = Config{list.PromoterE2eRegistry, "httpd", "2.4.39-4"} configs[InvalidRegistryImage] = Config{list.InvalidRegistry, "alpine", "3.1"} configs[IpcUtils] = Config{list.PromoterE2eRegistry, "ipc-utils", "1.3"} - configs[JessieDnsutils] = Config{list.PromoterE2eRegistry, "jessie-dnsutils", "1.7"} configs[Kitten] = Config{list.PromoterE2eRegistry, "kitten", "1.7"} configs[Nautilus] = Config{list.PromoterE2eRegistry, "nautilus", "1.7"} configs[NFSProvisioner] = Config{list.SigStorageRegistry, "nfs-provisioner", "v4.0.8"} From 094a11b5cb63b4007518a3a91c79a74f0ff1f590 Mon Sep 17 00:00:00 2001 From: Tim Hockin Date: Mon, 16 Sep 2024 13:20:28 -0700 Subject: [PATCH 2/3] Revert "Clean up DNS e2e wrt Jessie/Wheezy" This reverts commit eeb36da2b97e87b3534c7bece9355cefc6f16472. --- test/e2e/network/dns.go | 130 +++++++++++------- test/e2e/network/dns_common.go | 14 +- test/e2e/storage/testsuites/multivolume.go | 4 +- test/images/.permitted-images | 1 + test/images/image-util.sh | 2 +- test/images/jessie-dnsutils/BASEIMAGE | 7 + test/images/jessie-dnsutils/Dockerfile | 32 +++++ .../images/jessie-dnsutils/Dockerfile_windows | 28 ++++ test/images/jessie-dnsutils/OWNERS | 3 + test/images/jessie-dnsutils/README.md | 4 + test/images/jessie-dnsutils/VERSION | 1 + test/images/jessie-dnsutils/fixup-apt-list.sh | 32 +++++ test/utils/image/manifest.go | 3 + 13 files changed, 203 insertions(+), 58 deletions(-) create mode 100644 test/images/jessie-dnsutils/BASEIMAGE create mode 100644 test/images/jessie-dnsutils/Dockerfile create mode 100644 test/images/jessie-dnsutils/Dockerfile_windows create mode 100644 test/images/jessie-dnsutils/OWNERS create mode 100644 test/images/jessie-dnsutils/README.md create mode 100644 test/images/jessie-dnsutils/VERSION create mode 100755 test/images/jessie-dnsutils/fixup-apt-list.sh diff --git a/test/e2e/network/dns.go b/test/e2e/network/dns.go index 3853daae2fe..54ce81f4133 100644 --- a/test/e2e/network/dns.go +++ b/test/e2e/network/dns.go @@ -58,13 +58,15 @@ var _ = common.SIGDescribe("DNS", func() { fmt.Sprintf("kubernetes.default.svc.%s", framework.TestContext.ClusterDNSDomain), } // TODO: Validate both IPv4 and IPv6 families for dual-stack - probeCmd, fileNames := createProbeCommand(namesToResolve, nil, "", "dns", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) - ginkgo.By("Running these commands: " + probeCmd + "\n") + wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, nil, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, nil, "", "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + ginkgo.By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") + ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n") // Run a pod which probes DNS and exposes the results by HTTP. ginkgo.By("creating a pod to probe DNS") - pod := createDNSPod(f.Namespace.Name, probeCmd, dnsTestPodHostName, dnsTestServiceName) - validateDNSResults(ctx, f, pod, fileNames) + pod := createDNSPod(f.Namespace.Name, wheezyProbeCmd, jessieProbeCmd, dnsTestPodHostName, dnsTestServiceName) + validateDNSResults(ctx, f, pod, append(wheezyFileNames, jessieFileNames...)) }) // Added due to #8512. This is critical for GCE and GKE deployments. @@ -78,13 +80,15 @@ var _ = common.SIGDescribe("DNS", func() { } // TODO: Validate both IPv4 and IPv6 families for dual-stack - probeCmd, fileNames := createProbeCommand(namesToResolve, nil, "", "dns", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) - ginkgo.By("Running these commands: " + probeCmd + "\n") + wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, nil, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, nil, "", "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + ginkgo.By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") + ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n") // Run a pod which probes DNS and exposes the results by HTTP. ginkgo.By("creating a pod to probe DNS") - pod := createDNSPod(f.Namespace.Name, probeCmd, dnsTestPodHostName, dnsTestServiceName) - validateDNSResults(ctx, f, pod, fileNames) + pod := createDNSPod(f.Namespace.Name, wheezyProbeCmd, jessieProbeCmd, dnsTestPodHostName, dnsTestServiceName) + validateDNSResults(ctx, f, pod, append(wheezyFileNames, jessieFileNames...)) }) // [LinuxOnly]: As Windows currently does not support resolving PQDNs. @@ -97,13 +101,15 @@ var _ = common.SIGDescribe("DNS", func() { hostFQDN := fmt.Sprintf("%s.%s.%s.svc.%s", dnsTestPodHostName, dnsTestServiceName, f.Namespace.Name, framework.TestContext.ClusterDNSDomain) hostEntries := []string{hostFQDN, dnsTestPodHostName} // TODO: Validate both IPv4 and IPv6 families for dual-stack - probeCmd, fileNames := createProbeCommand(namesToResolve, hostEntries, "", "dns", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) - ginkgo.By("Running these commands: " + probeCmd + "\n") + wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, hostEntries, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, hostEntries, "", "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + ginkgo.By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") + ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n") // Run a pod which probes DNS and exposes the results by HTTP. ginkgo.By("creating a pod to probe DNS") - pod := createDNSPod(f.Namespace.Name, probeCmd, dnsTestPodHostName, dnsTestServiceName) - validateDNSResults(ctx, f, pod, fileNames) + pod := createDNSPod(f.Namespace.Name, wheezyProbeCmd, jessieProbeCmd, dnsTestPodHostName, dnsTestServiceName) + validateDNSResults(ctx, f, pod, append(wheezyFileNames, jessieFileNames...)) }) /* @@ -115,13 +121,15 @@ var _ = common.SIGDescribe("DNS", func() { hostFQDN := fmt.Sprintf("%s.%s.%s.svc.%s", dnsTestPodHostName, dnsTestServiceName, f.Namespace.Name, framework.TestContext.ClusterDNSDomain) hostEntries := []string{hostFQDN, dnsTestPodHostName} // TODO: Validate both IPv4 and IPv6 families for dual-stack - probeCmd, fileNames := createProbeCommand(nil, hostEntries, "", "dns", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) - ginkgo.By("Running these commands: " + probeCmd + "\n") + wheezyProbeCmd, wheezyFileNames := createProbeCommand(nil, hostEntries, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + jessieProbeCmd, jessieFileNames := createProbeCommand(nil, hostEntries, "", "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + ginkgo.By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") + ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n") // Run a pod which probes /etc/hosts and exposes the results by HTTP. ginkgo.By("creating a pod to probe /etc/hosts") - pod := createDNSPod(f.Namespace.Name, probeCmd, dnsTestPodHostName, dnsTestServiceName) - validateDNSResults(ctx, f, pod, fileNames) + pod := createDNSPod(f.Namespace.Name, wheezyProbeCmd, jessieProbeCmd, dnsTestPodHostName, dnsTestServiceName) + validateDNSResults(ctx, f, pod, append(wheezyFileNames, jessieFileNames...)) }) /* @@ -164,15 +172,17 @@ var _ = common.SIGDescribe("DNS", func() { } // TODO: Validate both IPv4 and IPv6 families for dual-stack - probeCmd, fileNames := createProbeCommand(namesToResolve, nil, regularService.Spec.ClusterIP, "dns", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) - ginkgo.By("Running these commands: " + probeCmd + "\n") + wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, nil, regularService.Spec.ClusterIP, "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, nil, regularService.Spec.ClusterIP, "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + ginkgo.By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") + ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n") // Run a pod which probes DNS and exposes the results by HTTP. ginkgo.By("creating a pod to probe DNS") - pod := createDNSPod(f.Namespace.Name, probeCmd, dnsTestPodHostName, dnsTestServiceName) + pod := createDNSPod(f.Namespace.Name, wheezyProbeCmd, jessieProbeCmd, dnsTestPodHostName, dnsTestServiceName) pod.ObjectMeta.Labels = testServiceSelector - validateDNSResults(ctx, f, pod, fileNames) + validateDNSResults(ctx, f, pod, append(wheezyFileNames, jessieFileNames...)) }) /* @@ -215,15 +225,17 @@ var _ = common.SIGDescribe("DNS", func() { } // TODO: Validate both IPv4 and IPv6 families for dual-stack - probeCmd, fileNames := createProbeCommand(namesToResolve, nil, regularService.Spec.ClusterIP, "dns", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) - ginkgo.By("Running these commands: " + probeCmd + "\n") + wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, nil, regularService.Spec.ClusterIP, "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, nil, regularService.Spec.ClusterIP, "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + ginkgo.By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") + ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n") // Run a pod which probes DNS and exposes the results by HTTP. ginkgo.By("creating a pod to probe DNS") - pod := createDNSPod(f.Namespace.Name, probeCmd, dnsTestPodHostName, dnsTestServiceName) + pod := createDNSPod(f.Namespace.Name, wheezyProbeCmd, jessieProbeCmd, dnsTestPodHostName, dnsTestServiceName) pod.ObjectMeta.Labels = testServiceSelector - validateDNSResults(ctx, f, pod, fileNames) + validateDNSResults(ctx, f, pod, append(wheezyFileNames, jessieFileNames...)) }) /* @@ -253,17 +265,19 @@ var _ = common.SIGDescribe("DNS", func() { hostFQDN := fmt.Sprintf("%s.%s.%s.svc.%s", podHostname, serviceName, f.Namespace.Name, framework.TestContext.ClusterDNSDomain) hostNames := []string{hostFQDN, podHostname} // TODO: Validate both IPv4 and IPv6 families for dual-stack - probeCmd, fileNames := createProbeCommand(nil, hostNames, "", "dns", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) - ginkgo.By("Running these commands: " + probeCmd + "\n") + wheezyProbeCmd, wheezyFileNames := createProbeCommand(nil, hostNames, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + jessieProbeCmd, jessieFileNames := createProbeCommand(nil, hostNames, "", "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + ginkgo.By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") + ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n") // Run a pod which probes DNS and exposes the results by HTTP. ginkgo.By("creating a pod to probe DNS") - pod1 := createDNSPod(f.Namespace.Name, probeCmd, dnsTestPodHostName, dnsTestServiceName) + pod1 := createDNSPod(f.Namespace.Name, wheezyProbeCmd, jessieProbeCmd, dnsTestPodHostName, dnsTestServiceName) pod1.ObjectMeta.Labels = testServiceSelector pod1.Spec.Hostname = podHostname pod1.Spec.Subdomain = serviceName - validateDNSResults(ctx, f, pod1, fileNames) + validateDNSResults(ctx, f, pod1, append(wheezyFileNames, jessieFileNames...)) }) /* @@ -294,17 +308,19 @@ var _ = common.SIGDescribe("DNS", func() { subdomain := fmt.Sprintf("%s.%s.svc.%s", serviceName, f.Namespace.Name, framework.TestContext.ClusterDNSDomain) namesToResolve := []string{hostFQDN, subdomain} // TODO: Validate both IPv4 and IPv6 families for dual-stack - probeCmd, fileNames := createProbeCommand(namesToResolve, nil, "", "dns", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) - ginkgo.By("Running these commands: " + probeCmd + "\n") + wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, nil, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, nil, "", "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + ginkgo.By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") + ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n") // Run a pod which probes DNS and exposes the results by HTTP. ginkgo.By("creating a pod to probe DNS") - pod1 := createDNSPod(f.Namespace.Name, probeCmd, dnsTestPodHostName, dnsTestServiceName) + pod1 := createDNSPod(f.Namespace.Name, wheezyProbeCmd, jessieProbeCmd, dnsTestPodHostName, dnsTestServiceName) pod1.ObjectMeta.Labels = testServiceSelector pod1.Spec.Hostname = podHostname pod1.Spec.Subdomain = serviceName - validateDNSResults(ctx, f, pod1, fileNames) + validateDNSResults(ctx, f, pod1, append(wheezyFileNames, jessieFileNames...)) }) /* @@ -327,14 +343,16 @@ var _ = common.SIGDescribe("DNS", func() { return f.ClientSet.CoreV1().Services(f.Namespace.Name).Delete(ctx, externalNameService.Name, metav1.DeleteOptions{}) }) hostFQDN := fmt.Sprintf("%s.%s.svc.%s", serviceName, f.Namespace.Name, framework.TestContext.ClusterDNSDomain) - probeCmd, fileName := createTargetedProbeCommand(hostFQDN, "CNAME", "dns") - ginkgo.By("Running these commands: " + probeCmd + "\n") + wheezyProbeCmd, wheezyFileName := createTargetedProbeCommand(hostFQDN, "CNAME", "wheezy") + jessieProbeCmd, jessieFileName := createTargetedProbeCommand(hostFQDN, "CNAME", "jessie") + ginkgo.By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") + ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n") // Run a pod which probes DNS and exposes the results by HTTP. ginkgo.By("creating a pod to probe DNS") - pod1 := createDNSPod(f.Namespace.Name, probeCmd, dnsTestPodHostName, dnsTestServiceName) + pod1 := createDNSPod(f.Namespace.Name, wheezyProbeCmd, jessieProbeCmd, dnsTestPodHostName, dnsTestServiceName) - validateTargetedProbeOutput(ctx, f, pod1, []string{fileName}, "foo.example.com.") + validateTargetedProbeOutput(ctx, f, pod1, []string{wheezyFileName, jessieFileName}, "foo.example.com.") // Test changing the externalName field ginkgo.By("changing the externalName to bar.example.com") @@ -342,14 +360,16 @@ var _ = common.SIGDescribe("DNS", func() { s.Spec.ExternalName = "bar.example.com" }) framework.ExpectNoError(err, "failed to change externalName of service: %s", serviceName) - probeCmd, fileName = createTargetedProbeCommand(hostFQDN, "CNAME", "dns") - ginkgo.By("Running these commands: " + probeCmd + "\n") + wheezyProbeCmd, wheezyFileName = createTargetedProbeCommand(hostFQDN, "CNAME", "wheezy") + jessieProbeCmd, jessieFileName = createTargetedProbeCommand(hostFQDN, "CNAME", "jessie") + ginkgo.By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") + ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n") // Run a pod which probes DNS and exposes the results by HTTP. ginkgo.By("creating a second pod to probe DNS") - pod2 := createDNSPod(f.Namespace.Name, probeCmd, dnsTestPodHostName, dnsTestServiceName) + pod2 := createDNSPod(f.Namespace.Name, wheezyProbeCmd, jessieProbeCmd, dnsTestPodHostName, dnsTestServiceName) - validateTargetedProbeOutput(ctx, f, pod2, []string{fileName}, "bar.example.com.") + validateTargetedProbeOutput(ctx, f, pod2, []string{wheezyFileName, jessieFileName}, "bar.example.com.") // Test changing type from ExternalName to ClusterIP ginkgo.By("changing the service to type=ClusterIP") @@ -366,17 +386,19 @@ var _ = common.SIGDescribe("DNS", func() { } // TODO: For dual stack we can run from here two createTargetedProbeCommand() // one looking for an A record and another one for an AAAA record - probeCmd, fileName = createTargetedProbeCommand(hostFQDN, targetRecord, "dns") - ginkgo.By("Running these commands: " + probeCmd + "\n") + wheezyProbeCmd, wheezyFileName = createTargetedProbeCommand(hostFQDN, targetRecord, "wheezy") + jessieProbeCmd, jessieFileName = createTargetedProbeCommand(hostFQDN, targetRecord, "jessie") + ginkgo.By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") + ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n") // Run a pod which probes DNS and exposes the results by HTTP. ginkgo.By("creating a third pod to probe DNS") - pod3 := createDNSPod(f.Namespace.Name, probeCmd, dnsTestPodHostName, dnsTestServiceName) + pod3 := createDNSPod(f.Namespace.Name, wheezyProbeCmd, jessieProbeCmd, dnsTestPodHostName, dnsTestServiceName) svc, err := f.ClientSet.CoreV1().Services(f.Namespace.Name).Get(ctx, externalNameService.Name, metav1.GetOptions{}) framework.ExpectNoError(err, "failed to get service: %s", externalNameService.Name) - validateTargetedProbeOutput(ctx, f, pod3, []string{fileName}, svc.Spec.ClusterIP) + validateTargetedProbeOutput(ctx, f, pod3, []string{wheezyFileName, jessieFileName}, svc.Spec.ClusterIP) }) /* @@ -548,8 +570,10 @@ var _ = common.SIGDescribe("DNS", func() { hostFQDN := fmt.Sprintf("%s.%s.%s.svc.%s", dnsTestPodHostName, dnsTestServiceName, f.Namespace.Name, framework.TestContext.ClusterDNSDomain) hostEntries := []string{hostFQDN, dnsTestPodHostName} // TODO: Validate both IPv4 and IPv6 families for dual-stack - probeCmd, fileNames := createProbeCommand(namesToResolve, hostEntries, "", "dns", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) - ginkgo.By("Running these commands: " + probeCmd + "\n") + wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, hostEntries, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, hostEntries, "", "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + ginkgo.By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") + ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n") ginkgo.By("Creating a pod with expanded DNS configuration to probe DNS") testNdotsValue := "5" @@ -561,7 +585,7 @@ var _ = common.SIGDescribe("DNS", func() { fmt.Sprintf("%038d.k8s.io", 5), fmt.Sprintf("%038d.k8s.io", 6), // 260 characters } - pod := createDNSPod(f.Namespace.Name, probeCmd, dnsTestPodHostName, dnsTestServiceName) + pod := createDNSPod(f.Namespace.Name, wheezyProbeCmd, jessieProbeCmd, dnsTestPodHostName, dnsTestServiceName) pod.Spec.DNSPolicy = v1.DNSClusterFirst pod.Spec.DNSConfig = &v1.PodDNSConfig{ Searches: testSearchPaths, @@ -572,7 +596,7 @@ var _ = common.SIGDescribe("DNS", func() { }, }, } - validateDNSResults(ctx, f, pod, fileNames) + validateDNSResults(ctx, f, pod, append(wheezyFileNames, jessieFileNames...)) }) }) @@ -639,16 +663,18 @@ var _ = common.SIGDescribe("DNS HostNetwork", func() { } // TODO: Validate both IPv4 and IPv6 families for dual-stack - probeCmd, fileNames := createProbeCommand(namesToResolve, nil, regularService.Spec.ClusterIP, "dns", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) - ginkgo.By("Running these commands: " + probeCmd + "\n") + wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, nil, regularService.Spec.ClusterIP, "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, nil, regularService.Spec.ClusterIP, "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + ginkgo.By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") + ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n") // Run a pod which probes DNS and exposes the results by HTTP. ginkgo.By("creating a pod to probe DNS") - pod := createDNSPod(f.Namespace.Name, probeCmd, dnsTestPodHostName, dnsTestServiceName) + pod := createDNSPod(f.Namespace.Name, wheezyProbeCmd, jessieProbeCmd, dnsTestPodHostName, dnsTestServiceName) pod.ObjectMeta.Labels = testServiceSelector pod.Spec.HostNetwork = true pod.Spec.DNSPolicy = v1.DNSClusterFirstWithHostNet - validateDNSResults(ctx, f, pod, fileNames) + validateDNSResults(ctx, f, pod, append(wheezyFileNames, jessieFileNames...)) }) // https://issues.k8s.io/67019 diff --git a/test/e2e/network/dns_common.go b/test/e2e/network/dns_common.go index 6e0f3830045..9d64c5aae39 100644 --- a/test/e2e/network/dns_common.go +++ b/test/e2e/network/dns_common.go @@ -35,6 +35,7 @@ import ( clientset "k8s.io/client-go/kubernetes" "k8s.io/kubernetes/test/e2e/framework" e2epod "k8s.io/kubernetes/test/e2e/framework/pod" + imageutils "k8s.io/kubernetes/test/utils/image" dnsclient "k8s.io/kubernetes/third_party/forked/golang/net" admissionapi "k8s.io/pod-security-admission/api" @@ -351,7 +352,7 @@ func (t *dnsTestCommon) deleteDNSServerPod(ctx context.Context) { } } -func createDNSPod(namespace, probeCmd, podHostName, serviceName string) *v1.Pod { +func createDNSPod(namespace, wheezyProbeCmd, jessieProbeCmd, podHostName, serviceName string) *v1.Pod { podName := "dns-test-" + string(uuid.NewUUID()) volumes := []v1.Volume{ { @@ -372,10 +373,17 @@ func createDNSPod(namespace, probeCmd, podHostName, serviceName string) *v1.Pod dnsPod := e2epod.NewAgnhostPod(namespace, podName, volumes, mounts, nil, "test-webserver") dnsPod.Spec.Containers[0].Name = "webserver" - querier := e2epod.NewAgnhostContainer("querier", mounts, nil, probeCmd) + querier := e2epod.NewAgnhostContainer("querier", mounts, nil, wheezyProbeCmd) querier.Command = []string{"sh", "-c"} - dnsPod.Spec.Containers = append(dnsPod.Spec.Containers, querier) + jessieQuerier := v1.Container{ + Name: "jessie-querier", + Image: imageutils.GetE2EImage(imageutils.JessieDnsutils), + Command: []string{"sh", "-c", jessieProbeCmd}, + VolumeMounts: mounts, + } + + dnsPod.Spec.Containers = append(dnsPod.Spec.Containers, querier, jessieQuerier) dnsPod.Spec.Hostname = podHostName dnsPod.Spec.Subdomain = serviceName diff --git a/test/e2e/storage/testsuites/multivolume.go b/test/e2e/storage/testsuites/multivolume.go index 25c6fa89408..8c4363f0501 100644 --- a/test/e2e/storage/testsuites/multivolume.go +++ b/test/e2e/storage/testsuites/multivolume.go @@ -565,7 +565,7 @@ func TestConcurrentAccessToSingleVolume(ctx context.Context, f *framework.Framew SeLinuxLabel: e2epod.GetLinuxLabel(), NodeSelection: node, PVCsReadOnly: readOnly, - ImageID: e2epod.GetTestImageID(imageutils.Agnhost), + ImageID: e2epod.GetTestImageID(imageutils.JessieDnsutils), } pod, err := e2epod.CreateSecPodWithNodeSelection(ctx, cs, &podConfig, f.Timeouts.PodStart) framework.ExpectNoError(err) @@ -687,7 +687,7 @@ func TestConcurrentAccessToRelatedVolumes(ctx context.Context, f *framework.Fram SeLinuxLabel: e2epod.GetLinuxLabel(), NodeSelection: node, PVCsReadOnly: false, - ImageID: e2epod.GetTestImageID(imageutils.Agnhost), + ImageID: e2epod.GetTestImageID(imageutils.JessieDnsutils), } pod, err := e2epod.CreateSecPodWithNodeSelection(ctx, cs, &podConfig, f.Timeouts.PodStart) defer func() { diff --git a/test/images/.permitted-images b/test/images/.permitted-images index 219cf73a460..ec7dac61ab5 100644 --- a/test/images/.permitted-images +++ b/test/images/.permitted-images @@ -14,6 +14,7 @@ registry.k8s.io/e2e-test-images/apparmor-loader registry.k8s.io/e2e-test-images/busybox registry.k8s.io/e2e-test-images/httpd registry.k8s.io/e2e-test-images/ipc-utils +registry.k8s.io/e2e-test-images/jessie-dnsutils registry.k8s.io/e2e-test-images/kitten registry.k8s.io/e2e-test-images/nautilus registry.k8s.io/e2e-test-images/nginx diff --git a/test/images/image-util.sh b/test/images/image-util.sh index cc0065c6b14..12c2d3e5933 100755 --- a/test/images/image-util.sh +++ b/test/images/image-util.sh @@ -283,7 +283,7 @@ if [[ "${WHAT}" == "all-conformance" ]]; then # Discussed during Conformance Office Hours Meeting (2019.12.17): # https://docs.google.com/document/d/1W31nXh9RYAb_VaYkwuPLd1hFxuRX3iU0DmaQ4lkCsX8/edit#heading=h.l87lu17xm9bh shift - conformance_images=("busybox" "agnhost" "kitten" "nautilus" "nonewprivs" "resource-consumer" "sample-apiserver") + conformance_images=("busybox" "agnhost" "jessie-dnsutils" "kitten" "nautilus" "nonewprivs" "resource-consumer" "sample-apiserver") for image in "${conformance_images[@]}"; do "${TASK}" "${image}" "$@" done diff --git a/test/images/jessie-dnsutils/BASEIMAGE b/test/images/jessie-dnsutils/BASEIMAGE new file mode 100644 index 00000000000..76dd97afd76 --- /dev/null +++ b/test/images/jessie-dnsutils/BASEIMAGE @@ -0,0 +1,7 @@ +linux/amd64=debian:jessie +linux/arm=arm32v7/debian:jessie +linux/arm64=arm64v8/debian:jessie +linux/ppc64le=ppc64le/debian:jessie +linux/s390x=s390x/debian:jessie +windows/amd64/1809=REGISTRY/busybox:1.29-2-windows-amd64-1809 +windows/amd64/ltsc2022=REGISTRY/busybox:1.29-2-windows-amd64-ltsc2022 diff --git a/test/images/jessie-dnsutils/Dockerfile b/test/images/jessie-dnsutils/Dockerfile new file mode 100644 index 00000000000..9fd6a276a05 --- /dev/null +++ b/test/images/jessie-dnsutils/Dockerfile @@ -0,0 +1,32 @@ +# Copyright 2016 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +ARG BASEIMAGE +FROM $BASEIMAGE + +CROSS_BUILD_COPY qemu-QEMUARCH-static /usr/bin/ + +# WARNING: Please note that the script below removes the security packages from arm64 and ppc64el images +# as they do not exist anymore in the debian repositories for jessie. So we do not recommend using this +# image for any production use and limit use of this image to just test scenarios. + +COPY fixup-apt-list.sh / +RUN ["/fixup-apt-list.sh"] + +RUN apt-get -q update && \ + apt-get install -y --force-yes dnsutils && \ + apt-get clean + +ADD https://github.com/coredns/coredns/releases/download/v1.5.0/coredns_1.5.0_linux_BASEARCH.tgz /coredns.tgz +RUN tar -xzvf /coredns.tgz && rm -f /coredns.tgz diff --git a/test/images/jessie-dnsutils/Dockerfile_windows b/test/images/jessie-dnsutils/Dockerfile_windows new file mode 100644 index 00000000000..445852ad899 --- /dev/null +++ b/test/images/jessie-dnsutils/Dockerfile_windows @@ -0,0 +1,28 @@ +# Copyright 2020 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +ARG BASEIMAGE + +# We're using a Linux image to unpack the archive, then we're copying it over to Windows. +FROM --platform=linux/amd64 alpine:3.6 as prep + +ADD https://github.com/coredns/coredns/releases/download/v1.5.0/coredns_1.5.0_windows_amd64.tgz /coredns.tgz +RUN tar -xzvf /coredns.tgz + +FROM $BASEIMAGE + +COPY --from=prep /coredns.exe /coredns.exe + +# NOTE(claudiub): docker buildx sets the PATH env variable to a Linux-like PATH, which is not desirable. +ENV PATH="C:\dig\;C:\bin;C:\curl;C:\Windows\System32;C:\Windows;C:\Program Files\PowerShell;" diff --git a/test/images/jessie-dnsutils/OWNERS b/test/images/jessie-dnsutils/OWNERS new file mode 100644 index 00000000000..11e4263977e --- /dev/null +++ b/test/images/jessie-dnsutils/OWNERS @@ -0,0 +1,3 @@ +approvers: + - dims + - mkumatag diff --git a/test/images/jessie-dnsutils/README.md b/test/images/jessie-dnsutils/README.md new file mode 100644 index 00000000000..b0c433127e9 --- /dev/null +++ b/test/images/jessie-dnsutils/README.md @@ -0,0 +1,4 @@ +# jessie-dnsutils + +DNS utils but implemented in a different OS to have some basic check across OSes. +See issue #10161 for original issue and discussion. \ No newline at end of file diff --git a/test/images/jessie-dnsutils/VERSION b/test/images/jessie-dnsutils/VERSION new file mode 100644 index 00000000000..d3bdbdf1fda --- /dev/null +++ b/test/images/jessie-dnsutils/VERSION @@ -0,0 +1 @@ +1.7 diff --git a/test/images/jessie-dnsutils/fixup-apt-list.sh b/test/images/jessie-dnsutils/fixup-apt-list.sh new file mode 100755 index 00000000000..a9aa4f123dc --- /dev/null +++ b/test/images/jessie-dnsutils/fixup-apt-list.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash + +# Copyright 2017 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +DEB_ARCH=$(dpkg --print-architecture) + +# http://security.debian.org/debian-security/dists/jessie/updates/InRelease is missing +# entries for some platforms, so we just remove the last line in sources.list in +# /etc/apt/sources.list which is "deb http://deb.debian.org/debian jessie-updates main" + +case ${DEB_ARCH} in + s390x|arm64|ppc64el) + # We have to use the archive mirrors. + # See: https://lists.debian.org/debian-devel-announce/2019/03/msg00006.html + echo "deb http://archive.debian.org/debian/ jessie main contrib non-free" | tee /etc/apt/sources.list + echo "deb-src http://archive.debian.org/debian/ jessie main contrib non-free" | tee -a /etc/apt/sources.list + ;; +esac + +exit 0 diff --git a/test/utils/image/manifest.go b/test/utils/image/manifest.go index a0504cfd7ee..d08a9538f82 100644 --- a/test/utils/image/manifest.go +++ b/test/utils/image/manifest.go @@ -175,6 +175,8 @@ const ( InvalidRegistryImage // IpcUtils image IpcUtils + // JessieDnsutils image + JessieDnsutils // Kitten image Kitten // Nautilus image @@ -227,6 +229,7 @@ func initImageConfigs(list RegistryList) (map[ImageID]Config, map[ImageID]Config configs[HttpdNew] = Config{list.PromoterE2eRegistry, "httpd", "2.4.39-4"} configs[InvalidRegistryImage] = Config{list.InvalidRegistry, "alpine", "3.1"} configs[IpcUtils] = Config{list.PromoterE2eRegistry, "ipc-utils", "1.3"} + configs[JessieDnsutils] = Config{list.PromoterE2eRegistry, "jessie-dnsutils", "1.7"} configs[Kitten] = Config{list.PromoterE2eRegistry, "kitten", "1.7"} configs[Nautilus] = Config{list.PromoterE2eRegistry, "nautilus", "1.7"} configs[NFSProvisioner] = Config{list.SigStorageRegistry, "nfs-provisioner", "v4.0.8"} From a9189735ac9d4a150f7c58be8f28b03e7377fa7f Mon Sep 17 00:00:00 2001 From: Tim Hockin Date: Tue, 17 Sep 2024 09:47:13 -0700 Subject: [PATCH 3/3] Rename DNS tests and restructure Get rid if "wheezy" (it's not wheezy) and set it up to process an arbitrary list of probers, but stop short of adding more. --- test/e2e/network/dns.go | 144 ++++++++++++++++++++------------- test/e2e/network/dns_common.go | 36 ++++++--- 2 files changed, 114 insertions(+), 66 deletions(-) diff --git a/test/e2e/network/dns.go b/test/e2e/network/dns.go index 54ce81f4133..c7bc5f4f040 100644 --- a/test/e2e/network/dns.go +++ b/test/e2e/network/dns.go @@ -33,6 +33,7 @@ import ( e2eservice "k8s.io/kubernetes/test/e2e/framework/service" e2eskipper "k8s.io/kubernetes/test/e2e/framework/skipper" "k8s.io/kubernetes/test/e2e/network/common" + imageutils "k8s.io/kubernetes/test/utils/image" admissionapi "k8s.io/pod-security-admission/api" "github.com/onsi/ginkgo/v2" @@ -58,15 +59,20 @@ var _ = common.SIGDescribe("DNS", func() { fmt.Sprintf("kubernetes.default.svc.%s", framework.TestContext.ClusterDNSDomain), } // TODO: Validate both IPv4 and IPv6 families for dual-stack - wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, nil, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + // TODO: We should change this whole test mechanism to run the same probes + // against a known list of different base images. Agnhost happens to be alpine + // (MUSL libc) for the moment, and jessie is (an old version of) libc. + agnhostProbeCmd, agnhostFileNames := createProbeCommand(namesToResolve, nil, "", "agnhost", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + agnhostProber := dnsQuerier{name: "agnhost", image: imageutils.Agnhost, cmd: agnhostProbeCmd} jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, nil, "", "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) - ginkgo.By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") + jessieProber := dnsQuerier{name: "jessie", image: imageutils.JessieDnsutils, cmd: jessieProbeCmd} + ginkgo.By("Running these commands on agnhost: " + agnhostProbeCmd + "\n") ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n") // Run a pod which probes DNS and exposes the results by HTTP. ginkgo.By("creating a pod to probe DNS") - pod := createDNSPod(f.Namespace.Name, wheezyProbeCmd, jessieProbeCmd, dnsTestPodHostName, dnsTestServiceName) - validateDNSResults(ctx, f, pod, append(wheezyFileNames, jessieFileNames...)) + pod := createDNSPod(f.Namespace.Name, []dnsQuerier{agnhostProber, jessieProber}, dnsTestPodHostName, dnsTestServiceName) + validateDNSResults(ctx, f, pod, append(agnhostFileNames, jessieFileNames...)) }) // Added due to #8512. This is critical for GCE and GKE deployments. @@ -80,15 +86,17 @@ var _ = common.SIGDescribe("DNS", func() { } // TODO: Validate both IPv4 and IPv6 families for dual-stack - wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, nil, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + agnhostProbeCmd, agnhostFileNames := createProbeCommand(namesToResolve, nil, "", "agnhost", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + agnhostProber := dnsQuerier{name: "agnhost", image: imageutils.Agnhost, cmd: agnhostProbeCmd} jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, nil, "", "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) - ginkgo.By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") + jessieProber := dnsQuerier{name: "jessie", image: imageutils.JessieDnsutils, cmd: jessieProbeCmd} + ginkgo.By("Running these commands on agnhost: " + agnhostProbeCmd + "\n") ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n") // Run a pod which probes DNS and exposes the results by HTTP. ginkgo.By("creating a pod to probe DNS") - pod := createDNSPod(f.Namespace.Name, wheezyProbeCmd, jessieProbeCmd, dnsTestPodHostName, dnsTestServiceName) - validateDNSResults(ctx, f, pod, append(wheezyFileNames, jessieFileNames...)) + pod := createDNSPod(f.Namespace.Name, []dnsQuerier{agnhostProber, jessieProber}, dnsTestPodHostName, dnsTestServiceName) + validateDNSResults(ctx, f, pod, append(agnhostFileNames, jessieFileNames...)) }) // [LinuxOnly]: As Windows currently does not support resolving PQDNs. @@ -101,15 +109,17 @@ var _ = common.SIGDescribe("DNS", func() { hostFQDN := fmt.Sprintf("%s.%s.%s.svc.%s", dnsTestPodHostName, dnsTestServiceName, f.Namespace.Name, framework.TestContext.ClusterDNSDomain) hostEntries := []string{hostFQDN, dnsTestPodHostName} // TODO: Validate both IPv4 and IPv6 families for dual-stack - wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, hostEntries, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + agnhostProbeCmd, agnhostFileNames := createProbeCommand(namesToResolve, hostEntries, "", "agnhost", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + agnhostProber := dnsQuerier{name: "agnhost", image: imageutils.Agnhost, cmd: agnhostProbeCmd} jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, hostEntries, "", "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) - ginkgo.By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") + jessieProber := dnsQuerier{name: "jessie", image: imageutils.JessieDnsutils, cmd: jessieProbeCmd} + ginkgo.By("Running these commands on agnhost: " + agnhostProbeCmd + "\n") ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n") // Run a pod which probes DNS and exposes the results by HTTP. ginkgo.By("creating a pod to probe DNS") - pod := createDNSPod(f.Namespace.Name, wheezyProbeCmd, jessieProbeCmd, dnsTestPodHostName, dnsTestServiceName) - validateDNSResults(ctx, f, pod, append(wheezyFileNames, jessieFileNames...)) + pod := createDNSPod(f.Namespace.Name, []dnsQuerier{agnhostProber, jessieProber}, dnsTestPodHostName, dnsTestServiceName) + validateDNSResults(ctx, f, pod, append(agnhostFileNames, jessieFileNames...)) }) /* @@ -121,15 +131,17 @@ var _ = common.SIGDescribe("DNS", func() { hostFQDN := fmt.Sprintf("%s.%s.%s.svc.%s", dnsTestPodHostName, dnsTestServiceName, f.Namespace.Name, framework.TestContext.ClusterDNSDomain) hostEntries := []string{hostFQDN, dnsTestPodHostName} // TODO: Validate both IPv4 and IPv6 families for dual-stack - wheezyProbeCmd, wheezyFileNames := createProbeCommand(nil, hostEntries, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + agnhostProbeCmd, agnhostFileNames := createProbeCommand(nil, hostEntries, "", "agnhost", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + agnhostProber := dnsQuerier{name: "agnhost", image: imageutils.Agnhost, cmd: agnhostProbeCmd} jessieProbeCmd, jessieFileNames := createProbeCommand(nil, hostEntries, "", "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) - ginkgo.By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") + jessieProber := dnsQuerier{name: "jessie", image: imageutils.JessieDnsutils, cmd: jessieProbeCmd} + ginkgo.By("Running these commands on agnhost: " + agnhostProbeCmd + "\n") ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n") // Run a pod which probes /etc/hosts and exposes the results by HTTP. ginkgo.By("creating a pod to probe /etc/hosts") - pod := createDNSPod(f.Namespace.Name, wheezyProbeCmd, jessieProbeCmd, dnsTestPodHostName, dnsTestServiceName) - validateDNSResults(ctx, f, pod, append(wheezyFileNames, jessieFileNames...)) + pod := createDNSPod(f.Namespace.Name, []dnsQuerier{agnhostProber, jessieProber}, dnsTestPodHostName, dnsTestServiceName) + validateDNSResults(ctx, f, pod, append(agnhostFileNames, jessieFileNames...)) }) /* @@ -172,17 +184,19 @@ var _ = common.SIGDescribe("DNS", func() { } // TODO: Validate both IPv4 and IPv6 families for dual-stack - wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, nil, regularService.Spec.ClusterIP, "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + agnhostProbeCmd, agnhostFileNames := createProbeCommand(namesToResolve, nil, regularService.Spec.ClusterIP, "agnhost", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + agnhostProber := dnsQuerier{name: "agnhost", image: imageutils.Agnhost, cmd: agnhostProbeCmd} jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, nil, regularService.Spec.ClusterIP, "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) - ginkgo.By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") + jessieProber := dnsQuerier{name: "jessie", image: imageutils.JessieDnsutils, cmd: jessieProbeCmd} + ginkgo.By("Running these commands on agnhost: " + agnhostProbeCmd + "\n") ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n") // Run a pod which probes DNS and exposes the results by HTTP. ginkgo.By("creating a pod to probe DNS") - pod := createDNSPod(f.Namespace.Name, wheezyProbeCmd, jessieProbeCmd, dnsTestPodHostName, dnsTestServiceName) + pod := createDNSPod(f.Namespace.Name, []dnsQuerier{agnhostProber, jessieProber}, dnsTestPodHostName, dnsTestServiceName) pod.ObjectMeta.Labels = testServiceSelector - validateDNSResults(ctx, f, pod, append(wheezyFileNames, jessieFileNames...)) + validateDNSResults(ctx, f, pod, append(agnhostFileNames, jessieFileNames...)) }) /* @@ -225,17 +239,19 @@ var _ = common.SIGDescribe("DNS", func() { } // TODO: Validate both IPv4 and IPv6 families for dual-stack - wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, nil, regularService.Spec.ClusterIP, "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + agnhostProbeCmd, agnhostFileNames := createProbeCommand(namesToResolve, nil, regularService.Spec.ClusterIP, "agnhost", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + agnhostProber := dnsQuerier{name: "agnhost", image: imageutils.Agnhost, cmd: agnhostProbeCmd} jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, nil, regularService.Spec.ClusterIP, "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) - ginkgo.By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") + jessieProber := dnsQuerier{name: "jessie", image: imageutils.JessieDnsutils, cmd: jessieProbeCmd} + ginkgo.By("Running these commands on agnhost: " + agnhostProbeCmd + "\n") ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n") // Run a pod which probes DNS and exposes the results by HTTP. ginkgo.By("creating a pod to probe DNS") - pod := createDNSPod(f.Namespace.Name, wheezyProbeCmd, jessieProbeCmd, dnsTestPodHostName, dnsTestServiceName) + pod := createDNSPod(f.Namespace.Name, []dnsQuerier{agnhostProber, jessieProber}, dnsTestPodHostName, dnsTestServiceName) pod.ObjectMeta.Labels = testServiceSelector - validateDNSResults(ctx, f, pod, append(wheezyFileNames, jessieFileNames...)) + validateDNSResults(ctx, f, pod, append(agnhostFileNames, jessieFileNames...)) }) /* @@ -265,19 +281,21 @@ var _ = common.SIGDescribe("DNS", func() { hostFQDN := fmt.Sprintf("%s.%s.%s.svc.%s", podHostname, serviceName, f.Namespace.Name, framework.TestContext.ClusterDNSDomain) hostNames := []string{hostFQDN, podHostname} // TODO: Validate both IPv4 and IPv6 families for dual-stack - wheezyProbeCmd, wheezyFileNames := createProbeCommand(nil, hostNames, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + agnhostProbeCmd, agnhostFileNames := createProbeCommand(nil, hostNames, "", "agnhost", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + agnhostProber := dnsQuerier{name: "agnhost", image: imageutils.Agnhost, cmd: agnhostProbeCmd} jessieProbeCmd, jessieFileNames := createProbeCommand(nil, hostNames, "", "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) - ginkgo.By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") + jessieProber := dnsQuerier{name: "jessie", image: imageutils.JessieDnsutils, cmd: jessieProbeCmd} + ginkgo.By("Running these commands on agnhost: " + agnhostProbeCmd + "\n") ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n") // Run a pod which probes DNS and exposes the results by HTTP. ginkgo.By("creating a pod to probe DNS") - pod1 := createDNSPod(f.Namespace.Name, wheezyProbeCmd, jessieProbeCmd, dnsTestPodHostName, dnsTestServiceName) + pod1 := createDNSPod(f.Namespace.Name, []dnsQuerier{agnhostProber, jessieProber}, dnsTestPodHostName, dnsTestServiceName) pod1.ObjectMeta.Labels = testServiceSelector pod1.Spec.Hostname = podHostname pod1.Spec.Subdomain = serviceName - validateDNSResults(ctx, f, pod1, append(wheezyFileNames, jessieFileNames...)) + validateDNSResults(ctx, f, pod1, append(agnhostFileNames, jessieFileNames...)) }) /* @@ -308,19 +326,21 @@ var _ = common.SIGDescribe("DNS", func() { subdomain := fmt.Sprintf("%s.%s.svc.%s", serviceName, f.Namespace.Name, framework.TestContext.ClusterDNSDomain) namesToResolve := []string{hostFQDN, subdomain} // TODO: Validate both IPv4 and IPv6 families for dual-stack - wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, nil, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + agnhostProbeCmd, agnhostFileNames := createProbeCommand(namesToResolve, nil, "", "agnhost", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + agnhostProber := dnsQuerier{name: "agnhost", image: imageutils.Agnhost, cmd: agnhostProbeCmd} jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, nil, "", "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) - ginkgo.By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") + jessieProber := dnsQuerier{name: "jessie", image: imageutils.JessieDnsutils, cmd: jessieProbeCmd} + ginkgo.By("Running these commands on agnhost: " + agnhostProbeCmd + "\n") ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n") // Run a pod which probes DNS and exposes the results by HTTP. ginkgo.By("creating a pod to probe DNS") - pod1 := createDNSPod(f.Namespace.Name, wheezyProbeCmd, jessieProbeCmd, dnsTestPodHostName, dnsTestServiceName) + pod1 := createDNSPod(f.Namespace.Name, []dnsQuerier{agnhostProber, jessieProber}, dnsTestPodHostName, dnsTestServiceName) pod1.ObjectMeta.Labels = testServiceSelector pod1.Spec.Hostname = podHostname pod1.Spec.Subdomain = serviceName - validateDNSResults(ctx, f, pod1, append(wheezyFileNames, jessieFileNames...)) + validateDNSResults(ctx, f, pod1, append(agnhostFileNames, jessieFileNames...)) }) /* @@ -343,16 +363,18 @@ var _ = common.SIGDescribe("DNS", func() { return f.ClientSet.CoreV1().Services(f.Namespace.Name).Delete(ctx, externalNameService.Name, metav1.DeleteOptions{}) }) hostFQDN := fmt.Sprintf("%s.%s.svc.%s", serviceName, f.Namespace.Name, framework.TestContext.ClusterDNSDomain) - wheezyProbeCmd, wheezyFileName := createTargetedProbeCommand(hostFQDN, "CNAME", "wheezy") + agnhostProbeCmd, agnhostFileName := createTargetedProbeCommand(hostFQDN, "CNAME", "agnhost") + agnhostProber := dnsQuerier{name: "agnhost", image: imageutils.Agnhost, cmd: agnhostProbeCmd} jessieProbeCmd, jessieFileName := createTargetedProbeCommand(hostFQDN, "CNAME", "jessie") - ginkgo.By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") + jessieProber := dnsQuerier{name: "jessie", image: imageutils.JessieDnsutils, cmd: jessieProbeCmd} + ginkgo.By("Running these commands on agnhost: " + agnhostProbeCmd + "\n") ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n") // Run a pod which probes DNS and exposes the results by HTTP. ginkgo.By("creating a pod to probe DNS") - pod1 := createDNSPod(f.Namespace.Name, wheezyProbeCmd, jessieProbeCmd, dnsTestPodHostName, dnsTestServiceName) + pod1 := createDNSPod(f.Namespace.Name, []dnsQuerier{agnhostProber, jessieProber}, dnsTestPodHostName, dnsTestServiceName) - validateTargetedProbeOutput(ctx, f, pod1, []string{wheezyFileName, jessieFileName}, "foo.example.com.") + validateTargetedProbeOutput(ctx, f, pod1, []string{agnhostFileName, jessieFileName}, "foo.example.com.") // Test changing the externalName field ginkgo.By("changing the externalName to bar.example.com") @@ -360,16 +382,18 @@ var _ = common.SIGDescribe("DNS", func() { s.Spec.ExternalName = "bar.example.com" }) framework.ExpectNoError(err, "failed to change externalName of service: %s", serviceName) - wheezyProbeCmd, wheezyFileName = createTargetedProbeCommand(hostFQDN, "CNAME", "wheezy") + agnhostProbeCmd, agnhostFileName = createTargetedProbeCommand(hostFQDN, "CNAME", "agnhost") + agnhostProber = dnsQuerier{name: "agnhost", image: imageutils.Agnhost, cmd: agnhostProbeCmd} jessieProbeCmd, jessieFileName = createTargetedProbeCommand(hostFQDN, "CNAME", "jessie") - ginkgo.By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") + jessieProber = dnsQuerier{name: "jessie", image: imageutils.JessieDnsutils, cmd: jessieProbeCmd} + ginkgo.By("Running these commands on agnhost: " + agnhostProbeCmd + "\n") ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n") // Run a pod which probes DNS and exposes the results by HTTP. ginkgo.By("creating a second pod to probe DNS") - pod2 := createDNSPod(f.Namespace.Name, wheezyProbeCmd, jessieProbeCmd, dnsTestPodHostName, dnsTestServiceName) + pod2 := createDNSPod(f.Namespace.Name, []dnsQuerier{agnhostProber, jessieProber}, dnsTestPodHostName, dnsTestServiceName) - validateTargetedProbeOutput(ctx, f, pod2, []string{wheezyFileName, jessieFileName}, "bar.example.com.") + validateTargetedProbeOutput(ctx, f, pod2, []string{agnhostFileName, jessieFileName}, "bar.example.com.") // Test changing type from ExternalName to ClusterIP ginkgo.By("changing the service to type=ClusterIP") @@ -386,19 +410,21 @@ var _ = common.SIGDescribe("DNS", func() { } // TODO: For dual stack we can run from here two createTargetedProbeCommand() // one looking for an A record and another one for an AAAA record - wheezyProbeCmd, wheezyFileName = createTargetedProbeCommand(hostFQDN, targetRecord, "wheezy") + agnhostProbeCmd, agnhostFileName = createTargetedProbeCommand(hostFQDN, targetRecord, "agnhost") + agnhostProber = dnsQuerier{name: "agnhost", image: imageutils.Agnhost, cmd: agnhostProbeCmd} jessieProbeCmd, jessieFileName = createTargetedProbeCommand(hostFQDN, targetRecord, "jessie") - ginkgo.By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") + jessieProber = dnsQuerier{name: "jessie", image: imageutils.JessieDnsutils, cmd: jessieProbeCmd} + ginkgo.By("Running these commands on agnhost: " + agnhostProbeCmd + "\n") ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n") // Run a pod which probes DNS and exposes the results by HTTP. ginkgo.By("creating a third pod to probe DNS") - pod3 := createDNSPod(f.Namespace.Name, wheezyProbeCmd, jessieProbeCmd, dnsTestPodHostName, dnsTestServiceName) + pod3 := createDNSPod(f.Namespace.Name, []dnsQuerier{agnhostProber, jessieProber}, dnsTestPodHostName, dnsTestServiceName) svc, err := f.ClientSet.CoreV1().Services(f.Namespace.Name).Get(ctx, externalNameService.Name, metav1.GetOptions{}) framework.ExpectNoError(err, "failed to get service: %s", externalNameService.Name) - validateTargetedProbeOutput(ctx, f, pod3, []string{wheezyFileName, jessieFileName}, svc.Spec.ClusterIP) + validateTargetedProbeOutput(ctx, f, pod3, []string{agnhostFileName, jessieFileName}, svc.Spec.ClusterIP) }) /* @@ -570,9 +596,11 @@ var _ = common.SIGDescribe("DNS", func() { hostFQDN := fmt.Sprintf("%s.%s.%s.svc.%s", dnsTestPodHostName, dnsTestServiceName, f.Namespace.Name, framework.TestContext.ClusterDNSDomain) hostEntries := []string{hostFQDN, dnsTestPodHostName} // TODO: Validate both IPv4 and IPv6 families for dual-stack - wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, hostEntries, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + agnhostProbeCmd, agnhostFileNames := createProbeCommand(namesToResolve, hostEntries, "", "agnhost", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + agnhostProber := dnsQuerier{name: "agnhost", image: imageutils.Agnhost, cmd: agnhostProbeCmd} jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, hostEntries, "", "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) - ginkgo.By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") + jessieProber := dnsQuerier{name: "jessie", image: imageutils.JessieDnsutils, cmd: jessieProbeCmd} + ginkgo.By("Running these commands on agnhost: " + agnhostProbeCmd + "\n") ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n") ginkgo.By("Creating a pod with expanded DNS configuration to probe DNS") @@ -585,7 +613,7 @@ var _ = common.SIGDescribe("DNS", func() { fmt.Sprintf("%038d.k8s.io", 5), fmt.Sprintf("%038d.k8s.io", 6), // 260 characters } - pod := createDNSPod(f.Namespace.Name, wheezyProbeCmd, jessieProbeCmd, dnsTestPodHostName, dnsTestServiceName) + pod := createDNSPod(f.Namespace.Name, []dnsQuerier{agnhostProber, jessieProber}, dnsTestPodHostName, dnsTestServiceName) pod.Spec.DNSPolicy = v1.DNSClusterFirst pod.Spec.DNSConfig = &v1.PodDNSConfig{ Searches: testSearchPaths, @@ -596,7 +624,7 @@ var _ = common.SIGDescribe("DNS", func() { }, }, } - validateDNSResults(ctx, f, pod, append(wheezyFileNames, jessieFileNames...)) + validateDNSResults(ctx, f, pod, append(agnhostFileNames, jessieFileNames...)) }) }) @@ -614,9 +642,11 @@ var _ = common.SIGDescribe("DNS", feature.RelaxedDNSSearchValidation, framework. hostFQDN := fmt.Sprintf("%s.%s.%s.svc.%s", dnsTestPodHostName, dnsTestServiceName, f.Namespace.Name, framework.TestContext.ClusterDNSDomain) hostEntries := []string{hostFQDN, dnsTestPodHostName} // TODO: Validate both IPv4 and IPv6 families for dual-stack - wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, hostEntries, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + agnhostProbeCmd, agnhostFileNames := createProbeCommand(namesToResolve, hostEntries, "", "agnhost", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + agnhostProber := dnsQuerier{name: "agnhost", image: imageutils.Agnhost, cmd: agnhostProbeCmd} jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, hostEntries, "", "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) - ginkgo.By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") + jessieProber := dnsQuerier{name: "jessie", image: imageutils.JessieDnsutils, cmd: jessieProbeCmd} + ginkgo.By("Running these commands on agnhost: " + agnhostProbeCmd + "\n") ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n") ginkgo.By("Creating a pod with expanded DNS configuration to probe DNS") @@ -624,12 +654,12 @@ var _ = common.SIGDescribe("DNS", feature.RelaxedDNSSearchValidation, framework. ".", "_sip._tcp.abc_d.example.com", } - pod := createDNSPod(f.Namespace.Name, wheezyProbeCmd, jessieProbeCmd, dnsTestPodHostName, dnsTestServiceName) + pod := createDNSPod(f.Namespace.Name, []dnsQuerier{agnhostProber, jessieProber}, dnsTestPodHostName, dnsTestServiceName) pod.Spec.DNSPolicy = v1.DNSClusterFirst pod.Spec.DNSConfig = &v1.PodDNSConfig{ Searches: testSearchPaths, } - validateDNSResults(ctx, f, pod, append(wheezyFileNames, jessieFileNames...)) + validateDNSResults(ctx, f, pod, append(agnhostFileNames, jessieFileNames...)) }) }) @@ -663,18 +693,20 @@ var _ = common.SIGDescribe("DNS HostNetwork", func() { } // TODO: Validate both IPv4 and IPv6 families for dual-stack - wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, nil, regularService.Spec.ClusterIP, "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + agnhostProbeCmd, agnhostFileNames := createProbeCommand(namesToResolve, nil, regularService.Spec.ClusterIP, "agnhost", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) + agnhostProber := dnsQuerier{name: "agnhost", image: imageutils.Agnhost, cmd: agnhostProbeCmd} jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, nil, regularService.Spec.ClusterIP, "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6()) - ginkgo.By("Running these commands on wheezy: " + wheezyProbeCmd + "\n") + jessieProber := dnsQuerier{name: "jessie", image: imageutils.JessieDnsutils, cmd: jessieProbeCmd} + ginkgo.By("Running these commands on agnhost: " + agnhostProbeCmd + "\n") ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n") // Run a pod which probes DNS and exposes the results by HTTP. ginkgo.By("creating a pod to probe DNS") - pod := createDNSPod(f.Namespace.Name, wheezyProbeCmd, jessieProbeCmd, dnsTestPodHostName, dnsTestServiceName) + pod := createDNSPod(f.Namespace.Name, []dnsQuerier{agnhostProber, jessieProber}, dnsTestPodHostName, dnsTestServiceName) pod.ObjectMeta.Labels = testServiceSelector pod.Spec.HostNetwork = true pod.Spec.DNSPolicy = v1.DNSClusterFirstWithHostNet - validateDNSResults(ctx, f, pod, append(wheezyFileNames, jessieFileNames...)) + validateDNSResults(ctx, f, pod, append(agnhostFileNames, jessieFileNames...)) }) // https://issues.k8s.io/67019 diff --git a/test/e2e/network/dns_common.go b/test/e2e/network/dns_common.go index 9d64c5aae39..d06a37e3027 100644 --- a/test/e2e/network/dns_common.go +++ b/test/e2e/network/dns_common.go @@ -352,7 +352,13 @@ func (t *dnsTestCommon) deleteDNSServerPod(ctx context.Context) { } } -func createDNSPod(namespace, wheezyProbeCmd, jessieProbeCmd, podHostName, serviceName string) *v1.Pod { +type dnsQuerier struct { + name string // container name + image imageutils.ImageID // container image + cmd string // a shell-script in a string +} + +func createDNSPod(namespace string, probers []dnsQuerier, podHostName, serviceName string) *v1.Pod { podName := "dns-test-" + string(uuid.NewUUID()) volumes := []v1.Volume{ { @@ -369,21 +375,31 @@ func createDNSPod(namespace, wheezyProbeCmd, jessieProbeCmd, podHostName, servic }, } + // This is an "agnhost pod" but we use the 0th container as a webserver. // TODO: Consider scraping logs instead of running a webserver. dnsPod := e2epod.NewAgnhostPod(namespace, podName, volumes, mounts, nil, "test-webserver") dnsPod.Spec.Containers[0].Name = "webserver" - querier := e2epod.NewAgnhostContainer("querier", mounts, nil, wheezyProbeCmd) - querier.Command = []string{"sh", "-c"} - - jessieQuerier := v1.Container{ - Name: "jessie-querier", - Image: imageutils.GetE2EImage(imageutils.JessieDnsutils), - Command: []string{"sh", "-c", jessieProbeCmd}, - VolumeMounts: mounts, + probeCtrs := []v1.Container{} + for _, probe := range probers { + name := probe.name + "-querier" + if probe.image == imageutils.Agnhost { + // agnhost is special cased, to keep all of its logic consistent. + ctr := e2epod.NewAgnhostContainer(name, mounts, nil) + ctr.Command = []string{"sh", "-c", probe.cmd} + probeCtrs = append(probeCtrs, ctr) + } else { + ctr := v1.Container{ + Name: name, + Image: imageutils.GetE2EImage(probe.image), + Command: []string{"sh", "-c", probe.cmd}, + VolumeMounts: mounts, + } + probeCtrs = append(probeCtrs, ctr) + } } - dnsPod.Spec.Containers = append(dnsPod.Spec.Containers, querier, jessieQuerier) + dnsPod.Spec.Containers = append(dnsPod.Spec.Containers, probeCtrs...) dnsPod.Spec.Hostname = podHostName dnsPod.Spec.Subdomain = serviceName