func StartMulti(ctx context.Context, startFuncs map[string]StartFunc, opts Options, schemes runtime.SchemeBuilder, localMode bool, addStatsHandlers ...func(mux *http.ServeMux, profiles map[string]string)) error {
	setupLogging(opts.VerboseMode, opts.DevLogger)
	mgr, err := makeMasterManager(opts, schemes)
	if err != nil {
		return err
	}
	snapshotHistory := stats.NewSnapshotHistory()
	stats.MustStartServerBackground(snapshotHistory, opts.MetricsBindPort, addStatsHandlers...)
	var (
		clusterWatcher multicluster.Interface
		mcClient       multicluster.Client
	)
	if !localMode {
		clusterWatcher = watch.NewClusterWatcher(ctx, manager.Options{
			Namespace: "",  
			Scheme:    mgr.GetScheme(),
		})
		mcClient = multicluster.NewClient(clusterWatcher)
	}
	params := StartParameters{
		MasterManager:   mgr,
		McClient:        mcClient,
		Clusters:        clusterWatcher,
		SnapshotHistory: snapshotHistory,
		VerboseMode:     opts.VerboseMode,
		SettingsRef:     opts.SettingsRef,
	}
	eg, ctx := errgroup.WithContext(ctx)
	for name, start := range startFuncs {
		start := start  
		namedCtx := ctx
		if name != "" {
			namedCtx = contextutils.WithLogger(namedCtx, name)
		}
		eg.Go(func() error {
			contextutils.LoggerFrom(namedCtx).Debugf("starting main goroutine")
			if synced := params.MasterManager.GetCache().WaitForCacheSync(namedCtx); !synced {
				return eris.Errorf("caches failed to sync")
			}
			err := start(namedCtx, params)
			if err != nil {
				contextutils.LoggerFrom(namedCtx).Errorf("main goroutine failed: %v", err)
			}
			return err
		})
	}
	if clusterWatcher != nil {
		eg.Go(func() error {
			if synced := params.MasterManager.GetCache().WaitForCacheSync(ctx); !synced {
				return eris.Errorf("caches failed to sync")
			}
			return clusterWatcher.Run(mgr)
		})
	}
	eg.Go(func() error {
		ctx := contextutils.WithLogger(ctx, "controller-runtime-manager")
		contextutils.LoggerFrom(ctx).Infof("starting manager with options %+v", opts)
		return mgr.Start(ctx)
	})
	return eg.Wait()
}
Like Start, but runs multiple StartFuncs concurrently
package bootstrap
import (
	"context"
	"net/http"
	"github.com/rotisserie/eris"
	"github.com/solo-io/go-utils/errgroup"
	"github.com/solo-io/skv2/pkg/stats"
	"k8s.io/apimachinery/pkg/runtime"
	"k8s.io/klog/v2"
	"github.com/spf13/pflag"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"github.com/go-logr/zapr"
	"github.com/solo-io/go-utils/contextutils"
	v1 "github.com/solo-io/skv2/pkg/api/core.skv2.solo.io/v1"
	"github.com/solo-io/skv2/pkg/multicluster"
	"github.com/solo-io/skv2/pkg/multicluster/watch"
	"go.uber.org/zap"
	"go.uber.org/zap/zapcore"
	"sigs.k8s.io/controller-runtime/pkg/client/config"
	"sigs.k8s.io/controller-runtime/pkg/log"
	zaputil "sigs.k8s.io/controller-runtime/pkg/log/zap"
	"sigs.k8s.io/controller-runtime/pkg/manager"
	_ "k8s.io/client-go/plugin/pkg/client/auth"
)
type StartParameters struct {
	MasterManager   manager.Manager
	McClient        multicluster.Client     
	Clusters        multicluster.Interface  
	SnapshotHistory *stats.SnapshotHistory
	SettingsRef v1.ObjectRef
	VerboseMode bool
}
type StartFunc func(
	ctx context.Context,
	parameters StartParameters,
) error
type Options struct {
	MetricsBindPort uint32
	MasterNamespace string
	VerboseMode bool
	DevLogger bool
	ManagementContext string
	SettingsRef v1.ObjectRef
}
func (opts *Options) AddToFlags(flags *pflag.FlagSet) {
	flags.StringVarP(&opts.MasterNamespace, "namespace", "n", metav1.NamespaceAll, "if specified restricts the master manager's cache to watch objects in the desired namespace.")
	flags.Uint32Var(&opts.MetricsBindPort, "metrics-port", opts.MetricsBindPort, "port on which to serve Prometheus metrics. set to 0 to disable")
	flags.BoolVar(&opts.VerboseMode, "verbose", true, "enables verbose/debug logging")
	flags.StringVar(&opts.ManagementContext, "context", "", "If specified, use this context from the selected KubeConfig to connect to the local (management) cluster.")
	flags.StringVar(&opts.SettingsRef.Name, "settings-name", opts.SettingsRef.Name, "The name of the Settings object this controller should use.")
	flags.StringVar(&opts.SettingsRef.Namespace, "settings-namespace", opts.SettingsRef.Namespace, "The namespace of the Settings object this controller should use.")
	flags.BoolVar(&opts.DevLogger, "dev-logger", false, "Default: false. Set this value to true to enable debug panic logs for development.")
	flags.MarkHidden("dev-logger")
}
func Start(ctx context.Context, start StartFunc, opts Options, schemes runtime.SchemeBuilder, localMode bool) error {
	return StartMulti(ctx, map[string]StartFunc{"": start}, opts, schemes, localMode)
}