Promote ExpandedDNSConfig feature to the beta stage

This adds an e2e test for the feature and promotes ExpandedDNSConfig
feature to the beta stage.
This commit is contained in:
Gunju Kim 2022-03-27 13:45:01 +09:00
parent 02109414e8
commit add4652352
No known key found for this signature in database
GPG Key ID: 9300A528F3F0DAB7
2 changed files with 46 additions and 1 deletions

View File

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

View File

@ -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() {