mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-01 07:47:56 +00:00
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.
This commit is contained in:
parent
c3eebb233d
commit
b565fbeac0
@ -20,7 +20,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
|
|
||||||
"k8s.io/kubernetes/test/e2e/framework"
|
"k8s.io/kubernetes/test/e2e/framework"
|
||||||
e2eskipper "k8s.io/kubernetes/test/e2e/framework/skipper"
|
|
||||||
admissionapi "k8s.io/pod-security-admission/api"
|
admissionapi "k8s.io/pod-security-admission/api"
|
||||||
|
|
||||||
"github.com/onsi/ginkgo/v2"
|
"github.com/onsi/ginkgo/v2"
|
||||||
@ -36,17 +35,10 @@ const (
|
|||||||
coreDNSRoleName = "system:coredns"
|
coreDNSRoleName = "system:coredns"
|
||||||
coreDNSRoleBindingName = coreDNSRoleName
|
coreDNSRoleBindingName = coreDNSRoleName
|
||||||
coreDNSDeploymentName = "coredns"
|
coreDNSDeploymentName = "coredns"
|
||||||
|
|
||||||
kubeDNSServiceAccountName = "kube-dns"
|
|
||||||
kubeDNSDeploymentName = "kube-dns"
|
|
||||||
)
|
|
||||||
|
|
||||||
var (
|
|
||||||
dnsType = ""
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Define container for all the test specification aimed at verifying
|
// Define container for all the test specification aimed at verifying
|
||||||
// that kubeadm configures the dns as expected
|
// that kubeadm configures the DNS addon as expected
|
||||||
var _ = Describe("DNS addon", func() {
|
var _ = Describe("DNS addon", func() {
|
||||||
|
|
||||||
// Get an instance of the k8s test framework
|
// Get an instance of the k8s test framework
|
||||||
@ -57,66 +49,13 @@ var _ = Describe("DNS addon", func() {
|
|||||||
// so we are disabling the creation of a namespace in order to get a faster execution
|
// so we are disabling the creation of a namespace in order to get a faster execution
|
||||||
f.SkipNamespaceCreation = true
|
f.SkipNamespaceCreation = true
|
||||||
|
|
||||||
// kubeadm supports two type of DNS addon, and so
|
|
||||||
// it is necessary to get it from the kubeadm-config ConfigMap before testing
|
|
||||||
ginkgo.BeforeEach(func() {
|
|
||||||
// if the dnsType name is already known exit
|
|
||||||
if dnsType != "" {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// gets the ClusterConfiguration from the kubeadm kubeadm-config ConfigMap as a untyped map
|
|
||||||
m := getClusterConfiguration(f.ClientSet)
|
|
||||||
|
|
||||||
// Extract the dnsType
|
|
||||||
dnsType = "CoreDNS"
|
|
||||||
if _, ok := m["dns"]; ok {
|
|
||||||
d := m["dns"].(map[interface{}]interface{})
|
|
||||||
if t, ok := d["type"]; ok {
|
|
||||||
dnsType = t.(string)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
ginkgo.Context("kube-dns", func() {
|
|
||||||
ginkgo.Context("kube-dns ServiceAccount", func() {
|
|
||||||
ginkgo.It("should exist", func(ctx context.Context) {
|
|
||||||
if dnsType != "kube-dns" {
|
|
||||||
e2eskipper.Skipf("Skipping because DNS type is %s", dnsType)
|
|
||||||
}
|
|
||||||
|
|
||||||
ExpectServiceAccount(f.ClientSet, kubeSystemNamespace, kubeDNSServiceAccountName)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
ginkgo.Context("kube-dns Deployment", func() {
|
|
||||||
ginkgo.It("should exist and be properly configured", func(ctx context.Context) {
|
|
||||||
if dnsType != "kube-dns" {
|
|
||||||
e2eskipper.Skipf("Skipping because DNS type is %s", dnsType)
|
|
||||||
}
|
|
||||||
|
|
||||||
d := GetDeployment(f.ClientSet, kubeSystemNamespace, kubeDNSDeploymentName)
|
|
||||||
|
|
||||||
gomega.Expect(d.Spec.Template.Spec.ServiceAccountName).To(gomega.Equal(kubeDNSServiceAccountName))
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
ginkgo.Context("CoreDNS", func() {
|
ginkgo.Context("CoreDNS", func() {
|
||||||
ginkgo.Context("CoreDNS ServiceAccount", func() {
|
ginkgo.Context("CoreDNS ServiceAccount", func() {
|
||||||
ginkgo.It("should exist", func(ctx context.Context) {
|
ginkgo.It("should exist", func(ctx context.Context) {
|
||||||
if dnsType != "CoreDNS" {
|
|
||||||
e2eskipper.Skipf("Skipping because DNS type is %s", dnsType)
|
|
||||||
}
|
|
||||||
|
|
||||||
ExpectServiceAccount(f.ClientSet, kubeSystemNamespace, coreDNSServiceAccountName)
|
ExpectServiceAccount(f.ClientSet, kubeSystemNamespace, coreDNSServiceAccountName)
|
||||||
})
|
})
|
||||||
|
|
||||||
ginkgo.It("should have related ClusterRole and ClusterRoleBinding", func(ctx context.Context) {
|
ginkgo.It("should have related ClusterRole and ClusterRoleBinding", func(ctx context.Context) {
|
||||||
if dnsType != "CoreDNS" {
|
|
||||||
e2eskipper.Skipf("Skipping because DNS type is %s", dnsType)
|
|
||||||
}
|
|
||||||
|
|
||||||
ExpectClusterRole(f.ClientSet, coreDNSRoleName)
|
ExpectClusterRole(f.ClientSet, coreDNSRoleName)
|
||||||
ExpectClusterRoleBinding(f.ClientSet, coreDNSRoleBindingName)
|
ExpectClusterRoleBinding(f.ClientSet, coreDNSRoleBindingName)
|
||||||
})
|
})
|
||||||
@ -124,24 +63,14 @@ var _ = Describe("DNS addon", func() {
|
|||||||
|
|
||||||
ginkgo.Context("CoreDNS ConfigMap", func() {
|
ginkgo.Context("CoreDNS ConfigMap", func() {
|
||||||
ginkgo.It("should exist and be properly configured", func(ctx context.Context) {
|
ginkgo.It("should exist and be properly configured", func(ctx context.Context) {
|
||||||
if dnsType != "CoreDNS" {
|
|
||||||
e2eskipper.Skipf("Skipping because DNS type is %s", dnsType)
|
|
||||||
}
|
|
||||||
|
|
||||||
cm := GetConfigMap(f.ClientSet, kubeSystemNamespace, coreDNSConfigMap)
|
cm := GetConfigMap(f.ClientSet, kubeSystemNamespace, coreDNSConfigMap)
|
||||||
|
|
||||||
gomega.Expect(cm.Data).To(gomega.HaveKey(coreDNSConfigMapKey))
|
gomega.Expect(cm.Data).To(gomega.HaveKey(coreDNSConfigMapKey))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
ginkgo.Context("CoreDNS Deployment", func() {
|
ginkgo.Context("CoreDNS Deployment", func() {
|
||||||
ginkgo.It("should exist and be properly configured", func(ctx context.Context) {
|
ginkgo.It("should exist and be properly configured", func(ctx context.Context) {
|
||||||
if dnsType != "CoreDNS" {
|
|
||||||
e2eskipper.Skipf("Skipping because DNS type is %s", dnsType)
|
|
||||||
}
|
|
||||||
|
|
||||||
d := GetDeployment(f.ClientSet, kubeSystemNamespace, coreDNSDeploymentName)
|
d := GetDeployment(f.ClientSet, kubeSystemNamespace, coreDNSDeploymentName)
|
||||||
|
|
||||||
gomega.Expect(d.Spec.Template.Spec.ServiceAccountName).To(gomega.Equal(coreDNSServiceAccountName))
|
gomega.Expect(d.Spec.Template.Spec.ServiceAccountName).To(gomega.Equal(coreDNSServiceAccountName))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user