Description
/kind bug
What happened:
I tried to delete a namespace via https://github.com/kubernetes-client/java and was hit by a gnarly error when the lib tried to deserialize the returned body
com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected a string but was BEGIN_OBJECT at line 1 column 321 path $.status
So I dug into the API repsonses and found out that indeed something appears to be wrong in the swagger spec + official API documentation. According to DELETE namespace docs the response should be a Status v1 meta object. However, the returned response looks actually like this:
12:24 $ kubectl --v 8 delete namespace aafs-dxbd85
I1018 12:26:16.686420 10111 loader.go:357] Config loaded from file /home/jrudolph/dev/mc/infrastructure/kubernetes/cluster.kubeconfig
I1018 12:26:16.691791 10111 request.go:874] Request Body: {"orphanDependents":false}
I1018 12:26:16.691852 10111 round_trippers.go:383] DELETE https://k8s.dev.eu-de-central.msh.host:6443/api/v1/namespaces/aafs-dxbd85
I1018 12:26:16.691858 10111 round_trippers.go:390] Request Headers:
I1018 12:26:16.691861 10111 round_trippers.go:393] User-Agent: kubectl/v1.10.1 (linux/amd64) kubernetes/d4ab475
I1018 12:26:16.691864 10111 round_trippers.go:393] Content-Type: application/json
I1018 12:26:16.691866 10111 round_trippers.go:393] Accept: application/json
I1018 12:26:16.924556 10111 round_trippers.go:408] Response Status: 202 Accepted in 232 milliseconds
I1018 12:26:16.924592 10111 round_trippers.go:411] Response Headers:
I1018 12:26:16.924599 10111 round_trippers.go:414] Content-Type: application/json
I1018 12:26:16.924604 10111 round_trippers.go:414] Content-Length: 344
I1018 12:26:16.924609 10111 round_trippers.go:414] Date: Thu, 18 Oct 2018 10:26:16 GMT
I1018 12:26:16.924643 10111 request.go:874] Response Body: {"kind":"Namespace","apiVersion":"v1","metadata":{"name":"aafs-dxbd85","selfLink":"/api/v1/namespaces/aafs-dxbd85","uid":"19326fb3-d2bd-11e8-97ef-fa163e607805","resourceVersion":"77243","creationTimestamp":"2018-10-18T10:03:44Z","deletionTimestamp":"2018-10-18T10:26:16Z"},"spec":{"finalizers":["kubernetes"]},"status":{"phase":"Terminating"}}
The status field should be a string of either "Success" or "Failure" according to docs + swagger spec, but it's actually an object status":{"phase":"Terminating"}
.
What you expected to happen:
The status
field should be a string.
How to reproduce it (as minimally and precisely as possible):
Create a namespace, delete it, observe status field content in output
kubectl create namespace aafs-dxbd85
kubectl --v 8 delete namespace aafs-dxbd85
Anything else we need to know?:
Environment:
- Kubernetes version (use
kubectl version
): server 1.11.3, client 1.10.1 - Install tools: RKE