mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 18:00:08 +00:00
Add a method to TestContext to check if is IPv6
This commit is contained in:
parent
930a1321da
commit
45d6f08868
@ -234,6 +234,11 @@ type CloudConfig struct {
|
|||||||
// TestContext should be used by all tests to access common context data.
|
// TestContext should be used by all tests to access common context data.
|
||||||
var TestContext TestContextType
|
var TestContext TestContextType
|
||||||
|
|
||||||
|
// ClusterIsIPv6 returns true if the cluster is IPv6
|
||||||
|
func (tc TestContextType) ClusterIsIPv6() bool {
|
||||||
|
return tc.IPFamily == "ipv6"
|
||||||
|
}
|
||||||
|
|
||||||
// RegisterCommonFlags registers flags common to all e2e test suites.
|
// RegisterCommonFlags registers flags common to all e2e test suites.
|
||||||
// The flag set can be flag.CommandLine (if desired) or a custom
|
// The flag set can be flag.CommandLine (if desired) or a custom
|
||||||
// flag set that then gets passed to viperconfig.ViperizeFlags.
|
// flag set that then gets passed to viperconfig.ViperizeFlags.
|
||||||
|
@ -430,11 +430,6 @@ func getDefaultClusterIPFamily(c clientset.Interface) string {
|
|||||||
return "ipv4"
|
return "ipv4"
|
||||||
}
|
}
|
||||||
|
|
||||||
// ClusterIsIPv6 returns true if the cluster is IPv6
|
|
||||||
func ClusterIsIPv6() bool {
|
|
||||||
return TestContext.IPFamily == "ipv6"
|
|
||||||
}
|
|
||||||
|
|
||||||
// ProviderIs returns true if the provider is included is the providers. Otherwise false.
|
// ProviderIs returns true if the provider is included is the providers. Otherwise false.
|
||||||
func ProviderIs(providers ...string) bool {
|
func ProviderIs(providers ...string) bool {
|
||||||
for _, provider := range providers {
|
for _, provider := range providers {
|
||||||
|
@ -50,8 +50,8 @@ var _ = SIGDescribe("DNS", func() {
|
|||||||
fmt.Sprintf("kubernetes.default.svc.%s", framework.TestContext.ClusterDNSDomain),
|
fmt.Sprintf("kubernetes.default.svc.%s", framework.TestContext.ClusterDNSDomain),
|
||||||
}
|
}
|
||||||
// TODO: Validate both IPv4 and IPv6 families for dual-stack
|
// TODO: Validate both IPv4 and IPv6 families for dual-stack
|
||||||
wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, nil, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.ClusterIsIPv6())
|
wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, nil, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6())
|
||||||
jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, nil, "", "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.ClusterIsIPv6())
|
jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, nil, "", "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 wheezy: " + wheezyProbeCmd + "\n")
|
||||||
ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n")
|
ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n")
|
||||||
|
|
||||||
@ -72,8 +72,8 @@ var _ = SIGDescribe("DNS", func() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Validate both IPv4 and IPv6 families for dual-stack
|
// TODO: Validate both IPv4 and IPv6 families for dual-stack
|
||||||
wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, nil, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.ClusterIsIPv6())
|
wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, nil, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6())
|
||||||
jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, nil, "", "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.ClusterIsIPv6())
|
jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, nil, "", "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 wheezy: " + wheezyProbeCmd + "\n")
|
||||||
ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n")
|
ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n")
|
||||||
|
|
||||||
@ -94,8 +94,8 @@ var _ = SIGDescribe("DNS", func() {
|
|||||||
hostFQDN := fmt.Sprintf("%s.%s.%s.svc.%s", dnsTestPodHostName, dnsTestServiceName, f.Namespace.Name, framework.TestContext.ClusterDNSDomain)
|
hostFQDN := fmt.Sprintf("%s.%s.%s.svc.%s", dnsTestPodHostName, dnsTestServiceName, f.Namespace.Name, framework.TestContext.ClusterDNSDomain)
|
||||||
hostEntries := []string{hostFQDN, dnsTestPodHostName}
|
hostEntries := []string{hostFQDN, dnsTestPodHostName}
|
||||||
// TODO: Validate both IPv4 and IPv6 families for dual-stack
|
// TODO: Validate both IPv4 and IPv6 families for dual-stack
|
||||||
wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, hostEntries, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.ClusterIsIPv6())
|
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.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 wheezy: " + wheezyProbeCmd + "\n")
|
||||||
ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n")
|
ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n")
|
||||||
|
|
||||||
@ -114,8 +114,8 @@ var _ = SIGDescribe("DNS", func() {
|
|||||||
hostFQDN := fmt.Sprintf("%s.%s.%s.svc.%s", dnsTestPodHostName, dnsTestServiceName, f.Namespace.Name, framework.TestContext.ClusterDNSDomain)
|
hostFQDN := fmt.Sprintf("%s.%s.%s.svc.%s", dnsTestPodHostName, dnsTestServiceName, f.Namespace.Name, framework.TestContext.ClusterDNSDomain)
|
||||||
hostEntries := []string{hostFQDN, dnsTestPodHostName}
|
hostEntries := []string{hostFQDN, dnsTestPodHostName}
|
||||||
// TODO: Validate both IPv4 and IPv6 families for dual-stack
|
// TODO: Validate both IPv4 and IPv6 families for dual-stack
|
||||||
wheezyProbeCmd, wheezyFileNames := createProbeCommand(nil, hostEntries, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.ClusterIsIPv6())
|
wheezyProbeCmd, wheezyFileNames := createProbeCommand(nil, hostEntries, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6())
|
||||||
jessieProbeCmd, jessieFileNames := createProbeCommand(nil, hostEntries, "", "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.ClusterIsIPv6())
|
jessieProbeCmd, jessieFileNames := createProbeCommand(nil, 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 wheezy: " + wheezyProbeCmd + "\n")
|
||||||
ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n")
|
ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n")
|
||||||
|
|
||||||
@ -167,8 +167,8 @@ var _ = SIGDescribe("DNS", func() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Validate both IPv4 and IPv6 families for dual-stack
|
// TODO: Validate both IPv4 and IPv6 families for dual-stack
|
||||||
wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, nil, regularService.Spec.ClusterIP, "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.ClusterIsIPv6())
|
wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, nil, regularService.Spec.ClusterIP, "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6())
|
||||||
jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, nil, regularService.Spec.ClusterIP, "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.ClusterIsIPv6())
|
jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, nil, regularService.Spec.ClusterIP, "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 wheezy: " + wheezyProbeCmd + "\n")
|
||||||
ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n")
|
ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n")
|
||||||
|
|
||||||
@ -218,8 +218,8 @@ var _ = SIGDescribe("DNS", func() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Validate both IPv4 and IPv6 families for dual-stack
|
// TODO: Validate both IPv4 and IPv6 families for dual-stack
|
||||||
wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, nil, regularService.Spec.ClusterIP, "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.ClusterIsIPv6())
|
wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, nil, regularService.Spec.ClusterIP, "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6())
|
||||||
jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, nil, regularService.Spec.ClusterIP, "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.ClusterIsIPv6())
|
jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, nil, regularService.Spec.ClusterIP, "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 wheezy: " + wheezyProbeCmd + "\n")
|
||||||
ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n")
|
ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n")
|
||||||
|
|
||||||
@ -258,8 +258,8 @@ var _ = SIGDescribe("DNS", func() {
|
|||||||
hostFQDN := fmt.Sprintf("%s.%s.%s.svc.%s", podHostname, serviceName, f.Namespace.Name, framework.TestContext.ClusterDNSDomain)
|
hostFQDN := fmt.Sprintf("%s.%s.%s.svc.%s", podHostname, serviceName, f.Namespace.Name, framework.TestContext.ClusterDNSDomain)
|
||||||
hostNames := []string{hostFQDN, podHostname}
|
hostNames := []string{hostFQDN, podHostname}
|
||||||
// TODO: Validate both IPv4 and IPv6 families for dual-stack
|
// TODO: Validate both IPv4 and IPv6 families for dual-stack
|
||||||
wheezyProbeCmd, wheezyFileNames := createProbeCommand(nil, hostNames, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.ClusterIsIPv6())
|
wheezyProbeCmd, wheezyFileNames := createProbeCommand(nil, hostNames, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6())
|
||||||
jessieProbeCmd, jessieFileNames := createProbeCommand(nil, hostNames, "", "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.ClusterIsIPv6())
|
jessieProbeCmd, jessieFileNames := createProbeCommand(nil, hostNames, "", "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 wheezy: " + wheezyProbeCmd + "\n")
|
||||||
ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n")
|
ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n")
|
||||||
|
|
||||||
@ -301,8 +301,8 @@ var _ = SIGDescribe("DNS", func() {
|
|||||||
subdomain := fmt.Sprintf("%s.%s.svc.%s", serviceName, f.Namespace.Name, framework.TestContext.ClusterDNSDomain)
|
subdomain := fmt.Sprintf("%s.%s.svc.%s", serviceName, f.Namespace.Name, framework.TestContext.ClusterDNSDomain)
|
||||||
namesToResolve := []string{hostFQDN, subdomain}
|
namesToResolve := []string{hostFQDN, subdomain}
|
||||||
// TODO: Validate both IPv4 and IPv6 families for dual-stack
|
// TODO: Validate both IPv4 and IPv6 families for dual-stack
|
||||||
wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, nil, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.ClusterIsIPv6())
|
wheezyProbeCmd, wheezyFileNames := createProbeCommand(namesToResolve, nil, "", "wheezy", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.TestContext.ClusterIsIPv6())
|
||||||
jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, nil, "", "jessie", f.Namespace.Name, framework.TestContext.ClusterDNSDomain, framework.ClusterIsIPv6())
|
jessieProbeCmd, jessieFileNames := createProbeCommand(namesToResolve, nil, "", "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 wheezy: " + wheezyProbeCmd + "\n")
|
||||||
ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n")
|
ginkgo.By("Running these commands on jessie: " + jessieProbeCmd + "\n")
|
||||||
|
|
||||||
@ -374,7 +374,7 @@ var _ = SIGDescribe("DNS", func() {
|
|||||||
})
|
})
|
||||||
framework.ExpectNoError(err, "failed to change service type to ClusterIP for service: %s", serviceName)
|
framework.ExpectNoError(err, "failed to change service type to ClusterIP for service: %s", serviceName)
|
||||||
targetRecord := "A"
|
targetRecord := "A"
|
||||||
if framework.ClusterIsIPv6() {
|
if framework.TestContext.ClusterIsIPv6() {
|
||||||
targetRecord = "AAAA"
|
targetRecord = "AAAA"
|
||||||
}
|
}
|
||||||
// TODO: For dual stack we can run from here two createTargetedProbeCommand()
|
// TODO: For dual stack we can run from here two createTargetedProbeCommand()
|
||||||
|
Loading…
Reference in New Issue
Block a user