28 lines
601 B
Go
28 lines
601 B
Go
package makecmd
|
|
|
|
import (
|
|
"github.com/spf13/cobra"
|
|
"yizhisec.com/hsv2/forge/internal/controller/maker"
|
|
"yizhisec.com/hsv2/forge/internal/opt"
|
|
)
|
|
|
|
func Longhorn() *cobra.Command {
|
|
var (
|
|
replicaCount int
|
|
)
|
|
|
|
_cmd := &cobra.Command{
|
|
Use: "longhorn",
|
|
Short: "Build Longhorn resources",
|
|
Long: `Build and prepare Longhorn storage resources.`,
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
mk := maker.NewMaker(opt.Cfg.Make.Dir)
|
|
return mk.Longhorn(cmd.Context(), replicaCount)
|
|
},
|
|
}
|
|
|
|
_cmd.Flags().IntVar(&replicaCount, "replica-count", 2, "存储副本数")
|
|
|
|
return _cmd
|
|
}
|