// TestE2E checks configuration parameters (specified through flags) and then runs // E2E tests using the Ginkgo runner. // If a "report directory" is specified, one or more JUnit test reports will be // generated in this directory, and cluster logs will also be saved. // This function is called on each Ginkgo node in parallel mode. func RunE2ETests(t *testing.T) { runtime.ReallyCrash = true util.InitLogs() defer util.FlushLogs() // We must call setupProviderConfig first since SynchronizedBeforeSuite needs // cloudConfig to be set up already. if err := setupProviderConfig(); err != nil { glog.Fatalf(err.Error()) } gomega.RegisterFailHandler(ginkgo.Fail) // Disable skipped tests unless they are explicitly requested. if config.GinkgoConfig.FocusString == "" && config.GinkgoConfig.SkipString == "" { // TODO(ihmccreery) Remove [Skipped] once all [Skipped] labels have been reclassified. config.GinkgoConfig.SkipString = `\[Flaky\]|\[Skipped\]|\[Feature:.+\]` } // Run tests through the Ginkgo runner with output to console + JUnit for Jenkins var r []ginkgo.Reporter if testContext.ReportDir != "" { // TODO: we should probably only be trying to create this directory once // rather than once-per-Ginkgo-node. if err := os.MkdirAll(testContext.ReportDir, 0755); err != nil { glog.Errorf("Failed creating report directory: %v", err) } else { r = append(r, reporters.NewJUnitReporter(path.Join(testContext.ReportDir, fmt.Sprintf("junit_%02d.xml", config.GinkgoConfig.ParallelNode)))) } } glog.Infof("Starting e2e run %q on Ginkgo node %d", runId, config.GinkgoConfig.ParallelNode) ginkgo.RunSpecsWithDefaultAndCustomReporters(t, "Kubernetes e2e suite", r) }
// NewKubeletCommand provides a CLI handler for the 'kubelet' command func NewKubeletCommand(name, fullName string, out io.Writer) *cobra.Command { s := app.NewKubeletServer() cmd := &cobra.Command{ Use: name, Short: "Launch the Kubelet (kubelet)", Long: kubeletLog, Run: func(c *cobra.Command, args []string) { startProfiler() util.InitLogs() defer util.FlushLogs() if err := s.Run(nil); err != nil { fmt.Fprintf(os.Stderr, "%v\n", err) os.Exit(1) } }, } cmd.SetOutput(out) flags := cmd.Flags() //TODO: uncomment after picking up a newer cobra //pflag.AddFlagSetToPFlagSet(flag, flags) s.AddFlags(flags) return cmd }
// NewControllersCommand provides a CLI handler for the 'controller-manager' command func NewControllersCommand(name, fullName string, out io.Writer) *cobra.Command { s := app.NewCMServer() cmd := &cobra.Command{ Use: name, Short: "Launch Kubernetes controller manager (kube-controller-manager)", Long: controllersLong, Run: func(c *cobra.Command, args []string) { startProfiler() util.InitLogs() defer util.FlushLogs() if err := s.Run(pflag.CommandLine.Args()); err != nil { fmt.Fprintf(os.Stderr, "%v\n", err) os.Exit(1) } }, } cmd.SetOutput(out) flags := cmd.Flags() //TODO: uncomment after picking up a newer cobra //pflag.AddFlagSetToPFlagSet(flag, flags) s.AddFlags(flags) return cmd }
// NewSchedulerCommand provides a CLI handler for the 'scheduler' command func NewSchedulerCommand(name, fullName string, out io.Writer) *cobra.Command { s := app.NewSchedulerServer() cmd := &cobra.Command{ Use: name, Short: "Launch Kubernetes scheduler (kube-scheduler)", Long: controllersLong, Run: func(c *cobra.Command, args []string) { startProfiler() util.InitLogs() defer util.FlushLogs() if err := s.Run(pflag.CommandLine.Args()); err != nil { fmt.Fprintf(os.Stderr, "%v\n", err) os.Exit(1) } }, } cmd.SetOutput(out) flags := cmd.Flags() flags.SetNormalizeFunc(util.WordSepNormalizeFunc) flags.AddGoFlagSet(flag.CommandLine) s.AddFlags(flags) return cmd }
// NewAPIServerCommand provides a CLI handler for the 'apiserver' command func NewAPIServerCommand(name, fullName string, out io.Writer) *cobra.Command { apiServerOptions := apiserveroptions.NewAPIServer() cmd := &cobra.Command{ Use: name, Short: "Launch Kubernetes apiserver (kube-apiserver)", Long: apiserverLong, Run: func(c *cobra.Command, args []string) { startProfiler() util.InitLogs() defer util.FlushLogs() if err := apiserverapp.Run(apiServerOptions); err != nil { fmt.Fprintf(os.Stderr, "%v\n", err) os.Exit(1) } }, } cmd.SetOutput(out) flags := cmd.Flags() flags.SetNormalizeFunc(kflag.WordSepNormalizeFunc) apiServerOptions.AddFlags(flags) return cmd }
// NewProxyCommand provides a CLI handler for the 'proxy' command func NewProxyCommand(name, fullName string, out io.Writer) *cobra.Command { proxyConfig := app.NewProxyConfig() cmd := &cobra.Command{ Use: name, Short: "Launch Kubernetes proxy (kube-proxy)", Long: proxyLong, Run: func(c *cobra.Command, args []string) { startProfiler() util.InitLogs() defer util.FlushLogs() s, err := app.NewProxyServerDefault(proxyConfig) kcmdutil.CheckErr(err) if err := s.Run(pflag.CommandLine.Args()); err != nil { fmt.Fprintf(os.Stderr, "%v\n", err) os.Exit(1) } }, } cmd.SetOutput(out) flags := cmd.Flags() flags.SetNormalizeFunc(util.WordSepNormalizeFunc) flags.AddGoFlagSet(flag.CommandLine) proxyConfig.AddFlags(flags) return cmd }
func main() { // TODO: replace by non k8s code / logs util.InitFlags() util.InitLogs() defer util.FlushLogs() if *argVersion { fmt.Println(VERSION) os.Exit(0) } glog.Infof("Running version %s", VERSION) kv := kube2vulcand{etcdMutationTimeout: *argEtcdMutationTimeout} var err error // TODO: Validate input flags. if kv.etcdClient, err = newEtcdClient(*argEtcdServer); err != nil { glog.Fatalf("Failed to create etcd client - %v", err) } kubeClient, err := newKubeClient() if err != nil { glog.Fatalf("Failed to create a kubernetes client: %v", err) } kv.ingressesStore = watchForIngresses(kubeClient.ExtensionsClient, &kv) select {} }
// NewControllersCommand provides a CLI handler for the 'controller-manager' command func NewControllersCommand(name, fullName string, out io.Writer) *cobra.Command { controllerOptions := controlleroptions.NewCMServer() cmd := &cobra.Command{ Use: name, Short: "Launch Kubernetes controller manager (kube-controller-manager)", Long: controllersLong, Run: func(c *cobra.Command, args []string) { startProfiler() util.InitLogs() defer util.FlushLogs() if err := controllerapp.Run(controllerOptions); err != nil { fmt.Fprintf(os.Stderr, "%v\n", err) os.Exit(1) } }, } cmd.SetOutput(out) flags := cmd.Flags() flags.SetNormalizeFunc(kflag.WordSepNormalizeFunc) flags.AddGoFlagSet(flag.CommandLine) controllerOptions.AddFlags(flags) return cmd }
// NewKubeletCommand provides a CLI handler for the 'kubelet' command func NewKubeletCommand(name, fullName string, out io.Writer) *cobra.Command { kubeletOptions := kubeletoptions.NewKubeletServer() cmd := &cobra.Command{ Use: name, Short: "Launch the Kubelet (kubelet)", Long: kubeletLog, Run: func(c *cobra.Command, args []string) { startProfiler() util.InitLogs() defer util.FlushLogs() if err := kubeletapp.Run(kubeletOptions, nil); err != nil { fmt.Fprintf(os.Stderr, "%v\n", err) os.Exit(1) } }, } cmd.SetOutput(out) flags := cmd.Flags() flags.SetNormalizeFunc(util.WordSepNormalizeFunc) flags.AddGoFlagSet(flag.CommandLine) kubeletOptions.AddFlags(flags) return cmd }
// TestE2E checks configuration parameters (specified through flags) and then runs // E2E tests using the Ginkgo runner. // If a "report directory" is specified, one or more JUnit test reports will be // generated in this directory, and cluster logs will also be saved. // This function is called on each Ginkgo node in parallel mode. func RunE2ETests(t *testing.T) { runtime.ReallyCrash = true util.InitLogs() defer util.FlushLogs() gomega.RegisterFailHandler(ginkgo.Fail) // Disable skipped tests unless they are explicitly requested. if config.GinkgoConfig.FocusString == "" && config.GinkgoConfig.SkipString == "" { config.GinkgoConfig.SkipString = `\[Flaky\]|\[Feature:.+\]` } // Run tests through the Ginkgo runner with output to console + JUnit for Jenkins var r []ginkgo.Reporter if framework.TestContext.ReportDir != "" { // TODO: we should probably only be trying to create this directory once // rather than once-per-Ginkgo-node. if err := os.MkdirAll(framework.TestContext.ReportDir, 0755); err != nil { glog.Errorf("Failed creating report directory: %v", err) } else { r = append(r, reporters.NewJUnitReporter(path.Join(framework.TestContext.ReportDir, fmt.Sprintf("junit_%v%02d.xml", framework.TestContext.ReportPrefix, config.GinkgoConfig.ParallelNode)))) } } glog.Infof("Starting e2e run %q on Ginkgo node %d", framework.RunId, config.GinkgoConfig.ParallelNode) ginkgo.RunSpecsWithDefaultAndCustomReporters(t, "Kubernetes e2e suite", r) }
func main() { runtime.GOMAXPROCS(runtime.NumCPU()) addFlags(pflag.CommandLine) util.InitFlags() util.ReallyCrash = true util.InitLogs() defer util.FlushLogs() go func() { defer util.FlushLogs() time.Sleep(3 * time.Minute) glog.Fatalf("This test has timed out.") }() glog.Infof("Running tests for APIVersion: %s", os.Getenv("KUBE_TEST_API")) firstManifestURL := ServeCachedManifestFile(testPodSpec
func TestE2E(t *testing.T) { util.ReallyCrash = true util.InitLogs() defer util.FlushLogs() if *reportDir != "" { if err := os.MkdirAll(*reportDir, 0755); err != nil { glog.Errorf("Failed creating report directory: %v", err) } defer CoreDump(*reportDir) } if testContext.Provider == "" { glog.Info("The --provider flag is not set. Treating as a conformance test. Some tests may not be run.") } if testContext.Provider == "aws" { awsConfig := "[Global]\n" if cloudConfig.Zone == "" { glog.Fatal("gce-zone must be specified for AWS") } awsConfig += fmt.Sprintf("Zone=%s\n", cloudConfig.Zone) if cloudConfig.ClusterTag == "" { glog.Fatal("--cluster-tag must be specified for AWS") } awsConfig += fmt.Sprintf("KubernetesClusterTag=%s\n", cloudConfig.ClusterTag) var err error cloudConfig.Provider, err = cloudprovider.GetCloudProvider(testContext.Provider, strings.NewReader(awsConfig)) if err != nil { glog.Fatal("Error building AWS provider: ", err) } } // Disable skipped tests unless they are explicitly requested. if config.GinkgoConfig.FocusString == "" && config.GinkgoConfig.SkipString == "" { config.GinkgoConfig.SkipString = "Skipped" } gomega.RegisterFailHandler(ginkgo.Fail) // Ensure all pods are running and ready before starting tests (otherwise, // cluster infrastructure pods that are being pulled or started can block // test pods from running, and tests that ensure all pods are running and // ready will fail). if err := waitForPodsRunningReady(api.NamespaceSystem, testContext.MinStartupPods, podStartupTimeout); err != nil { t.Errorf("Error waiting for all pods to be running and ready: %v", err) return } // Run tests through the Ginkgo runner with output to console + JUnit for Jenkins var r []ginkgo.Reporter if *reportDir != "" { r = append(r, reporters.NewJUnitReporter(path.Join(*reportDir, fmt.Sprintf("junit_%02d.xml", config.GinkgoConfig.ParallelNode)))) } ginkgo.RunSpecsWithDefaultAndCustomReporters(t, "Kubernetes e2e suite", r) }
func main() { s := options.NewSchedulerServer() s.AddFlags(pflag.CommandLine) flag.InitFlags() util.InitLogs() defer util.FlushLogs() verflag.PrintAndExitIfRequested() app.Run(s) }
func main() { config := options.NewKubeDNSConfig() config.AddFlags(pflag.CommandLine) flag.InitFlags() util.InitLogs() defer util.FlushLogs() verflag.PrintAndExitIfRequested() server := app.NewKubeDNSServerDefault(config) server.Run() }
func main() { runtime.GOMAXPROCS(runtime.NumCPU()) s := app.NewSchedulerServer() s.AddFlags(pflag.CommandLine) util.InitFlags() util.InitLogs() defer util.FlushLogs() verflag.PrintAndExitIfRequested() //s.Run(pflag.CommandLine.Args()) }
func main() { runtime.GOMAXPROCS(runtime.NumCPU()) glog.V(2).Infof("*** Run Kubeturbo service ***") s := app.NewVMTServer() s.AddFlags(pflag.CommandLine) util.InitFlags() util.InitLogs() defer util.FlushLogs() verflag.PrintAndExitIfRequested() s.Run(pflag.CommandLine.Args()) }
func main() { s := options.NewCMServer() s.AddFlags(pflag.CommandLine) flag.InitFlags() util.InitLogs() defer util.FlushLogs() verflag.PrintAndExitIfRequested() if err := app.Run(s); err != nil { fmt.Fprintf(os.Stderr, "%v\n", err) os.Exit(1) } }
func main() { s := controllermanager.NewCMServer() s.AddFlags(pflag.CommandLine) flag.InitFlags() util.InitLogs() defer util.FlushLogs() verflag.PrintAndExitIfRequested() if err := s.Run(pflag.CommandLine.Args()); err != nil { fmt.Fprintf(os.Stderr, err.Error()) os.Exit(1) } }
func main() { runtime.GOMAXPROCS(runtime.NumCPU()) s := service.NewSchedulerServer() s.AddStandaloneFlags(pflag.CommandLine) flag.InitFlags() util.InitLogs() defer util.FlushLogs() verflag.PrintAndExitIfRequested() if err := s.Run(hyperkube.Nil(), pflag.CommandLine.Args()); err != nil { fmt.Fprintf(os.Stderr, err.Error()) os.Exit(1) } }
func main() { runtime.GOMAXPROCS(runtime.NumCPU()) s := app.NewKubeletServer() s.AddFlags(pflag.CommandLine) util.InitFlags() util.InitLogs() defer util.FlushLogs() verflag.PrintAndExitIfRequested() if err := s.Run(pflag.CommandLine.Args()); err != nil { fmt.Fprintf(os.Stderr, "%v\n", err) os.Exit(1) } }
func main() { s := service.NewKubeletExecutorServer() s.AddFlags(pflag.CommandLine) flag.InitFlags() util.InitLogs() defer util.FlushLogs() verflag.PrintAndExitIfRequested() if err := s.Run(hyperkube.Nil(), pflag.CommandLine.Args()); err != nil { fmt.Fprintf(os.Stderr, err.Error()) os.Exit(1) } }
func main() { rand.Seed(time.Now().UTC().UnixNano()) s := genericoptions.NewServerRunOptions() s.AddFlags(pflag.CommandLine) flag.InitFlags() util.InitLogs() defer util.FlushLogs() verflag.PrintAndExitIfRequested() if err := app.Run(s); err != nil { fmt.Fprintf(os.Stderr, "%v\n", err) os.Exit(1) } }
func main() { runtime.GOMAXPROCS(runtime.NumCPU()) rand.Seed(time.Now().UTC().UnixNano()) s := options.NewAPIServer() s.AddFlags(pflag.CommandLine) flag.InitFlags() util.InitLogs() defer util.FlushLogs() verflag.PrintAndExitIfRequested() if err := app.Run(s); err != nil { fmt.Fprintf(os.Stderr, "%v\n", err) os.Exit(1) } }
func runCmdStart(cmd *cobra.Command, args []string) error { etcdServer, err := url.Parse(startOpts.etcdServer) if err != nil { return fmt.Errorf("Invalid etcd etcdServer %q: %v", startOpts.etcdServer, err) } bk, err := bootkube.NewBootkube(bootkube.Config{ AssetDir: startOpts.assetDir, EtcdServer: etcdServer, }) if err != nil { return err } util.InitLogs() defer util.FlushLogs() return bk.Run() }
func main() { config := options.NewProxyConfig() config.AddFlags(pflag.CommandLine) flag.InitFlags() util.InitLogs() defer util.FlushLogs() verflag.PrintAndExitIfRequested() s, err := app.NewProxyServerDefault(config) if err != nil { fmt.Fprintf(os.Stderr, "%v\n", err) os.Exit(1) } if err = s.Run(); err != nil { fmt.Fprintf(os.Stderr, "%v\n", err) os.Exit(1) } }
func main() { runtime.GOMAXPROCS(runtime.NumCPU()) config := app.NewProxyConfig() config.AddFlags(pflag.CommandLine) util.InitFlags() util.InitLogs() defer util.FlushLogs() verflag.PrintAndExitIfRequested() s, err := app.NewProxyServerDefault(config) if err != nil { fmt.Fprintf(os.Stderr, "%v\n", err) os.Exit(1) } if err = s.Run(pflag.CommandLine.Args()); err != nil { fmt.Fprintf(os.Stderr, "%v\n", err) os.Exit(1) } }
func main() { runtime.GOMAXPROCS(runtime.NumCPU()) builder := builder.NewSimulatorBuilder() builder.AddFlags(pflag.CommandLine) util.InitFlags() util.InitLogs() defer util.FlushLogs() verflag.PrintAndExitIfRequested() builder.Init(pflag.CommandLine.Args()) simulator, err := builder.Build() if err != nil { glog.Errorf("error getting simulator: %s", err) return } action := simulator.Action() namespace := simulator.Namespace() // The simulator can simulate move, get and provision action now. actor := vmtaction.NewKubeActor(simulator.KubeClient(), simulator.Etcd()) if action == "move" || action == "Move " { podName := simulator.PodToMove() destinationNode := simulator.Destination() podIdentifier := namespace + "/" + podName actor.MovePod(podIdentifier, destinationNode, -1) return } else if action == "get" { actor.GetAllNodes() return } else if action == "provision" { podLabel := simulator.Label() newReplicas, _ := strconv.Atoi(simulator.NewReplica()) actor.UpdateReplicas(podLabel, namespace, newReplicas) return } }
func main() { runtime.GOMAXPROCS(runtime.NumCPU()) addFlags(pflag.CommandLine) util.InitFlags() util.ReallyCrash = true util.InitLogs() defer util.FlushLogs() go func() { defer util.FlushLogs() time.Sleep(3 * time.Minute) glog.Fatalf("This test has timed out.") }() glog.Infof("Running tests for APIVersion: %s", apiVersion) firstManifestURL := ServeCachedManifestFile(testPodSpecFile) secondManifestURL := ServeCachedManifestFile(testPodSpecFile) apiServerURL, _ := startComponents(firstManifestURL, secondManifestURL, apiVersion) // Ok. we're good to go. glog.Infof("API Server started on %s", apiServerURL) // Wait for the synchronization threads to come up. time.Sleep(time.Second * 10) kubeClient := client.NewOrDie(&client.Config{Host: apiServerURL, Version: apiVersion}) // Run tests in parallel testFuncs := []testFunc{ runReplicationControllerTest, runAtomicPutTest, runPatchTest, runServiceTest, runAPIVersionsTest, runMasterServiceTest, func(c *client.Client) { runSelfLinkTestOnNamespace(c, api.NamespaceDefault) runSelfLinkTestOnNamespace(c, "other") }, } // Only run at most maxConcurrency tests in parallel. if maxConcurrency <= 0 { maxConcurrency = len(testFuncs) } glog.Infof("Running %d tests in parallel.", maxConcurrency) ch := make(chan struct{}, maxConcurrency) var wg sync.WaitGroup wg.Add(len(testFuncs)) for i := range testFuncs { f := testFuncs[i] go func() { ch <- struct{}{} f(kubeClient) <-ch wg.Done() }() } wg.Wait() close(ch) // Check that kubelet tried to make the containers. // Using a set to list unique creation attempts. Our fake is // really stupid, so kubelet tries to create these multiple times. createdConts := util.StringSet{} for _, p := range fakeDocker1.Created { // The last 8 characters are random, so slice them off. if n := len(p); n > 8 { createdConts.Insert(p[:n-8]) } } for _, p := range fakeDocker2.Created { // The last 8 characters are random, so slice them off. if n := len(p); n > 8 { createdConts.Insert(p[:n-8]) } } // We expect 9: 2 pod infra containers + 2 containers from the replication controller + // 1 pod infra container + 2 containers from the URL on first Kubelet + // 1 pod infra container + 2 containers from the URL on second Kubelet + // 1 pod infra container + 1 container from the service test. // The total number of container created is 9 if len(createdConts) != 12 { glog.Fatalf("Expected 12 containers; got %v\n\nlist of created containers:\n\n%#v\n\nDocker 1 Created:\n\n%#v\n\nDocker 2 Created:\n\n%#v\n\n", len(createdConts), createdConts.List(), fakeDocker1.Created, fakeDocker2.Created) } glog.Infof("OK - found created containers: %#v", createdConts.List()) // This test doesn't run with the others because it can't run in // parallel and also it schedules extra pods which would change the // above pod counting logic. runSchedulerNoPhantomPodsTest(kubeClient) glog.Infof("\n\nLogging high latency metrics from the 10250 kubelet") e2e.HighLatencyKubeletOperations(nil, 1*time.Second, "localhost:10250") glog.Infof("\n\nLogging high latency metrics from the 10251 kubelet") e2e.HighLatencyKubeletOperations(nil, 1*time.Second, "localhost:10251") }
// Run the server. This will pick the appropriate server and run it. func (hk *HyperKube) Run(args []string) error { // If we are called directly, parse all flags up to the first real // argument. That should be the server to run. baseCommand := path.Base(args[0]) serverName := baseCommand if serverName == hk.Name { args = args[1:] baseFlags := hk.Flags() baseFlags.SetInterspersed(false) // Only parse flags up to the next real command err := baseFlags.Parse(args) if err != nil || hk.helpFlagVal { if err != nil { hk.Println("Error:", err) } hk.Usage() return err } verflag.PrintAndExitIfRequested() args = baseFlags.Args() if len(args) > 0 && len(args[0]) > 0 { serverName = args[0] baseCommand = baseCommand + " " + serverName args = args[1:] } else { err = errors.New("No server specified") hk.Printf("Error: %v\n\n", err) hk.Usage() return err } } s, err := hk.FindServer(serverName) if err != nil { hk.Printf("Error: %v\n\n", err) hk.Usage() return err } s.Flags().AddFlagSet(hk.Flags()) err = s.Flags().Parse(args) if err != nil || hk.helpFlagVal { if err != nil { hk.Printf("Error: %v\n\n", err) } s.Usage() return err } verflag.PrintAndExitIfRequested() util.InitLogs() defer util.FlushLogs() err = s.Run(s, s.Flags().Args()) if err != nil { hk.Println("Error:", err) } return err }
func main() { gruntime.GOMAXPROCS(gruntime.NumCPU()) addFlags(pflag.CommandLine) flag.InitFlags() utilruntime.ReallyCrash = true util.InitLogs() defer util.FlushLogs() go func() { defer util.FlushLogs() time.Sleep(maxTestTimeout) glog.Fatalf("This test has timed out.") }() glog.Infof("Running tests for APIVersion: %s", os.Getenv("KUBE_TEST_API")) firstManifestURL := ServeCachedManifestFile(testPodSpecFile) secondManifestURL := ServeCachedManifestFile(testPodSpecFile) apiServerURL, _ := startComponents(firstManifestURL, secondManifestURL) // Ok. we're good to go. glog.Infof("API Server started on %s", apiServerURL) // Wait for the synchronization threads to come up. time.Sleep(time.Second * 10) kubeClient := client.NewOrDie( &restclient.Config{ Host: apiServerURL, ContentConfig: restclient.ContentConfig{GroupVersion: testapi.Default.GroupVersion()}, QPS: 20, Burst: 50, }) // TODO: caesarxuchao: hacky way to specify version of Experimental client. // We will fix this by supporting multiple group versions in Config kubeClient.ExtensionsClient = client.NewExtensionsOrDie( &restclient.Config{ Host: apiServerURL, ContentConfig: restclient.ContentConfig{GroupVersion: testapi.Extensions.GroupVersion()}, QPS: 20, Burst: 50, }) // Run tests in parallel testFuncs := []testFunc{} // Only run at most maxConcurrency tests in parallel. if maxConcurrency <= 0 { maxConcurrency = len(testFuncs) } glog.Infof("Running %d tests in parallel.", maxConcurrency) ch := make(chan struct{}, maxConcurrency) var wg sync.WaitGroup wg.Add(len(testFuncs)) for i := range testFuncs { f := testFuncs[i] go func() { ch <- struct{}{} f(kubeClient) <-ch wg.Done() }() } wg.Wait() close(ch) // Check that kubelet tried to make the containers. // Using a set to list unique creation attempts. Our fake is // really stupid, so kubelet tries to create these multiple times. createdConts := sets.String{} for _, p := range fakeDocker1.Created { // The last 8 characters are random, so slice them off. if n := len(p); n > 8 { createdConts.Insert(p[:n-8]) } } for _, p := range fakeDocker2.Created { // The last 8 characters are random, so slice them off. if n := len(p); n > 8 { createdConts.Insert(p[:n-8]) } } // We expect 6 containers: // 1 pod infra container + 2 containers from the URL on first Kubelet + // 1 pod infra container + 2 containers from the URL on second Kubelet + // The total number of container created is 6 if len(createdConts) != 6 { glog.Fatalf("Expected 6 containers; got %v\n\nlist of created containers:\n\n%#v\n\nDocker 1 Created:\n\n%#v\n\nDocker 2 Created:\n\n%#v\n\n", len(createdConts), createdConts.List(), fakeDocker1.Created, fakeDocker2.Created) } glog.Infof("OK - found created containers: %#v", createdConts.List()) glog.Infof("\n\nLogging high latency metrics from the 10250 kubelet") e2e.HighLatencyKubeletOperations(nil, 1*time.Second, "localhost:10250") glog.Infof("\n\nLogging high latency metrics from the 10251 kubelet") e2e.HighLatencyKubeletOperations(nil, 1*time.Second, "localhost:10251") }