mirror of
https://github.com/open-cluster-management-io/ocm.git
synced 2026-05-15 21:59:16 +00:00
57 lines
1.1 KiB
Go
57 lines
1.1 KiB
Go
package main
|
|
|
|
import (
|
|
goflag "flag"
|
|
"fmt"
|
|
"math/rand"
|
|
"os"
|
|
"time"
|
|
|
|
"github.com/spf13/cobra"
|
|
"github.com/spf13/pflag"
|
|
|
|
utilflag "k8s.io/component-base/cli/flag"
|
|
"k8s.io/component-base/logs"
|
|
|
|
"github.com/open-cluster-management/registration-operator/pkg/cmd/operator"
|
|
"github.com/open-cluster-management/registration-operator/pkg/version"
|
|
)
|
|
|
|
func main() {
|
|
rand.Seed(time.Now().UTC().UnixNano())
|
|
|
|
pflag.CommandLine.SetNormalizeFunc(utilflag.WordSepNormalizeFunc)
|
|
pflag.CommandLine.AddGoFlagSet(goflag.CommandLine)
|
|
|
|
logs.InitLogs()
|
|
defer logs.FlushLogs()
|
|
|
|
command := newNucleusCommand()
|
|
if err := command.Execute(); err != nil {
|
|
fmt.Fprintf(os.Stderr, "%v\n", err)
|
|
os.Exit(1)
|
|
}
|
|
}
|
|
|
|
func newNucleusCommand() *cobra.Command {
|
|
cmd := &cobra.Command{
|
|
Use: "registration-operator",
|
|
Short: "Nucleus Operator",
|
|
Run: func(cmd *cobra.Command, args []string) {
|
|
_ = cmd.Help()
|
|
os.Exit(1)
|
|
},
|
|
}
|
|
|
|
if v := version.Get().String(); len(v) == 0 {
|
|
cmd.Version = "<unknown>"
|
|
} else {
|
|
cmd.Version = v
|
|
}
|
|
|
|
cmd.AddCommand(operator.NewHubOperatorCmd())
|
|
cmd.AddCommand(operator.NewKlusterletOperatorCmd())
|
|
|
|
return cmd
|
|
}
|