mirror of
https://github.com/open-cluster-management-io/ocm.git
synced 2026-05-11 03:39:26 +00:00
* 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>
28 lines
834 B
Go
28 lines
834 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/operator/operators/clustermanager"
|
|
"open-cluster-management.io/ocm/pkg/version"
|
|
)
|
|
|
|
// NewHubOperatorCmd generatee a command to start hub operator
|
|
func NewHubOperatorCmd() *cobra.Command {
|
|
opts := commonoptions.NewOptions()
|
|
cmOptions := clustermanager.Options{}
|
|
cmd := opts.
|
|
NewControllerCommandConfig("clustermanager", version.Get(), cmOptions.RunClusterManagerOperator).
|
|
NewCommandWithContext(context.TODO())
|
|
cmd.Use = "hub"
|
|
cmd.Short = "Start the cluster manager operator"
|
|
|
|
flags := cmd.Flags()
|
|
flags.BoolVar(&cmOptions.SkipRemoveCRDs, "skip-remove-crds", false, "Skip removing CRDs while ClusterManager is deleting.")
|
|
opts.AddFlags(flags)
|
|
return cmd
|
|
}
|