diff --git a/pkg/kubectl/cmd/get/get.go b/pkg/kubectl/cmd/get/get.go index 02b8d513d5a49..352f63ae353f7 100644 --- a/pkg/kubectl/cmd/get/get.go +++ b/pkg/kubectl/cmd/get/get.go @@ -575,7 +575,8 @@ 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 - fmt.Fprintln(o.ErrOut, "No resources found.") + noResourcesFoundFormat := fmt.Sprintf("No resources found in %s namespace.", o.Namespace) + fmt.Fprintln(o.ErrOut, noResourcesFoundFormat) } return utilerrors.NewAggregate(allErrs) } diff --git a/pkg/kubectl/cmd/get/get_test.go b/pkg/kubectl/cmd/get/get_test.go index 5de94dd8b759b..f906bbb458c11 100644 --- a/pkg/kubectl/cmd/get/get_test.go +++ b/pkg/kubectl/cmd/get/get_test.go @@ -513,7 +513,7 @@ func TestGetEmptyTable(t *testing.T) { if e, a := expected, buf.String(); e != a { t.Errorf("expected\n%v\ngot\n%v", e, a) } - expectedErr := `No resources found. + expectedErr := `No resources found in test namespace. ` if e, a := expectedErr, errbuf.String(); e != a { t.Errorf("expectedErr\n%v\ngot\n%v", e, a)