mirror of https://github.com/k3s-io/k3s
Merge pull request #56789 from kubernetes/revert-56718-fix-network-partition-test-gce-2
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Revert "Fix for the network partition tests" Reverts kubernetes/kubernetes#56718pull/6/head
commit
9182422b15
|
@ -935,9 +935,7 @@ func TestHitNodesFromOutsideWithCount(externalIP string, httpPort int32, timeout
|
|||
// This function executes commands on a node so it will work only for some
|
||||
// environments.
|
||||
func TestUnderTemporaryNetworkFailure(c clientset.Interface, ns string, node *v1.Node, testFunc func()) {
|
||||
externalIP := GetNodeExternalIP(node)
|
||||
internalIP := GetNodeInternalIP(node)
|
||||
|
||||
host := GetNodeExternalIP(node)
|
||||
master := GetMasterAddress(c)
|
||||
By(fmt.Sprintf("block network traffic from node %s to the master", node.Name))
|
||||
defer func() {
|
||||
|
@ -946,16 +944,14 @@ func TestUnderTemporaryNetworkFailure(c clientset.Interface, ns string, node *v1
|
|||
// had been inserted. (yes, we could look at the error code and ssh error
|
||||
// separately, but I prefer to stay on the safe side).
|
||||
By(fmt.Sprintf("Unblock network traffic from node %s to the master", node.Name))
|
||||
UnblockNetwork(externalIP, master)
|
||||
UnblockNetwork(internalIP, master)
|
||||
UnblockNetwork(host, master)
|
||||
}()
|
||||
|
||||
Logf("Waiting %v to ensure node %s is ready before beginning test...", resizeNodeReadyTimeout, node.Name)
|
||||
if !WaitForNodeToBe(c, node.Name, v1.NodeReady, true, resizeNodeReadyTimeout) {
|
||||
Failf("Node %s did not become ready within %v", node.Name, resizeNodeReadyTimeout)
|
||||
}
|
||||
BlockNetwork(externalIP, master)
|
||||
BlockNetwork(internalIP, master)
|
||||
BlockNetwork(host, master)
|
||||
|
||||
Logf("Waiting %v for node %s to be not ready after simulated network failure", resizeNodeNotReadyTimeout, node.Name)
|
||||
if !WaitForNodeToBe(c, node.Name, v1.NodeReady, false, resizeNodeNotReadyTimeout) {
|
||||
|
|
|
@ -4925,23 +4925,6 @@ func GetNodeExternalIP(node *v1.Node) string {
|
|||
return host
|
||||
}
|
||||
|
||||
// GetNodeInternalIP returns node internal IP concatenated with port 22 for ssh
|
||||
// e.g. 1.2.3.4:22
|
||||
func GetNodeInternalIP(node *v1.Node) string {
|
||||
Logf("Getting internal IP address for %s", node.Name)
|
||||
host := ""
|
||||
for _, a := range node.Status.Addresses {
|
||||
if a.Type == v1.NodeInternalIP {
|
||||
host = net.JoinHostPort(a.Address, sshPort)
|
||||
break
|
||||
}
|
||||
}
|
||||
if host == "" {
|
||||
Failf("Couldn't get the internal IP of host %s with addresses %v", node.Name, node.Status.Addresses)
|
||||
}
|
||||
return host
|
||||
}
|
||||
|
||||
// SimpleGET executes a get on the given url, returns error if non-200 returned.
|
||||
func SimpleGET(c *http.Client, url, host string) (string, error) {
|
||||
req, err := http.NewRequest("GET", url, nil)
|
||||
|
|
Loading…
Reference in New Issue