// podStartupTimeout is the time to allow all pods in the cluster to become
// running and ready before any e2e tests run. It includes pulling all of
// the pods (as of 5/18/15 this is 8 pods).
podStartupTimeout=10*time.Minute
)
var(
cloudConfig=&testContext.CloudConfig
)
funcRegisterFlags(){
// Turn on verbose by default to get spec names
config.DefaultReporterConfig.Verbose=true
// Turn on EmitSpecProgress to get spec progress (especially on interrupt)
config.GinkgoConfig.EmitSpecProgress=true
// Randomize specs as well as suites
config.GinkgoConfig.RandomizeAllSpecs=true
flag.StringVar(&testContext.KubeConfig,clientcmd.RecommendedConfigPathFlag,"","Path to kubeconfig containing embedded authinfo.")
flag.StringVar(&testContext.KubeContext,clientcmd.FlagContext,"","kubeconfig context to use/override. If unset, will use value from 'current-context'")
flag.StringVar(&testContext.CertDir,"cert-dir","","Path to the directory containing the certs. Default is empty, which doesn't use certs.")
flag.StringVar(&testContext.Host,"host","","The host, or apiserver, to connect to")
flag.StringVar(&testContext.RepoRoot,"repo-root","../../","Root directory of kubernetes repository, for finding test files.")
flag.StringVar(&testContext.Provider,"provider","","The name of the Kubernetes provider (gce, gke, local, vagrant, etc.)")
flag.StringVar(&testContext.KubectlPath,"kubectl-path","kubectl","The kubectl binary to use. For development, you might use 'cluster/kubectl.sh' here.")
flag.StringVar(&testContext.OutputDir,"e2e-output-dir","/tmp","Output directory for interesting/useful test data, like performance data, benchmarks, and other metrics.")
flag.StringVar(&testContext.ReportDir,"report-dir","","Path to the directory where the JUnit XML reports should be saved. Default is empty, which doesn't generate these reports.")
flag.StringVar(&testContext.prefix,"prefix","e2e","A prefix to be added to cloud resources created during testing.")
// TODO: Flags per provider? Rename gce-project/gce-zone?
flag.StringVar(&cloudConfig.MasterName,"kube-master","","Name of the kubernetes master. Only required if provider is gce or gke")
flag.StringVar(&cloudConfig.ProjectID,"gce-project","","The GCE project being used, if applicable")
flag.StringVar(&cloudConfig.Zone,"gce-zone","","GCE zone being used, if applicable")
flag.StringVar(&cloudConfig.ServiceAccount,"gce-service-account","","GCE service account to use for GCE API calls, if applicable")
flag.StringVar(&cloudConfig.Cluster,"gke-cluster","","GKE name of cluster being used, if applicable")
flag.StringVar(&cloudConfig.NodeInstanceGroup,"node-instance-group","","Name of the managed instance group for nodes. Valid only for gce, gke or aws")
flag.IntVar(&cloudConfig.NumNodes,"num-nodes",-1,"Number of nodes in the cluster")
flag.StringVar(&cloudConfig.ClusterTag,"cluster-tag","","Tag used to identify resources. Only required if provider is aws.")
flag.IntVar(&testContext.MinStartupPods,"minStartupPods",0,"The number of pods which we need to see in 'Running' state with a 'Ready' condition of true, before we try running tests. This is useful in any cluster which needs some base pod-based services running before it can be used.")
flag.StringVar(&testContext.UpgradeTarget,"upgrade-target","ci/latest","Version to upgrade to (e.g. 'release/stable', 'release/latest', 'ci/latest', '0.19.1', '0.19.1-669-gabac8c8') if doing an upgrade test.")
flag.StringVar(&testContext.PrometheusPushGateway,"prom-push-gateway","","The URL to prometheus gateway, so that metrics can be pushed during e2es and scraped by prometheus. Typically something like 127.0.0.1:9091.")
flag.BoolVar(&testContext.VerifyServiceAccount,"e2e-verify-service-account",true,"If true tests will verify the service account before running.")
flag.BoolVar(&testContext.DeleteNamespace,"delete-namespace",true,"If true tests will delete namespace after completion. It is only designed to make debugging easier, DO NOT turn it off by default.")
flag.BoolVar(&testContext.CleanStart,"clean-start",false,"If true, purge all namespaces except default and system before running tests. This serves to cleanup test namespaces from failed/interrupted e2e runs in a long-lived cluster.")
flag.BoolVar(&testContext.GatherKubeSystemResourceUsageData,"gather-resource-usage",false,"If set to true framework will be monitoring resource usage of system add-ons in (some) e2e tests.")
flag.BoolVar(&testContext.GatherLogsSizes,"gather-logs-sizes",false,"If set to true framework will be monitoring logs sizes on all machines running e2e tests.")
flag.BoolVar(&testContext.GatherMetricsAfterTest,"gather-metrics-at-teardown",false,"If set to true framwork will gather metrics from all components after each test.")
flag.StringVar(&testContext.OutputPrintType,"output-print-type","hr","Comma separated list: 'hr' for human readable summaries 'json' for JSON ones.")
}
// setupProviderConfig validates and sets up cloudConfig based on testContext.Provider.
funcsetupProviderConfig()error{
switchtestContext.Provider{
case"":
glog.Info("The --provider flag is not set. Treating as a conformance test. Some tests may not be run.")
case"gce","gke":
varerrerror
Logf("Fetching cloud provider for %q\r\n",testContext.Provider)
vartokenSourceoauth2.TokenSource
tokenSource=nil
ifcloudConfig.ServiceAccount!=""{
// Use specified service account for auth
Logf("Using service account %q as token source.",cloudConfig.ServiceAccount)