Skip to content

Commit b565fbe

Browse files
committed
test/e2e_kubeadm/dns_addon_test.go: drop kube-dns tests
kube-dns as an alternative DNS addon to CoreDNS hasn't been supported since 1.22 when kubeadm's v1beta3 API was added. Remove the related tests from the e2e_kubeadm test framework.
1 parent c3eebb2 commit b565fbe

File tree

1 file changed

+1
-72
lines changed

1 file changed

+1
-72
lines changed

test/e2e_kubeadm/dns_addon_test.go

Lines changed: 1 addition & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"context"
2121

2222
"k8s.io/kubernetes/test/e2e/framework"
23-
e2eskipper "k8s.io/kubernetes/test/e2e/framework/skipper"
2423
admissionapi "k8s.io/pod-security-admission/api"
2524

2625
"github.com/onsi/ginkgo/v2"
@@ -36,17 +35,10 @@ const (
3635
coreDNSRoleName = "system:coredns"
3736
coreDNSRoleBindingName = coreDNSRoleName
3837
coreDNSDeploymentName = "coredns"
39-
40-
kubeDNSServiceAccountName = "kube-dns"
41-
kubeDNSDeploymentName = "kube-dns"
42-
)
43-
44-
var (
45-
dnsType = ""
4638
)
4739

4840
// Define container for all the test specification aimed at verifying
49-
// that kubeadm configures the dns as expected
41+
// that kubeadm configures the DNS addon as expected
5042
var _ = Describe("DNS addon", func() {
5143

5244
// Get an instance of the k8s test framework
@@ -57,91 +49,28 @@ var _ = Describe("DNS addon", func() {
5749
// so we are disabling the creation of a namespace in order to get a faster execution
5850
f.SkipNamespaceCreation = true
5951

60-
// kubeadm supports two type of DNS addon, and so
61-
// it is necessary to get it from the kubeadm-config ConfigMap before testing
62-
ginkgo.BeforeEach(func() {
63-
// if the dnsType name is already known exit
64-
if dnsType != "" {
65-
return
66-
}
67-
68-
// gets the ClusterConfiguration from the kubeadm kubeadm-config ConfigMap as a untyped map
69-
m := getClusterConfiguration(f.ClientSet)
70-
71-
// Extract the dnsType
72-
dnsType = "CoreDNS"
73-
if _, ok := m["dns"]; ok {
74-
d := m["dns"].(map[interface{}]interface{})
75-
if t, ok := d["type"]; ok {
76-
dnsType = t.(string)
77-
}
78-
}
79-
})
80-
81-
ginkgo.Context("kube-dns", func() {
82-
ginkgo.Context("kube-dns ServiceAccount", func() {
83-
ginkgo.It("should exist", func(ctx context.Context) {
84-
if dnsType != "kube-dns" {
85-
e2eskipper.Skipf("Skipping because DNS type is %s", dnsType)
86-
}
87-
88-
ExpectServiceAccount(f.ClientSet, kubeSystemNamespace, kubeDNSServiceAccountName)
89-
})
90-
})
91-
92-
ginkgo.Context("kube-dns Deployment", func() {
93-
ginkgo.It("should exist and be properly configured", func(ctx context.Context) {
94-
if dnsType != "kube-dns" {
95-
e2eskipper.Skipf("Skipping because DNS type is %s", dnsType)
96-
}
97-
98-
d := GetDeployment(f.ClientSet, kubeSystemNamespace, kubeDNSDeploymentName)
99-
100-
gomega.Expect(d.Spec.Template.Spec.ServiceAccountName).To(gomega.Equal(kubeDNSServiceAccountName))
101-
})
102-
})
103-
})
104-
10552
ginkgo.Context("CoreDNS", func() {
10653
ginkgo.Context("CoreDNS ServiceAccount", func() {
10754
ginkgo.It("should exist", func(ctx context.Context) {
108-
if dnsType != "CoreDNS" {
109-
e2eskipper.Skipf("Skipping because DNS type is %s", dnsType)
110-
}
111-
11255
ExpectServiceAccount(f.ClientSet, kubeSystemNamespace, coreDNSServiceAccountName)
11356
})
11457

11558
ginkgo.It("should have related ClusterRole and ClusterRoleBinding", func(ctx context.Context) {
116-
if dnsType != "CoreDNS" {
117-
e2eskipper.Skipf("Skipping because DNS type is %s", dnsType)
118-
}
119-
12059
ExpectClusterRole(f.ClientSet, coreDNSRoleName)
12160
ExpectClusterRoleBinding(f.ClientSet, coreDNSRoleBindingName)
12261
})
12362
})
12463

12564
ginkgo.Context("CoreDNS ConfigMap", func() {
12665
ginkgo.It("should exist and be properly configured", func(ctx context.Context) {
127-
if dnsType != "CoreDNS" {
128-
e2eskipper.Skipf("Skipping because DNS type is %s", dnsType)
129-
}
130-
13166
cm := GetConfigMap(f.ClientSet, kubeSystemNamespace, coreDNSConfigMap)
132-
13367
gomega.Expect(cm.Data).To(gomega.HaveKey(coreDNSConfigMapKey))
13468
})
13569
})
13670

13771
ginkgo.Context("CoreDNS Deployment", func() {
13872
ginkgo.It("should exist and be properly configured", func(ctx context.Context) {
139-
if dnsType != "CoreDNS" {
140-
e2eskipper.Skipf("Skipping because DNS type is %s", dnsType)
141-
}
142-
14373
d := GetDeployment(f.ClientSet, kubeSystemNamespace, coreDNSDeploymentName)
144-
14574
gomega.Expect(d.Spec.Template.Spec.ServiceAccountName).To(gomega.Equal(coreDNSServiceAccountName))
14675
})
14776
})

0 commit comments

Comments
 (0)