Description
What happened:
On Kubernetes 1.18 and 1.19, with passed --feature-gates=RemoveSelfLink=true
parameter, result for query the API for a list of non-existent resources gives null as an items value:
$ curl http://localhost:8080/api/v1/pods
{
"kind": "PodList",
"apiVersion": "v1",
"metadata": {
"resourceVersion": "266"
},
"items": null
}
What you expected to happen:
It should return "items": []
like:
$ curl http://localhost:8080/api/v1/pods
{
"kind": "PodList",
"apiVersion": "v1",
"metadata": {
"resourceVersion": "266"
},
"items": []
}
similar to version 1.20.
Documentation says, that for PodList type, items
must be an array[1], which API convention[2] specify that ”Any kind that has the "items" field must be a list kind.” There is no null
mentioned as a possible value.
How to reproduce it (as minimally and precisely as possible):
The only difference is the --feature-gates=RemoveSelfLink=true
parameter - without it everything works as expected.
Anything else we need to know?:
Environment:
- Kubernetes version (use
kubectl version
): 1.19.6, 1.18.0 - Cloud provider or hardware configuration: n/a
- OS (e.g:
cat /etc/os-release
): Ubuntu 18.04 LTS - Kernel (e.g.
uname -a
): 4.15.0-88 - Install tools: manual
- Network plugin and version (if this is a network-related bug): n/a
- Others: n/a
[1] https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#podlist-v1-core
[2] https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#types-kinds