Skip to content

Commit

Permalink
Hide reduntant kubeconfig flag from istioctl validate (istio#26987)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shamsher Ansari authored Sep 2, 2020
1 parent c6fbf76 commit cfc56f2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
5 changes: 4 additions & 1 deletion istioctl/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,10 @@ debug and diagnose their Istio mesh.
Manual: "Istio Control",
}))

rootCmd.AddCommand(validate.NewValidateCommand(&istioNamespace))
validateCmd := validate.NewValidateCommand(&istioNamespace)
hideInheritedFlags(validateCmd, "kubeconfig")
rootCmd.AddCommand(validateCmd)

rootCmd.AddCommand(optionsCommand(rootCmd))

// BFS apply the flag error function to all subcommands
Expand Down
14 changes: 9 additions & 5 deletions istioctl/pkg/validate/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,17 +268,21 @@ func NewValidateCommand(istioNamespace *string) *cobra.Command {
var referential bool

c := &cobra.Command{
Use: "validate -f FILENAME [options]",
Short: "Validate Istio policy and rules files",
Use: "validate -f FILENAME [options]",
Aliases: []string{"v"},
Short: "Validate Istio policy and rules files",
Example: `
# Validate bookinfo-gateway.yaml
istioctl validate -f bookinfo-gateway.yaml
istioctl validate -f samples/bookinfo/networking/bookinfo-gateway.yaml
# Validate bookinfo-gateway.yaml with shorthand syntax
istioctl v -f samples/bookinfo/networking/bookinfo-gateway.yaml
# Validate current deployments under 'default' namespace within the cluster
kubectl get deployments -o yaml |istioctl validate -f -
kubectl get deployments -o yaml | istioctl validate -f -
# Validate current services under 'default' namespace within the cluster
kubectl get services -o yaml |istioctl validate -f -
kubectl get services -o yaml | istioctl validate -f -
# Also see the related command 'istioctl analyze'
istioctl analyze samples/bookinfo/networking/bookinfo-gateway.yaml
Expand Down

0 comments on commit cfc56f2

Please sign in to comment.