mirror of https://github.com/k3s-io/k3s
Merge pull request #70156 from nagiesek/fix_pqdn_tests
Removes PQDNs from conformance tests and places them in their own testspull/564/head
commit
ffec91179d
|
@ -44,9 +44,8 @@ var _ = SIGDescribe("DNS", func() {
|
|||
framework.ConformanceIt("should provide DNS for the cluster ", func() {
|
||||
// All the names we need to be able to resolve.
|
||||
// TODO: Spin up a separate test service and test that dns works for that service.
|
||||
// NOTE: This only contains the FQDN and the Host name, for testing partial name, see the test below
|
||||
namesToResolve := []string{
|
||||
"kubernetes.default",
|
||||
"kubernetes.default.svc",
|
||||
fmt.Sprintf("kubernetes.default.svc.%s", framework.TestContext.ClusterDNSDomain),
|
||||
}
|
||||
// Added due to #8512. This is critical for GCE and GKE deployments.
|
||||
|
@ -67,12 +66,38 @@ var _ = SIGDescribe("DNS", func() {
|
|||
validateDNSResults(f, pod, append(wheezyFileNames, jessieFileNames...))
|
||||
})
|
||||
|
||||
It("should resolve DNS of partial qualified names for the cluster ", func() {
|
||||
// All the names we need to be able to resolve.
|
||||
// TODO: Spin up a separate test service and test that dns works for that service.
|
||||
namesToResolve := []string{
|
||||
"kubernetes.default",
|
||||
"kubernetes.default.svc",
|
||||
}
|
||||
// Added due to #8512. This is critical for GCE and GKE deployments.
|
||||
if framework.ProviderIs("gce", "gke") {
|
||||
namesToResolve = append(namesToResolve, "google.com")
|
||||
namesToResolve = append(namesToResolve, "metadata")
|
||||
}
|
||||
hostFQDN := fmt.Sprintf("%s.%s.%s.svc.cluster.local", dnsTestPodHostName, dnsTestServiceName, f.Namespace.Name)
|
||||
hostEntries := []string{hostFQDN, dnsTestPodHostName}
|
||||
wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, hostEntries, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain)
|
||||
jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, hostEntries, "", "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain)
|
||||
By("Running these commands on wheezy: " + wheezyProbeCmd + "\n")
|
||||
By("Running these commands on jessie: " + jessieProbeCmd + "\n")
|
||||
|
||||
// Run a pod which probes DNS and exposes the results by HTTP.
|
||||
By("creating a pod to probe DNS")
|
||||
pod := createDNSPod(f.Namespace.Name, wheezyProbeCmd, jessieProbeCmd, dnsTestPodHostName, dnsTestServiceName)
|
||||
validateDNSResults(f, pod, append(wheezyFileNames, jessieFileNames...))
|
||||
})
|
||||
|
||||
/*
|
||||
Release : v1.9
|
||||
Testname: DNS, services
|
||||
Description: When a headless service is created, the service MUST be able to resolve all the required service endpoints. When the service is created, any pod in the same namespace must be able to resolve the service by all of the expected DNS names.
|
||||
*/
|
||||
framework.ConformanceIt("should provide DNS for services ", func() {
|
||||
// NOTE: This only contains the FQDN and the Host name, for testing partial name, see the test below
|
||||
// Create a test headless service.
|
||||
By("Creating a test headless service")
|
||||
testServiceSelector := map[string]string{
|
||||
|
@ -98,6 +123,53 @@ var _ = SIGDescribe("DNS", func() {
|
|||
f.ClientSet.CoreV1().Services(f.Namespace.Name).Delete(regularService.Name, nil)
|
||||
}()
|
||||
|
||||
// All the names we need to be able to resolve.
|
||||
// TODO: Create more endpoints and ensure that multiple A records are returned
|
||||
// for headless service.
|
||||
namesToResolve := []string{
|
||||
fmt.Sprintf("%s.%s.svc.cluster.local", headlessService.Name, f.Namespace.Name),
|
||||
fmt.Sprintf("_http._tcp.%s.%s.svc.cluster.local", headlessService.Name, f.Namespace.Name),
|
||||
fmt.Sprintf("_http._tcp.%s.%s.svc.cluster.local", regularService.Name, f.Namespace.Name),
|
||||
}
|
||||
|
||||
wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, nil, regularService.Spec.ClusterIP, "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain)
|
||||
jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, nil, regularService.Spec.ClusterIP, "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain)
|
||||
By("Running these commands on wheezy: " + wheezyProbeCmd + "\n")
|
||||
By("Running these commands on jessie: " + jessieProbeCmd + "\n")
|
||||
|
||||
// Run a pod which probes DNS and exposes the results by HTTP.
|
||||
By("creating a pod to probe DNS")
|
||||
pod := createDNSPod(f.Namespace.Name, wheezyProbeCmd, jessieProbeCmd, dnsTestPodHostName, dnsTestServiceName)
|
||||
pod.ObjectMeta.Labels = testServiceSelector
|
||||
|
||||
validateDNSResults(f, pod, append(wheezyFileNames, jessieFileNames...))
|
||||
})
|
||||
|
||||
It("should resolve DNS of partial qualified names for services ", func() {
|
||||
// Create a test headless service.
|
||||
By("Creating a test headless service")
|
||||
testServiceSelector := map[string]string{
|
||||
"dns-test": "true",
|
||||
}
|
||||
headlessService := framework.CreateServiceSpec(dnsTestServiceName, "", true, testServiceSelector)
|
||||
_, err := f.ClientSet.CoreV1().Services(f.Namespace.Name).Create(headlessService)
|
||||
Expect(err).NotTo(HaveOccurred(), "failed to create headless service: %s", dnsTestServiceName)
|
||||
defer func() {
|
||||
By("deleting the test headless service")
|
||||
defer GinkgoRecover()
|
||||
f.ClientSet.CoreV1().Services(f.Namespace.Name).Delete(headlessService.Name, nil)
|
||||
}()
|
||||
|
||||
regularServiceName := "test-service-2"
|
||||
regularService := framework.CreateServiceSpec(regularServiceName, "", false, testServiceSelector)
|
||||
regularService, err = f.ClientSet.CoreV1().Services(f.Namespace.Name).Create(regularService)
|
||||
Expect(err).NotTo(HaveOccurred(), "failed to create regular service: %s", regularServiceName)
|
||||
defer func() {
|
||||
By("deleting the test service")
|
||||
defer GinkgoRecover()
|
||||
f.ClientSet.CoreV1().Services(f.Namespace.Name).Delete(regularService.Name, nil)
|
||||
}()
|
||||
|
||||
// All the names we need to be able to resolve.
|
||||
// TODO: Create more endpoints and ensure that multiple A records are returned
|
||||
// for headless service.
|
||||
|
|
Loading…
Reference in New Issue