From add46523526f4b342b1d0ad9f472b6ff8fb9eda6 Mon Sep 17 00:00:00 2001 From: Gunju Kim Date: Sun, 27 Mar 2022 13:45:01 +0900 Subject: [PATCH] Promote ExpandedDNSConfig feature to the beta stage This adds an e2e test for the feature and promotes ExpandedDNSConfig feature to the beta stage. --- pkg/features/kube_features.go | 3 ++- test/e2e/network/dns.go | 44 +++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/pkg/features/kube_features.go b/pkg/features/kube_features.go index c689295be6e..80681b6e201 100644 --- a/pkg/features/kube_features.go +++ b/pkg/features/kube_features.go @@ -308,6 +308,7 @@ const ( // owner: @gjkim42 // kep: https://kep.k8s.io/2595 // alpha: v1.22 + // beta: v1.26 // // Enables apiserver and kubelet to allow up to 32 DNSSearchPaths and up to 2048 DNSSearchListChars. ExpandedDNSConfig featuregate.Feature = "ExpandedDNSConfig" @@ -877,7 +878,7 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS ExpandPersistentVolumes: {Default: true, PreRelease: featuregate.GA}, // remove in 1.26 - ExpandedDNSConfig: {Default: false, PreRelease: featuregate.Alpha}, + ExpandedDNSConfig: {Default: true, PreRelease: featuregate.Beta}, ExperimentalHostUserNamespaceDefaultingGate: {Default: false, PreRelease: featuregate.Beta}, diff --git a/test/e2e/network/dns.go b/test/e2e/network/dns.go index f3788a49a1c..d60fb2e6427 100644 --- a/test/e2e/network/dns.go +++ b/test/e2e/network/dns.go @@ -569,6 +569,50 @@ var _ = common.SIGDescribe("DNS", func() { // TODO: Add more test cases for other DNSPolicies. }) + ginkgo.It("should work with the pod containing more than 6 DNS search paths and longer than 256 search list characters", func() { + ginkgo.By("Getting the kube-dns IP") + svc, err := f.ClientSet.CoreV1().Services("kube-system").Get(context.TODO(), "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", + "kubernetes.default.svc", + } + 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") + + ginkgo.By("Creating a pod with expanded DNS configuration to probe DNS") + testNdotsValue := "5" + testSearchPaths := []string{ + fmt.Sprintf("%038d.k8s.io", 1), + fmt.Sprintf("%038d.k8s.io", 2), + fmt.Sprintf("%038d.k8s.io", 3), + fmt.Sprintf("%038d.k8s.io", 4), + fmt.Sprintf("%038d.k8s.io", 5), + fmt.Sprintf("%038d.k8s.io", 6), // 260 characters + } + pod := createDNSPod(f.Namespace.Name, wheezyProbeCmd, jessieProbeCmd, dnsTestPodHostName, dnsTestServiceName) + pod.Spec.DNSPolicy = v1.DNSClusterFirst + pod.Spec.DNSConfig = &v1.PodDNSConfig{ + Nameservers: []string{kubednsIP}, + Searches: testSearchPaths, + Options: []v1.PodDNSConfigOption{ + { + Name: "ndots", + Value: &testNdotsValue, + }, + }, + } + validateDNSResults(f, pod, append(wheezyFileNames, jessieFileNames...)) + }) + }) var _ = common.SIGDescribe("DNS HostNetwork", func() {