// 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 }
// NewKubeControllerManager creates a new hyperkube Server object that includes the // description and flags. func NewKubeControllerManager() *Server { s := options.NewCMServer() hks := Server{ SimpleUsage: "controller-manager", Long: "A server that runs a set of active components. This includes replication controllers, service endpoints and nodes.", Run: func(_ *Server, args []string) error { return app.Run(s) }, } s.AddFlags(hks.Flags()) return &hks }
func main() { s := options.NewCMServer() s.AddFlags(pflag.CommandLine, app.KnownControllers(), app.ControllersDisabledByDefault.List()) flag.InitFlags() logs.InitLogs() defer logs.FlushLogs() verflag.PrintAndExitIfRequested() if err := app.Run(s); err != nil { fmt.Fprintf(os.Stderr, "%v\n", err) os.Exit(1) } }
func main() { s := options.NewCMServer() s.AddFlags(pflag.CommandLine) flag.InitFlags() logs.InitLogs() defer logs.FlushLogs() verflag.PrintAndExitIfRequested() if err := app.Run(s); err != nil { fmt.Fprintf(os.Stderr, "%v\n", err) os.Exit(1) } }
func (b *bootkube) Run() error { errch := make(chan error) go func() { errch <- apiapp.Run(b.apiServer) }() go func() { errch <- cmapp.Run(b.controller) }() go func() { errch <- schedapp.Run(b.scheduler) }() go func() { if err := CreateAssets(filepath.Join(b.assetDir, asset.AssetPathManifests), assetTimeout); err != nil { errch <- err } }() go func() { errch <- WaitUntilPodsRunning(requiredPods, assetTimeout) }() // If any of the bootkube services exit, it means it is unrecoverable and we should exit. return <-errch }
func StartControllerManagerServer(lk LocalkubeServer) func() error { config := options.NewCMServer() config.Master = lk.GetAPIServerInsecureURL() // defaults from command config.DeletingPodsQps = 0.1 config.DeletingPodsBurst = 10 config.EnableProfiling = true config.ServiceAccountKeyFile = lk.GetPrivateKeyCertPath() config.RootCAFile = lk.GetCAPublicKeyCertPath() return func() error { return controllerManager.Run(config) } }
func main() { runtime.GOMAXPROCS(runtime.NumCPU()) s := options.NewCMServer() s.AddFlags(pflag.CommandLine) util.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) } }