Merge pull request #43820 from krousey/upgrades
Automatic merge from submit-queue (batch tested with PRs 42617, 43247, 43509, 43644, 43820) Adding a SSH tunnel check to GKE upgrades **What this PR does / why we need it**: After an upgrade, it takes some time fore the master to re-establish SSH tunnels to the nodes. This adds a wait for GKE since it runs in this configuration. **Which issue this PR fixes**: fixes #43611, #43612
This commit is contained in:
		@@ -87,9 +87,15 @@ func masterUpgradeGKE(v string) error {
 | 
				
			|||||||
		"--master",
 | 
							"--master",
 | 
				
			||||||
		fmt.Sprintf("--cluster-version=%s", v),
 | 
							fmt.Sprintf("--cluster-version=%s", v),
 | 
				
			||||||
		"--quiet")
 | 
							"--quiet")
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
		return err
 | 
							return err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						waitForSSHTunnels()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return nil
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func NodeUpgrade(f *Framework, v string, img string) error {
 | 
					func NodeUpgrade(f *Framework, v string, img string) error {
 | 
				
			||||||
	// Perform the upgrade.
 | 
						// Perform the upgrade.
 | 
				
			||||||
	var err error
 | 
						var err error
 | 
				
			||||||
@@ -166,9 +172,16 @@ func nodeUpgradeGKE(v string, img string) error {
 | 
				
			|||||||
		args = append(args, fmt.Sprintf("--image-type=%s", img))
 | 
							args = append(args, fmt.Sprintf("--image-type=%s", img))
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	_, _, err := RunCmd("gcloud", args...)
 | 
						_, _, err := RunCmd("gcloud", args...)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
		return err
 | 
							return err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						waitForSSHTunnels()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						return nil
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// CheckNodesReady waits up to nt for expect nodes accessed by c to be ready,
 | 
					// CheckNodesReady waits up to nt for expect nodes accessed by c to be ready,
 | 
				
			||||||
// returning an error if this doesn't happen in time. It returns the names of
 | 
					// returning an error if this doesn't happen in time. It returns the names of
 | 
				
			||||||
// nodes it finds.
 | 
					// nodes it finds.
 | 
				
			||||||
@@ -270,3 +283,19 @@ func gceUpgradeScript() string {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	return TestContext.GCEUpgradeScript
 | 
						return TestContext.GCEUpgradeScript
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func waitForSSHTunnels() {
 | 
				
			||||||
 | 
						Logf("Waiting for SSH tunnels to establish")
 | 
				
			||||||
 | 
						RunKubectl("run", "ssh-tunnel-test",
 | 
				
			||||||
 | 
							"--image=gcr.io/google_containers/busybox:1.24",
 | 
				
			||||||
 | 
							"--restart=Never",
 | 
				
			||||||
 | 
							"--command", "--",
 | 
				
			||||||
 | 
							"echo", "Hello")
 | 
				
			||||||
 | 
						defer RunKubectl("delete", "pod", "ssh-tunnel-test")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// allow up to a minute for new ssh tunnels to establish
 | 
				
			||||||
 | 
						wait.PollImmediate(5*time.Second, time.Minute, func() (bool, error) {
 | 
				
			||||||
 | 
							_, err := RunKubectl("logs", "ssh-tunnel-test")
 | 
				
			||||||
 | 
							return err == nil, nil
 | 
				
			||||||
 | 
						})
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user