mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Fix upgrade tests for GKE Regional Clusters
This commit is contained in:
parent
a0844c17bf
commit
875c1a7053
@ -119,17 +119,35 @@ func masterUpgradeGCE(rawV string, enableKubeProxyDaemonSet bool) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func locationParamGKE() string {
|
||||||
|
if TestContext.CloudConfig.Zone != "" {
|
||||||
|
return fmt.Sprintf("--zone=%s", TestContext.CloudConfig.Zone)
|
||||||
|
}
|
||||||
|
return fmt.Sprintf("--region=%s", TestContext.CloudConfig.Region)
|
||||||
|
}
|
||||||
|
|
||||||
|
func appendContainerCommandGroupIfNeeded(args []string) []string {
|
||||||
|
if TestContext.CloudConfig.Region != "" {
|
||||||
|
// TODO(wojtek-t): Get rid of it once Regional Clusters go to GA.
|
||||||
|
return append([]string{"beta"}, args...)
|
||||||
|
}
|
||||||
|
return args
|
||||||
|
}
|
||||||
|
|
||||||
func masterUpgradeGKE(v string) error {
|
func masterUpgradeGKE(v string) error {
|
||||||
Logf("Upgrading master to %q", v)
|
Logf("Upgrading master to %q", v)
|
||||||
_, _, err := RunCmd("gcloud", "container",
|
args := []string{
|
||||||
|
"container",
|
||||||
"clusters",
|
"clusters",
|
||||||
fmt.Sprintf("--project=%s", TestContext.CloudConfig.ProjectID),
|
fmt.Sprintf("--project=%s", TestContext.CloudConfig.ProjectID),
|
||||||
fmt.Sprintf("--zone=%s", TestContext.CloudConfig.Zone),
|
locationParamGKE(),
|
||||||
"upgrade",
|
"upgrade",
|
||||||
TestContext.CloudConfig.Cluster,
|
TestContext.CloudConfig.Cluster,
|
||||||
"--master",
|
"--master",
|
||||||
fmt.Sprintf("--cluster-version=%s", v),
|
fmt.Sprintf("--cluster-version=%s", v),
|
||||||
"--quiet")
|
"--quiet",
|
||||||
|
}
|
||||||
|
_, _, err := RunCmd("gcloud", appendContainerCommandGroupIfNeeded(args)...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -235,7 +253,7 @@ func nodeUpgradeGKE(v string, img string) error {
|
|||||||
"container",
|
"container",
|
||||||
"clusters",
|
"clusters",
|
||||||
fmt.Sprintf("--project=%s", TestContext.CloudConfig.ProjectID),
|
fmt.Sprintf("--project=%s", TestContext.CloudConfig.ProjectID),
|
||||||
fmt.Sprintf("--zone=%s", TestContext.CloudConfig.Zone),
|
locationParamGKE(),
|
||||||
"upgrade",
|
"upgrade",
|
||||||
TestContext.CloudConfig.Cluster,
|
TestContext.CloudConfig.Cluster,
|
||||||
fmt.Sprintf("--cluster-version=%s", v),
|
fmt.Sprintf("--cluster-version=%s", v),
|
||||||
@ -244,7 +262,7 @@ func nodeUpgradeGKE(v string, img string) error {
|
|||||||
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", args...)
|
_, _, err := RunCmd("gcloud", appendContainerCommandGroupIfNeeded(args)...)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user