mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #84174 from Random-Liu/upgrade-all-node-pools
Upgrade all node pools for gke upgrade test.
This commit is contained in:
commit
ca0e694d63
@ -230,6 +230,12 @@ func nodeUpgradeGCE(rawV, img string, enableKubeProxyDaemonSet bool) error {
|
|||||||
|
|
||||||
func nodeUpgradeGKE(v string, img string) error {
|
func nodeUpgradeGKE(v string, img string) error {
|
||||||
Logf("Upgrading nodes to version %q and image %q", v, img)
|
Logf("Upgrading nodes to version %q and image %q", v, img)
|
||||||
|
nps, err := nodePoolsGKE()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
Logf("Found node pools %v", nps)
|
||||||
|
for _, np := range nps {
|
||||||
args := []string{
|
args := []string{
|
||||||
"container",
|
"container",
|
||||||
"clusters",
|
"clusters",
|
||||||
@ -237,23 +243,44 @@ func nodeUpgradeGKE(v string, img string) error {
|
|||||||
locationParamGKE(),
|
locationParamGKE(),
|
||||||
"upgrade",
|
"upgrade",
|
||||||
TestContext.CloudConfig.Cluster,
|
TestContext.CloudConfig.Cluster,
|
||||||
|
fmt.Sprintf("--node-pool=%s", np),
|
||||||
fmt.Sprintf("--cluster-version=%s", v),
|
fmt.Sprintf("--cluster-version=%s", v),
|
||||||
"--quiet",
|
"--quiet",
|
||||||
}
|
}
|
||||||
if len(img) > 0 {
|
if len(img) > 0 {
|
||||||
args = append(args, fmt.Sprintf("--image-type=%s", img))
|
args = append(args, fmt.Sprintf("--image-type=%s", img))
|
||||||
}
|
}
|
||||||
_, _, err := RunCmd("gcloud", appendContainerCommandGroupIfNeeded(args)...)
|
_, _, err = RunCmd("gcloud", appendContainerCommandGroupIfNeeded(args)...)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
waitForSSHTunnels()
|
waitForSSHTunnels()
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func nodePoolsGKE() ([]string, error) {
|
||||||
|
args := []string{
|
||||||
|
"container",
|
||||||
|
"node-pools",
|
||||||
|
fmt.Sprintf("--project=%s", TestContext.CloudConfig.ProjectID),
|
||||||
|
locationParamGKE(),
|
||||||
|
"list",
|
||||||
|
fmt.Sprintf("--cluster=%s", TestContext.CloudConfig.Cluster),
|
||||||
|
`--format="get(name)"`,
|
||||||
|
}
|
||||||
|
stdout, _, err := RunCmd("gcloud", appendContainerCommandGroupIfNeeded(args)...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if len(strings.TrimSpace(stdout)) == 0 {
|
||||||
|
return []string{}, nil
|
||||||
|
}
|
||||||
|
return strings.Fields(stdout), nil
|
||||||
|
}
|
||||||
|
|
||||||
// MigTemplate (GCE-only) returns the name of the MIG template that the
|
// MigTemplate (GCE-only) returns the name of the MIG template that the
|
||||||
// nodes of the cluster use.
|
// nodes of the cluster use.
|
||||||
func MigTemplate() (string, error) {
|
func MigTemplate() (string, error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user