From 60fde94e9f62d4e911a645918a95ca01d66d7744 Mon Sep 17 00:00:00 2001 From: Priya Wadhwa Date: Thu, 2 Apr 2020 16:46:58 -0700 Subject: [PATCH] parallelize updating cluster and setting up certs --- pkg/minikube/node/start.go | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/pkg/minikube/node/start.go b/pkg/minikube/node/start.go index 11695485d00e..af77da4cd434 100644 --- a/pkg/minikube/node/start.go +++ b/pkg/minikube/node/start.go @@ -23,6 +23,7 @@ import ( "os/exec" "strconv" "strings" + "sync" "time" "github.com/blang/semver" @@ -239,12 +240,24 @@ func setupKubeAdm(mAPI libmachine.API, cfg config.ClusterConfig, n config.Node) out.T(out.Option, "{{.extra_option_component_name}}.{{.key}}={{.value}}", out.V{"extra_option_component_name": eo.Component, "key": eo.Key, "value": eo.Value}) } // Loads cached images, generates config files, download binaries - if err := bs.UpdateCluster(cfg); err != nil { - exit.WithError("Failed to update cluster", err) - } - if err := bs.SetupCerts(cfg.KubernetesConfig, n); err != nil { - exit.WithError("Failed to setup certs", err) - } + // update cluster and set up certs in parallel + var parallel sync.WaitGroup + parallel.Add(2) + go func() { + if err := bs.UpdateCluster(cfg); err != nil { + exit.WithError("Failed to update cluster", err) + } + parallel.Done() + }() + + go func() { + if err := bs.SetupCerts(cfg.KubernetesConfig, n); err != nil { + exit.WithError("Failed to setup certs", err) + } + parallel.Done() + }() + + parallel.Wait() return bs }