Skip to content

Commit

Permalink
feat: add vcctl pod list
Browse files Browse the repository at this point in the history
Signed-off-by: googs1025 <googs1025@gmail.com>
  • Loading branch information
googs1025 committed Jun 20, 2024
1 parent b97654a commit 869b49e
Show file tree
Hide file tree
Showing 5 changed files with 841 additions and 0 deletions.
39 changes: 39 additions & 0 deletions cmd/cli/pod.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package main

import (
"github.com/spf13/cobra"

"volcano.sh/volcano/cmd/cli/util"
"volcano.sh/volcano/pkg/cli/pod"
)

func buildPodCmd() *cobra.Command {
podCmd := &cobra.Command{
Use: "pod",
Short: "vcctl command line operation pod",
}

podCommandMap := map[string]struct {
Short string
RunFunction func(cmd *cobra.Command, args []string)
InitFlags func(cmd *cobra.Command)
}{
"list": {
Short: "list pod information created by vcjob",
RunFunction: func(cmd *cobra.Command, args []string) {
util.CheckError(cmd, pod.ListPods(cmd.Context()))
},
InitFlags: pod.InitListFlags,
},
}
for command, config := range podCommandMap {
cmd := &cobra.Command{
Use: command,
Short: config.Short,
Run: config.RunFunction,
}
config.InitFlags(cmd)
podCmd.AddCommand(cmd)
}
return podCmd
}
1 change: 1 addition & 0 deletions cmd/cli/vcctl.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func main() {
rootCmd.AddCommand(buildJobCmd())
rootCmd.AddCommand(buildQueueCmd())
rootCmd.AddCommand(buildJobTemplateCmd())
rootCmd.AddCommand(buildPodCmd())
rootCmd.AddCommand(versionCommand())

code := cli.Run(&rootCmd)
Expand Down
Loading

0 comments on commit 869b49e

Please sign in to comment.