mirror of
https://github.com/kubesphere/kubekey.git
synced 2025-12-26 01:22:51 +00:00
34 lines
796 B
Go
34 lines
796 B
Go
package cmd
|
|
|
|
import (
|
|
"github.com/kubesphere/kubekey/pkg/pipelines"
|
|
"github.com/kubesphere/kubekey/pkg/pipelines/common"
|
|
"github.com/pkg/errors"
|
|
"github.com/spf13/cobra"
|
|
"strings"
|
|
)
|
|
|
|
var deleteNodeCmd = &cobra.Command{
|
|
Use: "node",
|
|
Short: "delete a node",
|
|
PreRunE: func(cmd *cobra.Command, args []string) error {
|
|
if len(args) == 0 {
|
|
return errors.New("node can not be empty")
|
|
}
|
|
return nil
|
|
},
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
arg := common.Argument{
|
|
FilePath: opt.ClusterCfgFile,
|
|
Debug: opt.Verbose,
|
|
NodeName: strings.Join(args, ""),
|
|
}
|
|
return pipelines.DeleteNode(arg)
|
|
},
|
|
}
|
|
|
|
func init() {
|
|
deleteCmd.AddCommand(deleteNodeCmd)
|
|
deleteNodeCmd.Flags().StringVarP(&opt.ClusterCfgFile, "filename", "f", "", "Path to a configuration file")
|
|
}
|