mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 04:33:26 +00:00
Remove federation tests entirely because they break clusters and aren't relevant anymore
This commit is contained in:
parent
def8fe3b4e
commit
77b78a2c1f
@ -23,20 +23,12 @@ import (
|
|||||||
|
|
||||||
v1 "k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/util/wait"
|
|
||||||
"k8s.io/kubernetes/test/e2e/framework"
|
"k8s.io/kubernetes/test/e2e/framework"
|
||||||
e2eservice "k8s.io/kubernetes/test/e2e/framework/service"
|
e2eservice "k8s.io/kubernetes/test/e2e/framework/service"
|
||||||
|
|
||||||
"github.com/onsi/ginkgo"
|
"github.com/onsi/ginkgo"
|
||||||
)
|
)
|
||||||
|
|
||||||
type dnsFederationsConfigMapTest struct {
|
|
||||||
dnsTestCommon
|
|
||||||
|
|
||||||
fedMap map[string]string
|
|
||||||
isValid bool
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
googleDNSHostname = "dns.google"
|
googleDNSHostname = "dns.google"
|
||||||
// The ConfigMap update mechanism takes longer than the standard
|
// The ConfigMap update mechanism takes longer than the standard
|
||||||
@ -44,167 +36,6 @@ var (
|
|||||||
moreForeverTestTimeout = 2 * 60 * time.Second
|
moreForeverTestTimeout = 2 * 60 * time.Second
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = SIGDescribe("DNS configMap federations [Feature:Federation]", func() {
|
|
||||||
|
|
||||||
t := &dnsFederationsConfigMapTest{dnsTestCommon: newDNSTestCommon()}
|
|
||||||
|
|
||||||
ginkgo.It("should be able to change federation configuration [Slow][Serial]", func() {
|
|
||||||
t.c = t.f.ClientSet
|
|
||||||
t.run()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
func (t *dnsFederationsConfigMapTest) run() {
|
|
||||||
t.init()
|
|
||||||
|
|
||||||
defer t.c.CoreV1().ConfigMaps(t.ns).Delete(context.TODO(), t.name, metav1.DeleteOptions{})
|
|
||||||
t.createUtilPodLabel("e2e-dns-configmap")
|
|
||||||
defer t.deleteUtilPod()
|
|
||||||
originalConfigMapData := t.fetchDNSConfigMapData()
|
|
||||||
defer t.restoreDNSConfigMap(originalConfigMapData)
|
|
||||||
|
|
||||||
t.validate(framework.TestContext.ClusterDNSDomain)
|
|
||||||
|
|
||||||
if t.name == "coredns" {
|
|
||||||
t.labels = []string{"abc", "ghi"}
|
|
||||||
valid1 := map[string]string{
|
|
||||||
"Corefile": fmt.Sprintf(`.:53 {
|
|
||||||
health
|
|
||||||
ready
|
|
||||||
kubernetes %v in-addr.arpa ip6.arpa {
|
|
||||||
pods insecure
|
|
||||||
fallthrough in-addr.arpa ip6.arpa
|
|
||||||
ttl 30
|
|
||||||
}
|
|
||||||
federation %v {
|
|
||||||
abc def.com
|
|
||||||
}
|
|
||||||
forward . /etc/resolv.conf
|
|
||||||
}`, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterDNSDomain)}
|
|
||||||
valid1m := map[string]string{t.labels[0]: "def.com"}
|
|
||||||
|
|
||||||
valid2 := map[string]string{
|
|
||||||
"Corefile": fmt.Sprintf(`:53 {
|
|
||||||
health
|
|
||||||
ready
|
|
||||||
kubernetes %v in-addr.arpa ip6.arpa {
|
|
||||||
pods insecure
|
|
||||||
fallthrough in-addr.arpa ip6.arpa
|
|
||||||
ttl 30
|
|
||||||
}
|
|
||||||
federation %v {
|
|
||||||
ghi xyz.com
|
|
||||||
}
|
|
||||||
forward . /etc/resolv.conf
|
|
||||||
}`, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterDNSDomain)}
|
|
||||||
valid2m := map[string]string{t.labels[1]: "xyz.com"}
|
|
||||||
|
|
||||||
ginkgo.By("default -> valid1")
|
|
||||||
t.setConfigMap(&v1.ConfigMap{Data: valid1}, valid1m, true)
|
|
||||||
t.deleteCoreDNSPods()
|
|
||||||
t.validate(framework.TestContext.ClusterDNSDomain)
|
|
||||||
|
|
||||||
ginkgo.By("valid1 -> valid2")
|
|
||||||
t.setConfigMap(&v1.ConfigMap{Data: valid2}, valid2m, true)
|
|
||||||
t.deleteCoreDNSPods()
|
|
||||||
t.validate(framework.TestContext.ClusterDNSDomain)
|
|
||||||
|
|
||||||
ginkgo.By("valid2 -> default")
|
|
||||||
t.setConfigMap(&v1.ConfigMap{Data: originalConfigMapData}, nil, false)
|
|
||||||
t.deleteCoreDNSPods()
|
|
||||||
t.validate(framework.TestContext.ClusterDNSDomain)
|
|
||||||
|
|
||||||
t.restoreDNSConfigMap(originalConfigMapData)
|
|
||||||
|
|
||||||
} else {
|
|
||||||
t.labels = []string{"abc", "ghi"}
|
|
||||||
valid1 := map[string]string{"federations": t.labels[0] + "=def"}
|
|
||||||
valid1m := map[string]string{t.labels[0]: "def"}
|
|
||||||
valid2 := map[string]string{"federations": t.labels[1] + "=xyz"}
|
|
||||||
valid2m := map[string]string{t.labels[1]: "xyz"}
|
|
||||||
invalid := map[string]string{"federations": "invalid.map=xyz"}
|
|
||||||
|
|
||||||
ginkgo.By("empty -> valid1")
|
|
||||||
t.setConfigMap(&v1.ConfigMap{Data: valid1}, valid1m, true)
|
|
||||||
t.validate(framework.TestContext.ClusterDNSDomain)
|
|
||||||
|
|
||||||
ginkgo.By("valid1 -> valid2")
|
|
||||||
t.setConfigMap(&v1.ConfigMap{Data: valid2}, valid2m, true)
|
|
||||||
t.validate(framework.TestContext.ClusterDNSDomain)
|
|
||||||
|
|
||||||
ginkgo.By("valid2 -> invalid")
|
|
||||||
t.setConfigMap(&v1.ConfigMap{Data: invalid}, nil, false)
|
|
||||||
t.validate(framework.TestContext.ClusterDNSDomain)
|
|
||||||
|
|
||||||
ginkgo.By("invalid -> valid1")
|
|
||||||
t.setConfigMap(&v1.ConfigMap{Data: valid1}, valid1m, true)
|
|
||||||
t.validate(framework.TestContext.ClusterDNSDomain)
|
|
||||||
|
|
||||||
ginkgo.By("valid1 -> deleted")
|
|
||||||
t.deleteConfigMap()
|
|
||||||
t.validate(framework.TestContext.ClusterDNSDomain)
|
|
||||||
|
|
||||||
ginkgo.By("deleted -> invalid")
|
|
||||||
t.setConfigMap(&v1.ConfigMap{Data: invalid}, nil, false)
|
|
||||||
t.validate(framework.TestContext.ClusterDNSDomain)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *dnsFederationsConfigMapTest) validate(dnsDomain string) {
|
|
||||||
federations := t.fedMap
|
|
||||||
|
|
||||||
if len(federations) == 0 {
|
|
||||||
ginkgo.By(fmt.Sprintf("Validating federation labels %v do not exist", t.labels))
|
|
||||||
|
|
||||||
for _, label := range t.labels {
|
|
||||||
var federationDNS = fmt.Sprintf("e2e-dns-configmap.%s.%s.svc.%s.",
|
|
||||||
t.f.Namespace.Name, label, framework.TestContext.ClusterDNSDomain)
|
|
||||||
predicate := func(actual []string) bool {
|
|
||||||
return len(actual) == 0
|
|
||||||
}
|
|
||||||
t.checkDNSRecordFrom(federationDNS, predicate, "cluster-dns", wait.ForeverTestTimeout)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for label := range federations {
|
|
||||||
var federationDNS = fmt.Sprintf("%s.%s.%s.svc.%s.",
|
|
||||||
t.utilService.ObjectMeta.Name, t.f.Namespace.Name, label, framework.TestContext.ClusterDNSDomain)
|
|
||||||
var localDNS = fmt.Sprintf("%s.%s.svc.%s.",
|
|
||||||
t.utilService.ObjectMeta.Name, t.f.Namespace.Name, framework.TestContext.ClusterDNSDomain)
|
|
||||||
if t.name == "coredns" {
|
|
||||||
localDNS = t.utilService.Spec.ClusterIP
|
|
||||||
}
|
|
||||||
// Check local mapping. Checking a remote mapping requires
|
|
||||||
// creating an arbitrary DNS record which is not possible at the
|
|
||||||
// moment.
|
|
||||||
ginkgo.By(fmt.Sprintf("Validating federation record %v", label))
|
|
||||||
predicate := func(actual []string) bool {
|
|
||||||
for _, v := range actual {
|
|
||||||
if v == localDNS {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
t.checkDNSRecordFrom(federationDNS, predicate, "cluster-dns", wait.ForeverTestTimeout)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *dnsFederationsConfigMapTest) setConfigMap(cm *v1.ConfigMap, fedMap map[string]string, isValid bool) {
|
|
||||||
t.fedMap = nil
|
|
||||||
|
|
||||||
if isValid {
|
|
||||||
t.fedMap = fedMap
|
|
||||||
}
|
|
||||||
t.isValid = isValid
|
|
||||||
t.dnsTestCommon.setConfigMap(cm)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *dnsFederationsConfigMapTest) deleteConfigMap() {
|
|
||||||
t.isValid = false
|
|
||||||
t.dnsTestCommon.deleteConfigMap()
|
|
||||||
}
|
|
||||||
|
|
||||||
type dnsNameserverTest struct {
|
type dnsNameserverTest struct {
|
||||||
dnsTestCommon
|
dnsTestCommon
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user