Files
open-cluster-management/pkg/cmd/hub/registration.go
Jian Qiu e22faa4545 🌱 Build a commonoption for all managers (#228)
* Build a commonoption for all managers

Signed-off-by: Jian Qiu <jqiu@redhat.com>

* Add unit tests

Signed-off-by: Jian Qiu <jqiu@redhat.com>

---------

Signed-off-by: Jian Qiu <jqiu@redhat.com>
2023-07-25 03:12:35 +02:00

28 lines
700 B
Go

package hub
import (
"context"
"github.com/spf13/cobra"
commonoptions "open-cluster-management.io/ocm/pkg/common/options"
"open-cluster-management.io/ocm/pkg/registration/hub"
"open-cluster-management.io/ocm/pkg/version"
)
func NewRegistrationController() *cobra.Command {
opts := commonoptions.NewOptions()
manager := hub.NewHubManagerOptions()
cmdConfig := opts.
NewControllerCommandConfig("registration-controller", version.Get(), manager.RunControllerManager)
cmd := cmdConfig.NewCommandWithContext(context.TODO())
cmd.Use = "controller"
cmd.Short = "Start the Cluster Registration Controller"
flags := cmd.Flags()
manager.AddFlags(flags)
opts.AddFlags(flags)
return cmd
}