NewCoreCommand creates a *cobra.Command object with default parameters
()
| 70 | |
| 71 | // NewCoreCommand creates a *cobra.Command object with default parameters |
| 72 | func NewCoreCommand() *cobra.Command { |
| 73 | s := options.NewCoreOptions() |
| 74 | cmd := &cobra.Command{ |
| 75 | Use: "vela-core", |
| 76 | Long: `The KubeVela controller manager is a daemon that embeds the core control loops shipped with KubeVela`, |
| 77 | RunE: func(cmd *cobra.Command, args []string) error { |
| 78 | return run(signals.SetupSignalHandler(), s) |
| 79 | }, |
| 80 | SilenceUsage: true, |
| 81 | FParseErrWhitelist: cobra.FParseErrWhitelist{ |
| 82 | // Allow unknown flags for backward-compatibility. |
| 83 | UnknownFlags: true, |
| 84 | }, |
| 85 | } |
| 86 | |
| 87 | fs := cmd.Flags() |
| 88 | namedFlagSets := s.Flags() |
| 89 | for _, set := range namedFlagSets.FlagSets { |
| 90 | fs.AddFlagSet(set) |
| 91 | } |
| 92 | meta.Name = types.VelaCoreName |
| 93 | |
| 94 | klog.InfoS("KubeVela information", "version", version.VelaVersion, "revision", version.GitRevision) |
| 95 | klog.InfoS("Vela-Core init", "definition namespace", oam.SystemDefinitionNamespace) |
| 96 | |
| 97 | return cmd |
| 98 | } |
| 99 | |
| 100 | func run(ctx context.Context, s *options.CoreOptions) error { |
| 101 | restConfig := ctrl.GetConfigOrDie() |
no test coverage detected