mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 11:21:47 +00:00
e2e dualstack test fixes
remove unused variables and fix comments
This commit is contained in:
parent
ed694a1bf6
commit
ad043f2bdd
@ -181,10 +181,6 @@ type NetworkingTestConfig struct {
|
|||||||
// SessionAffinityService is a Service with SessionAffinity=ClientIP
|
// SessionAffinityService is a Service with SessionAffinity=ClientIP
|
||||||
// spanning over all endpointPods.
|
// spanning over all endpointPods.
|
||||||
SessionAffinityService *v1.Service
|
SessionAffinityService *v1.Service
|
||||||
// ExternalAddr is a external IP of a node in the cluster.
|
|
||||||
ExternalAddr string
|
|
||||||
// SecondaryExternalAddr is a external IP of the secondary IP family of a node in the cluster.
|
|
||||||
SecondaryExternalAddr string
|
|
||||||
// Nodes is a list of nodes in the cluster.
|
// Nodes is a list of nodes in the cluster.
|
||||||
Nodes []v1.Node
|
Nodes []v1.Node
|
||||||
// MaxTries is the number of retries tolerated for tests run against
|
// MaxTries is the number of retries tolerated for tests run against
|
||||||
@ -194,9 +190,11 @@ type NetworkingTestConfig struct {
|
|||||||
ClusterIP string
|
ClusterIP string
|
||||||
// The SecondaryClusterIP of the Service created by this test config.
|
// The SecondaryClusterIP of the Service created by this test config.
|
||||||
SecondaryClusterIP string
|
SecondaryClusterIP string
|
||||||
// External ip of first node for use in nodePort testing.
|
// NodeIP it's an ExternalIP if the node has one,
|
||||||
|
// or an InternalIP if not, for use in nodePort testing.
|
||||||
NodeIP string
|
NodeIP string
|
||||||
// External ip of other IP family of first node for use in nodePort testing.
|
// SecondaryNodeIP it's an ExternalIP of the secondary IP family if the node has one,
|
||||||
|
// or an InternalIP if not, for usein nodePort testing.
|
||||||
SecondaryNodeIP string
|
SecondaryNodeIP string
|
||||||
// The http/udp/sctp nodePorts of the Service.
|
// The http/udp/sctp nodePorts of the Service.
|
||||||
NodeHTTPPort int
|
NodeHTTPPort int
|
||||||
@ -779,6 +777,8 @@ func (config *NetworkingTestConfig) setup(selector map[string]string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Obtain the primary IP family of the Cluster based on the first ClusterIP
|
// Obtain the primary IP family of the Cluster based on the first ClusterIP
|
||||||
|
// TODO: Eventually we should just be getting these from Spec.IPFamilies
|
||||||
|
// but for now that would only if the feature gate is enabled.
|
||||||
family := v1.IPv4Protocol
|
family := v1.IPv4Protocol
|
||||||
secondaryFamily := v1.IPv6Protocol
|
secondaryFamily := v1.IPv6Protocol
|
||||||
if netutils.IsIPv6String(config.ClusterIP) {
|
if netutils.IsIPv6String(config.ClusterIP) {
|
||||||
@ -786,17 +786,13 @@ func (config *NetworkingTestConfig) setup(selector map[string]string) {
|
|||||||
secondaryFamily = v1.IPv4Protocol
|
secondaryFamily = v1.IPv4Protocol
|
||||||
}
|
}
|
||||||
// Get Node IPs from the cluster, ExternalIPs take precedence
|
// Get Node IPs from the cluster, ExternalIPs take precedence
|
||||||
config.ExternalAddr = e2enode.FirstAddressByTypeAndFamily(nodeList, v1.NodeExternalIP, family)
|
config.NodeIP = e2enode.FirstAddressByTypeAndFamily(nodeList, v1.NodeExternalIP, family)
|
||||||
if config.ExternalAddr != "" {
|
if config.NodeIP == "" {
|
||||||
config.NodeIP = config.ExternalAddr
|
|
||||||
} else {
|
|
||||||
config.NodeIP = e2enode.FirstAddressByTypeAndFamily(nodeList, v1.NodeInternalIP, family)
|
config.NodeIP = e2enode.FirstAddressByTypeAndFamily(nodeList, v1.NodeInternalIP, family)
|
||||||
}
|
}
|
||||||
if config.DualStackEnabled {
|
if config.DualStackEnabled {
|
||||||
config.SecondaryExternalAddr = e2enode.FirstAddressByTypeAndFamily(nodeList, v1.NodeExternalIP, secondaryFamily)
|
config.SecondaryNodeIP = e2enode.FirstAddressByTypeAndFamily(nodeList, v1.NodeExternalIP, secondaryFamily)
|
||||||
if config.SecondaryExternalAddr != "" {
|
if config.SecondaryNodeIP == "" {
|
||||||
config.SecondaryNodeIP = config.SecondaryExternalAddr
|
|
||||||
} else {
|
|
||||||
config.SecondaryNodeIP = e2enode.FirstAddressByTypeAndFamily(nodeList, v1.NodeInternalIP, secondaryFamily)
|
config.SecondaryNodeIP = e2enode.FirstAddressByTypeAndFamily(nodeList, v1.NodeInternalIP, secondaryFamily)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,8 +24,6 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
netutil "k8s.io/utils/net"
|
|
||||||
|
|
||||||
"github.com/onsi/ginkgo"
|
"github.com/onsi/ginkgo"
|
||||||
"github.com/onsi/gomega"
|
"github.com/onsi/gomega"
|
||||||
|
|
||||||
@ -43,6 +41,7 @@ import (
|
|||||||
clientset "k8s.io/client-go/kubernetes"
|
clientset "k8s.io/client-go/kubernetes"
|
||||||
clientretry "k8s.io/client-go/util/retry"
|
clientretry "k8s.io/client-go/util/retry"
|
||||||
e2elog "k8s.io/kubernetes/test/e2e/framework/log"
|
e2elog "k8s.io/kubernetes/test/e2e/framework/log"
|
||||||
|
netutil "k8s.io/utils/net"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -250,7 +249,7 @@ func GetInternalIP(node *v1.Node) (string, error) {
|
|||||||
return host, nil
|
return host, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// FirstAddressByTypeAndFamily returns the first address of the given type and family of each node.
|
// FirstAddressByTypeAndFamily returns the first address that matches the given type and family of the list of nodes
|
||||||
func FirstAddressByTypeAndFamily(nodelist *v1.NodeList, addrType v1.NodeAddressType, family v1.IPFamily) string {
|
func FirstAddressByTypeAndFamily(nodelist *v1.NodeList, addrType v1.NodeAddressType, family v1.IPFamily) string {
|
||||||
for _, n := range nodelist.Items {
|
for _, n := range nodelist.Items {
|
||||||
addresses := GetAddressesByTypeAndFamily(&n, addrType, family)
|
addresses := GetAddressesByTypeAndFamily(&n, addrType, family)
|
||||||
|
@ -460,8 +460,7 @@ var _ = SIGDescribe("[Feature:IPv6DualStackAlphaFeature] [LinuxOnly]", func() {
|
|||||||
config.DialFromTestContainer("udp", config.SecondaryNodeIP, config.NodeUDPPort, config.MaxTries, 0, config.EndpointHostnames())
|
config.DialFromTestContainer("udp", config.SecondaryNodeIP, config.NodeUDPPort, config.MaxTries, 0, config.EndpointHostnames())
|
||||||
})
|
})
|
||||||
|
|
||||||
// Once basic tests checking for the sctp module not to be loaded are implemented, this
|
// [Disruptive] because it conflicts with tests that call CheckSCTPModuleLoadedOnNodes
|
||||||
// needs to be marked as [Disruptive]
|
|
||||||
ginkgo.It("should function for pod-Service: sctp [Feature:SCTPConnectivity][Disruptive]", func() {
|
ginkgo.It("should function for pod-Service: sctp [Feature:SCTPConnectivity][Disruptive]", func() {
|
||||||
config := e2enetwork.NewNetworkingTestConfig(f, e2enetwork.EnableDualStack, e2enetwork.EnableSCTP)
|
config := e2enetwork.NewNetworkingTestConfig(f, e2enetwork.EnableDualStack, e2enetwork.EnableSCTP)
|
||||||
ginkgo.By(fmt.Sprintf("dialing(sctp) %v --> %v:%v (config.clusterIP)", config.TestContainerPod.Name, config.SecondaryClusterIP, e2enetwork.ClusterSCTPPort))
|
ginkgo.By(fmt.Sprintf("dialing(sctp) %v --> %v:%v (config.clusterIP)", config.TestContainerPod.Name, config.SecondaryClusterIP, e2enetwork.ClusterSCTPPort))
|
||||||
|
Loading…
Reference in New Issue
Block a user