Clarify IP family meaning

This commit is contained in:
Antonio Ojea 2019-07-25 13:54:37 +02:00
parent 54f81c3bb8
commit bd15f3f9f7
No known key found for this signature in database
GPG Key ID: E4833AA228D4E824
2 changed files with 15 additions and 10 deletions

View File

@ -144,13 +144,17 @@ var _ = ginkgo.SynchronizedBeforeSuite(func() []byte {
e2elog.Logf("kube-apiserver version: %s", serverVersion.GitVersion)
}
// Obtain the (primary if dual stack) ip family of the cluster
framework.TestContext.IPFamily = getClusterIPFamily(c)
// Obtain the default IP family of the cluster
// Some e2e test are designed to work on IPv4 only, this global variable
// allows to adapt those tests to work on both IPv4 and IPv6
// TODO(dual-stack): dual stack clusters should pass full e2e testing at least with the primary IP family
// the dual stack clusters can be ipv4-ipv6 or ipv6-ipv4, order matters,
// and services use the primary IP family by default
// If we´ll need to provide additional context for dual-stack, we can detect it
// because pods have two addresses (one per family)
framework.TestContext.IPFamily = getDefaultClusterIPFamily(c)
e2elog.Logf("Cluster IP family: %s", framework.TestContext.IPFamily)
// TODO(dual-stack): dual-stack clusters use two pods addresses (one per family)
// the cluster can be ipv4-ipv6 or ipv6-ipv4, order matters
// Reference common test to make the import valid.
commontest.CurrentSuite = commontest.E2E
@ -285,13 +289,14 @@ func runKubernetesServiceTestContainer(c clientset.Interface, ns string) {
}
}
// getClusterIPFamily obtains the (primary) ip family of the cluster based
// on the Cluster IP address of the default kubernetes service
func getClusterIPFamily(c clientset.Interface) string {
// getDefaultClusterIPFamily obtains the default IP family of the cluster
// using the Cluster IP address of the kubernetes service created in the default namespace
// This unequivocally identifies the default IP family because services are single family
func getDefaultClusterIPFamily(c clientset.Interface) string {
// Get the ClusterIP of the kubernetes service created in the default namespace
svc, err := c.CoreV1().Services(metav1.NamespaceDefault).Get("kubernetes", metav1.GetOptions{})
if err != nil {
e2elog.Failf("Failed to get kubernetes endpoints: %v", err)
e2elog.Failf("Failed to get kubernetes service ClusterIP: %v", err)
}
if utilnet.IsIPv6String(svc.Spec.ClusterIP) {

View File

@ -165,7 +165,7 @@ type TestContextType struct {
// The configuration of NodeKiller.
NodeKiller NodeKillerConfig
// The IP Family of the cluster
// The Default IP Family of the cluster ("ipv4" or "ipv6")
IPFamily string
}