Fallback to internal addrs in e2e tests when no external addrs available
This change modifies the way that config.NodeIP is selected at the start of e2e Networking tests such that if no external addresses are available from the cloud provider (e.g. either no cloud provider being used [baremetal or VMs], or the provider doesn't have external IPs configured), then one of the internal addresses is used. Without this change, the e2e service-related Networking tests would always panic when config.ExternalAddrs[0] is accessed and the slice is empty. This change eliminates the panic, and in some setups, the fallback choice of using an internal address will provide the necessary connectivity for the e2e Networking tests to access each node. fixes #53568
This commit is contained in:
@@ -511,7 +511,12 @@ func (config *NetworkingTestConfig) setup(selector map[string]string) {
|
||||
}
|
||||
}
|
||||
config.ClusterIP = config.NodePortService.Spec.ClusterIP
|
||||
config.NodeIP = config.ExternalAddrs[0]
|
||||
if len(config.ExternalAddrs) != 0 {
|
||||
config.NodeIP = config.ExternalAddrs[0]
|
||||
} else {
|
||||
internalAddrs := NodeAddresses(nodeList, v1.NodeInternalIP)
|
||||
config.NodeIP = internalAddrs[0]
|
||||
}
|
||||
}
|
||||
|
||||
func (config *NetworkingTestConfig) cleanup() {
|
||||
|
Reference in New Issue
Block a user