MCPcopy
hub / github.com/kubevela/kubevela / NewCoreCommand

Function NewCoreCommand

cmd/core/app/server.go:72–98  ·  view source on GitHub ↗

NewCoreCommand creates a *cobra.Command object with default parameters

()

Source from the content-addressed store, hash-verified

70
71// NewCoreCommand creates a *cobra.Command object with default parameters
72func 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
100func run(ctx context.Context, s *options.CoreOptions) error {
101 restConfig := ctrl.GetConfigOrDie()

Callers 1

mainFunction · 0.92

Calls 3

FlagsMethod · 0.95
NewCoreOptionsFunction · 0.92
runFunction · 0.85

Tested by

no test coverage detected