Files
open-cluster-management/pkg/cmd/spoke/operator.go
Jian Qiu 62efbf935b Build common options for agent (#163)
Signed-off-by: Jian Qiu <jqiu@redhat.com>
2023-06-08 02:55:43 -04:00

30 lines
1021 B
Go

package spoke
import (
"github.com/spf13/cobra"
"github.com/openshift/library-go/pkg/controller/controllercmd"
"open-cluster-management.io/ocm/pkg/operator/operators/klusterlet"
"open-cluster-management.io/ocm/pkg/version"
)
// NewKlusterletOperatorCmd generatee a command to start klusterlet operator
func NewKlusterletOperatorCmd() *cobra.Command {
options := klusterlet.Options{}
cmdConfig := controllercmd.
NewControllerCommandConfig("klusterlet", version.Get(), options.RunKlusterletOperator)
cmd := cmdConfig.NewCommand()
cmd.Use = "klusterlet"
cmd.Short = "Start the klusterlet operator"
// add disable leader election flag
cmd.Flags().BoolVar(&cmdConfig.DisableLeaderElection, "disable-leader-election", false, "Disable leader election for the agent.")
cmd.Flags().BoolVar(&options.SkipPlaceholderHubSecret, "skip-placeholder-hub-secret", false,
"If set, will skip ensuring a placeholder hub secret which is originally intended for pulling "+
"work image before approved")
return cmd
}