()
| 45 | var isDebug, isAggIP bool |
| 46 | |
| 47 | func RegisterAgentCommand() *cobra.Command { |
| 48 | agent := &cobra.Command{ |
| 49 | Use: "agent", |
| 50 | Short: "agent operation commands", |
| 51 | Run: func(cmd *cobra.Command, args []string) { |
| 52 | fmt.Printf("please run with 'list'.\n") |
| 53 | }, |
| 54 | } |
| 55 | |
| 56 | var listOutput string |
| 57 | list := &cobra.Command{ |
| 58 | Use: "list [name]", |
| 59 | Short: "list agent info", |
| 60 | Example: "deepflow-ctl agent list deepflow-agent -o yaml", |
| 61 | Run: func(cmd *cobra.Command, args []string) { |
| 62 | listAgent(cmd, args, listOutput) |
| 63 | }, |
| 64 | } |
| 65 | list.Flags().StringVarP(&listOutput, "output", "o", "", "output format") |
| 66 | |
| 67 | delete := &cobra.Command{ |
| 68 | Use: "delete [name]", |
| 69 | Short: "delete agent", |
| 70 | Example: "deepflow-ctl agent delete deepflow-agent", |
| 71 | Run: func(cmd *cobra.Command, args []string) { |
| 72 | deleteAgent(cmd, args) |
| 73 | }, |
| 74 | } |
| 75 | |
| 76 | var updateFilename string |
| 77 | update := &cobra.Command{ |
| 78 | Use: "update -f <filename>", |
| 79 | Short: "update agent", |
| 80 | Example: "deepflow-ctl agent update -f agent.yaml", |
| 81 | Run: func(cmd *cobra.Command, args []string) { |
| 82 | updateAgent(cmd, args, updateFilename) |
| 83 | }, |
| 84 | } |
| 85 | update.Flags().StringVarP(&updateFilename, "filename", "f", "", "file to use update agent") |
| 86 | update.MarkFlagRequired("filename") |
| 87 | |
| 88 | updateExample := &cobra.Command{ |
| 89 | Use: "update-example", |
| 90 | Short: "example agent update yaml", |
| 91 | Example: "deepflow-ctl agent update-example", |
| 92 | Run: func(cmd *cobra.Command, args []string) { |
| 93 | fmt.Printf(string(example.YamlVtapUpdateConfig)) |
| 94 | }, |
| 95 | } |
| 96 | |
| 97 | var typeStr string |
| 98 | |
| 99 | rebalanceCmd := &cobra.Command{ |
| 100 | Use: "rebalance", |
| 101 | Short: "rebalance controller or analyzer", |
| 102 | Example: `deepflow-ctl agent rebalance (rebalance controller and analyzer) |
| 103 | deepflow-ctl agent rebalance --type=controller |
| 104 | deepflow-ctl agent rebalance --type=analyzer`, |
no test coverage detected