...
1
16
17 package providers
18
19 import (
20 "context"
21 "fmt"
22 "path"
23
24 "k8s.io/kubernetes/test/e2e/framework"
25 e2enode "k8s.io/kubernetes/test/e2e/framework/node"
26 )
27
28
29 func LocationParamGKE() string {
30 if framework.TestContext.CloudConfig.MultiMaster {
31
32 return fmt.Sprintf("--region=%s", framework.TestContext.CloudConfig.Region)
33 }
34 return fmt.Sprintf("--zone=%s", framework.TestContext.CloudConfig.Zone)
35 }
36
37
38 func MasterUpgradeGKE(ctx context.Context, namespace string, v string) error {
39 framework.Logf("Upgrading master to %q", v)
40 args := []string{
41 "container",
42 "clusters",
43 fmt.Sprintf("--project=%s", framework.TestContext.CloudConfig.ProjectID),
44 LocationParamGKE(),
45 "upgrade",
46 framework.TestContext.CloudConfig.Cluster,
47 "--master",
48 fmt.Sprintf("--cluster-version=%s", v),
49 "--quiet",
50 }
51 _, _, err := framework.RunCmd("gcloud", framework.AppendContainerCommandGroupIfNeeded(args)...)
52 if err != nil {
53 return err
54 }
55
56 e2enode.WaitForSSHTunnels(ctx, namespace)
57
58 return nil
59 }
60
61
62 func GCEUpgradeScript() string {
63 if len(framework.TestContext.GCEUpgradeScript) == 0 {
64 return path.Join(framework.TestContext.RepoRoot, "cluster/gce/upgrade.sh")
65 }
66 return framework.TestContext.GCEUpgradeScript
67 }
68
View as plain text