forked from kubernetes/kubernetes
-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UPSTREAM: <carry>: adapt to the new flag 'structure'
- Loading branch information
Showing
3 changed files
with
87 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package gcp | ||
|
||
func GetUpgradeTarget() string { | ||
return *upgradeTarget | ||
} | ||
|
||
func SetUpgradeTarget(val string) { | ||
upgradeTarget = &val | ||
} | ||
|
||
func GetUpgradeImage() string { | ||
return *upgradeImage | ||
} | ||
|
||
func SetUpgradeImage(val string) { | ||
upgradeImage = &val | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package e2e | ||
|
||
import ( | ||
"flag" | ||
"fmt" | ||
"os" | ||
|
||
"k8s.io/kubernetes/test/e2e/framework/config" | ||
|
||
"k8s.io/kubernetes/test/e2e/framework" | ||
"k8s.io/kubernetes/test/e2e/framework/testfiles" | ||
"k8s.io/kubernetes/test/e2e/generated" | ||
"k8s.io/kubernetes/test/utils/image" | ||
) | ||
|
||
func HandleFlags() { | ||
config.CopyFlags(config.Flags, flag.CommandLine) | ||
framework.RegisterCommonFlags(flag.CommandLine) | ||
framework.RegisterClusterFlags(flag.CommandLine) | ||
flag.Parse() | ||
} | ||
|
||
// this function matches the init block from e2e_test.go | ||
func ViperizeFlags(viperConfig string) { | ||
HandleFlags() | ||
|
||
// Register framework flags, then handle flags and Viper config. | ||
if err := viperizeFlags(viperConfig, "e2e", flag.CommandLine); err != nil { | ||
fmt.Fprintln(os.Stderr, err) | ||
os.Exit(1) | ||
} | ||
|
||
if framework.TestContext.ListImages { | ||
for _, v := range image.GetImageConfigs() { | ||
fmt.Println(v.GetE2EImage()) | ||
} | ||
os.Exit(0) | ||
} | ||
|
||
framework.AfterReadingAllFlags(&framework.TestContext) | ||
|
||
// this came from the init block, but it breaks on openshift. Not really sure why. | ||
// TODO: Deprecating repo-root over time... instead just use gobindata_util.go , see #23987. | ||
// Right now it is still needed, for example by | ||
// test/e2e/framework/ingress/ingress_utils.go | ||
// for providing the optional secret.yaml file and by | ||
// test/e2e/framework/util.go for cluster/log-dump. | ||
//if framework.TestContext.RepoRoot != "" { | ||
// testfiles.AddFileSource(testfiles.RootFileSource{Root: framework.TestContext.RepoRoot}) | ||
//} | ||
|
||
// Enable bindata file lookup as fallback. | ||
testfiles.AddFileSource(testfiles.BindataFileSource{ | ||
Asset: generated.Asset, | ||
AssetNames: generated.AssetNames, | ||
}) | ||
|
||
} | ||
|
||
var localViperConfig = "" | ||
|
||
// we appear to set ours via env-var, not flag | ||
func GetViperConfig() string { | ||
return localViperConfig | ||
} | ||
|
||
func SetViperConfig(val string) { | ||
localViperConfig = val | ||
} |