Skip to content

Commit

Permalink
Merge pull request #80873 from tedyu/kube-get-ns
Browse files Browse the repository at this point in the history
Omit namespace when kubectl get is for the cluster
  • Loading branch information
k8s-ci-robot committed Aug 3, 2019
2 parents 44f3aaf + e1ee01a commit f19863c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkg/kubectl/cmd/get/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -581,8 +581,11 @@ func (o *GetOptions) Run(f cmdutil.Factory, cmd *cobra.Command, args []string) e
w.Flush()
if trackingWriter.Written == 0 && !o.IgnoreNotFound && len(allErrs) == 0 {
// if we wrote no output, and had no errors, and are not ignoring NotFound, be sure we output something
noResourcesFoundFormat := fmt.Sprintf("No resources found in %s namespace.", o.Namespace)
fmt.Fprintln(o.ErrOut, noResourcesFoundFormat)
if !o.AllNamespaces {
fmt.Fprintln(o.ErrOut, fmt.Sprintf("No resources found in %s namespace.", o.Namespace))
} else {
fmt.Fprintln(o.ErrOut, fmt.Sprintf("No resources found"))
}
}
return utilerrors.NewAggregate(allErrs)
}
Expand Down

0 comments on commit f19863c

Please sign in to comment.