Select node by pod (#18)

* Select node by pod.

* Removed watch pod by regex. Irrelevant for now.

* Changed default image to develop:latest.
This commit is contained in:
nimrod-up9
2021-04-29 15:46:18 +03:00
committed by GitHub
parent 96a6ac3251
commit 38146a644d
4 changed files with 14 additions and 14 deletions

View File

@@ -1,11 +1,9 @@
package cmd
import (
"fmt"
"github.com/spf13/cobra"
"github.com/up9inc/mizu/cli/config"
"github.com/up9inc/mizu/cli/mizu"
"regexp"
)
// rootCmd represents the base command when called without any subcommands
@@ -16,16 +14,11 @@ func init() {
rootCmd.Use = "cmd pod-query"
rootCmd.Short = "Tail HTTP traffic from multiple pods"
rootCmd.RunE = func(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
if len(args) != 0 {
return rootCmd.Help()
}
regex, err := regexp.Compile(args[0])
if err != nil {
fmt.Printf("%s is not a valid regex %s", args[0], err)
return nil
}
mizu.Run(regex)
mizu.Run()
return nil
}
@@ -36,8 +29,9 @@ func init() {
rootCmd.Flags().StringVarP(&config.Configuration.Namespace, "namespace", "n", "", "Namespace selector")
rootCmd.Flags().BoolVarP(&config.Configuration.AllNamespaces, "all-namespaces", "A", false, "Select all namespaces")
rootCmd.Flags().StringVarP(&config.Configuration.KubeConfigPath, "kubeconfig", "k", "", "Path to kubeconfig file")
rootCmd.Flags().StringVarP(&config.Configuration.MizuImage, "mizu-image", "", "gcr.io/up9-docker-hub/mizu/develop/v6", "Custom image for mizu collector")
rootCmd.Flags().StringVarP(&config.Configuration.MizuImage, "mizu-image", "", "gcr.io/up9-docker-hub/mizu/develop:latest", "Custom image for mizu collector")
rootCmd.Flags().Uint16VarP(&config.Configuration.MizuPodPort, "mizu-port", "", 8899, "Port which mizu cli will attempt to forward from the mizu collector pod")
rootCmd.Flags().StringVarP(&config.Configuration.TappedPodName, "pod", "", "", "View traffic of this pod")
}
// Execute adds all child commands to the root command and sets flags appropriately.