2020-11-08 02:43:58 +08:00
|
|
|
package cmd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
"kubeye/pkg/validator"
|
|
|
|
)
|
|
|
|
|
2020-11-25 20:45:05 +08:00
|
|
|
var config string
|
|
|
|
|
2020-11-08 02:43:58 +08:00
|
|
|
func init() {
|
|
|
|
rootCmd.AddCommand(auditCmd)
|
2020-11-25 20:45:05 +08:00
|
|
|
//flag.Parse()
|
|
|
|
//pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
|
|
|
|
auditCmd.Flags().StringVarP(&config, "filename", "f", "", "Customize best practice configuration")
|
2020-11-08 02:43:58 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
var auditCmd = &cobra.Command{
|
|
|
|
Use: "audit",
|
|
|
|
Short: "audit the result",
|
|
|
|
Run: func(cmd *cobra.Command, args []string) {
|
2020-11-25 20:45:05 +08:00
|
|
|
err := validator.Cluster(config, cmd.Context())
|
2020-11-08 02:43:58 +08:00
|
|
|
if err != nil {
|
|
|
|
fmt.Println(err)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
}
|