mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-27 04:21:18 +00:00
Clarify IP family meaning
This commit is contained in:
parent
54f81c3bb8
commit
bd15f3f9f7
@ -144,13 +144,17 @@ var _ = ginkgo.SynchronizedBeforeSuite(func() []byte {
|
|||||||
e2elog.Logf("kube-apiserver version: %s", serverVersion.GitVersion)
|
e2elog.Logf("kube-apiserver version: %s", serverVersion.GitVersion)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Obtain the (primary if dual stack) ip family of the cluster
|
// Obtain the default IP family of the cluster
|
||||||
framework.TestContext.IPFamily = getClusterIPFamily(c)
|
// 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)
|
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.
|
// Reference common test to make the import valid.
|
||||||
commontest.CurrentSuite = commontest.E2E
|
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
|
// getDefaultClusterIPFamily obtains the default IP family of the cluster
|
||||||
// on the Cluster IP address of the default kubernetes service
|
// using the Cluster IP address of the kubernetes service created in the default namespace
|
||||||
func getClusterIPFamily(c clientset.Interface) string {
|
// 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
|
// Get the ClusterIP of the kubernetes service created in the default namespace
|
||||||
svc, err := c.CoreV1().Services(metav1.NamespaceDefault).Get("kubernetes", metav1.GetOptions{})
|
svc, err := c.CoreV1().Services(metav1.NamespaceDefault).Get("kubernetes", metav1.GetOptions{})
|
||||||
if err != nil {
|
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) {
|
if utilnet.IsIPv6String(svc.Spec.ClusterIP) {
|
||||||
|
@ -165,7 +165,7 @@ type TestContextType struct {
|
|||||||
// The configuration of NodeKiller.
|
// The configuration of NodeKiller.
|
||||||
NodeKiller NodeKillerConfig
|
NodeKiller NodeKillerConfig
|
||||||
|
|
||||||
// The IP Family of the cluster
|
// The Default IP Family of the cluster ("ipv4" or "ipv6")
|
||||||
IPFamily string
|
IPFamily string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user