ctl create cmm

This commit is contained in:
2026-05-11 04:48:00 +08:00
parent dca01e4abf
commit 35f2edc0b5
8 changed files with 318 additions and 34 deletions

View File

@@ -165,6 +165,47 @@ func NewCmdCreate(flags *genericclioptions.ConfigFlags) *cobra.Command {
cmd.AddCommand(&agentcmd)
cmmconf := render.CMMConf{}
cmmcmd := cobra.Command{
Use: "cmm",
Short: "Print CMM daemonsets template",
RunE: func(cmd *cobra.Command, _ []string) error {
if len(cmmconf.ImagePullSecrets) > 0 && strings.TrimSpace(cmmconf.Image) == "" {
return fmt.Errorf("--image-pull-secret requires --image")
}
ns, _, err := flags.ToRawKubeConfigLoader().Namespace()
if err != nil {
return err
}
cmmconf.Namespace = ns
out, err := render.RenderCMMDaemonSets(cmmconf)
if err != nil {
return err
}
_, err = fmt.Fprint(cmd.OutOrStdout(), out)
return err
},
}
cmmcmd.Flags().StringVar(
&cmmconf.Image,
"image",
"",
"CMM image, including optional registry and tag",
)
cmmcmd.Flags().StringSliceVar(
&cmmconf.ImagePullSecrets,
"image-pull-secret",
nil,
"Image pull secret name for the CMM image; may be specified multiple times or as a comma-separated list",
)
cmd.AddCommand(&cmmcmd)
return cmd
}