Merge pull request #70681 from justinsb/block_master_all_ips
e2e: block all master addresses
This commit is contained in:
@@ -4960,19 +4960,28 @@ func getMaster(c clientset.Interface) Address {
|
||||
return master
|
||||
}
|
||||
|
||||
// GetMasterAddress returns the hostname/external IP/internal IP as appropriate for e2e tests on a particular provider
|
||||
// which is the address of the interface used for communication with the kubelet.
|
||||
func GetMasterAddress(c clientset.Interface) string {
|
||||
// GetAllMasterAddresses returns all IP addresses on which the kubelet can reach the master.
|
||||
// It may return internal and external IPs, even if we expect for
|
||||
// e.g. internal IPs to be used (issue #56787), so that we can be
|
||||
// sure to block the master fully during tests.
|
||||
func GetAllMasterAddresses(c clientset.Interface) []string {
|
||||
master := getMaster(c)
|
||||
|
||||
ips := sets.NewString()
|
||||
switch TestContext.Provider {
|
||||
case "gce", "gke":
|
||||
return master.externalIP
|
||||
if master.externalIP != "" {
|
||||
ips.Insert(master.externalIP)
|
||||
}
|
||||
if master.internalIP != "" {
|
||||
ips.Insert(master.internalIP)
|
||||
}
|
||||
case "aws":
|
||||
return awsMasterIP
|
||||
ips.Insert(awsMasterIP)
|
||||
default:
|
||||
Failf("This test is not supported for provider %s and should be disabled", TestContext.Provider)
|
||||
}
|
||||
return ""
|
||||
return ips.List()
|
||||
}
|
||||
|
||||
// GetNodeExternalIP returns node external IP concatenated with port 22 for ssh
|
||||
|
Reference in New Issue
Block a user