Open
Description
kubectl version:
Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.0", GitCommit:"9e991415386e4cf155a24b1da15becaa390438d8", GitTreeState:"clean", BuildDate:"2020-03-25T14:58:59Z", GoVersion:"go1.13.8", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"11+", GitVersion:"v1.11.0+d4cacc0", GitCommit:"d4cacc0", GitTreeState:"clean", BuildDate:"2019-10-31T21:06:55Z", GoVersion:"go1.10.8", Compiler:"gc", Platform:"linux/amd64"}
OS:
NAME=Fedora
VERSION="30 (Workstation Edition)"
ID=fedora
VERSION_ID=30
VERSION_CODENAME=""
PLATFORM_ID="platform:f30"
PRETTY_NAME="Fedora 30 (Workstation Edition)"
What happened:
When list of a resource type is empty, the error message seems to be thrown in the error stream but the error code is 0, thus indicating no error.
What you expected to happen:
I expected kubectl to return anything other than zero when list of a resource type is empty as the output is throw in the error stream.
Logs:
[mrinaldas@localhost ~]$ ./kubectl get pods
No resources found in blah namespace.
[mrinaldas@localhost ~]$ echo $?
0
[mrinaldas@localhost ~]$ ./kubectl get pods 2>capture.txt
[mrinaldas@localhost ~]$ cat capture.txt
No resources found in blah namespace.
[mrinaldas@localhost ~]$ ./kubectl get pods 1>capture.txt
No resources found in blah namespace.
[mrinaldas@localhost ~]$ cat capture.txt
[mrinaldas@localhost ~]$