Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node list api serde error in Kind:v0.7.0 #216

Closed
kobeHub opened this issue Apr 5, 2020 · 6 comments
Closed

Node list api serde error in Kind:v0.7.0 #216

kobeHub opened this issue Apr 5, 2020 · 6 comments
Labels
bug Something isn't working wontfix This is unlikely to be worked on

Comments

@kobeHub
Copy link

kobeHub commented Apr 5, 2020

Environment:

kind: v0.7.0
k8s: 1.15.3
kube-rs: 0.31.0
k8s-openapi: 0.7.1

I use a single node kind cluster as local environment, the following code causes error:

let nodes: Api<Node> = Api::all(Client::infer().await?);
let results = nodes
        .list(&ListParams::default())
        .await?
        .iter()
        .map(Meta::name)
        .collect();

Get serde Error:

Error("invalid type: null, expected a sequence", line: 1, column: 3486)

logs

2020-04-05T03:49:54Z WARN  kube::client] {"kind":"NodeList","apiVersion":"v1","metadata":{"selfLink":"/api/v1/nodes","resourceVersion":"12539"},"items":[{"metadata":{"name":"kind-control-plane","selfLink":"/api/v1/nodes/kind-control-plane","uid":"8c84c270-d2ff-415d-83a7-eded09fd137e","resourceVersion":"12529","creationTimestamp":"2020-04-05T01:17:00Z","labels":{"beta.kubernetes.io/arch":"amd64","beta.kubernetes.io/os":"linux","ingress-ready":"true","kubernetes.io/arch":"amd64","kubernetes.io/hostname":"kind-control-plane","kubernetes.io/os":"linux","node-role.kubernetes.io/master":"","node-spot":"false","pegasus-role":"master"},"annotations":{"kubeadm.alpha.kubernetes.io/cri-socket":"/run/containerd/containerd.sock","node.alpha.kubernetes.io/ttl":"0","volumes.kubernetes.io/controller-managed-attach-detach":"true"}},"spec":{"podCIDR":"10.244.0.0/24"},"status":{"capacity":{"cpu":"4","ephemeral-storage":"205898728Ki","hugepages-1Gi":"0","hugepages-2Mi":"0","memory":"16312828Ki","pods":"110"},"allocatable":{"cpu":"4","ephemeral-storage":"205898728Ki","hugepages-1Gi":"0","hugepages-2Mi":"0","memory":"16312828Ki","pods":"110"},"conditions":[{"type":"MemoryPressure","status":"False","lastHeartbeatTime":"2020-04-05T03:49:46Z","lastTransitionTime":"2020-04-05T01:16:59Z","reason":"KubeletHasSufficientMemory","message":"kubelet has sufficient memory available"},{"type":"DiskPressure","status":"False","lastHeartbeatTime":"2020-04-05T03:49:46Z","lastTransitionTime":"2020-04-05T01:16:59Z","reason":"KubeletHasNoDiskPressure","message":"kubelet has no disk pressure"},{"type":"PIDPressure","status":"False","lastHeartbeatTime":"2020-04-05T03:49:46Z","lastTransitionTime":"2020-04-05T01:16:59Z","reason":"KubeletHasSufficientPID","message":"kubelet has sufficient PID available"},{"type":"Ready","status":"True","lastHeartbeatTime":"2020-04-05T03:49:46Z","lastTransitionTime":"2020-04-05T01:17:41Z","reason":"KubeletReady","message":"kubelet is posting ready status"}],"addresses":[{"type":"InternalIP","address":"172.17.0.2"},{"type":"Hostname","address":"kind-control-plane"}],"daemonEndpoints":{"kubeletEndpoint":{"Port":10250}},"nodeInfo":{"machineID":"201e9baad1e34912b0ad4502f7065edf","systemUUID":"36444335-3433-3430-4c38-98e7f44befb9","bootID":"10ff4f34-8088-4e6a-8d52-7e326f20de05","kernelVersion":"4.19.113-1-MANJARO","osImage":"Ubuntu Disco Dingo (development branch)","containerRuntimeVersion":"containerd://1.2.6-0ubuntu1","kubeletVersion":"v1.15.3","kubeProxyVersion":"v1.15.3","operatingSystem":"linux","architecture":"amd64"},"images":[{"names":["k8s.gcr.io/etcd:3.3.10"],"sizeBytes":258352475},{"names":["k8s.gcr.io/kube-apiserver:v1.15.3"],"sizeBytes":249032413},{"names":["docker.io/grafana/grafana@sha256:4282e80b18bb148dcc9745a337c7008d4c8397b369933cfb4e66d15f363d1818","docker.io/grafana/grafana:6.6.2"],"sizeBytes":238135891},{"names":["k8s.gcr.io/kube-controller-manager:v1.15.3"],"sizeBytes":199826159},{"names":["quay.io/kubernetes-ingress-controller/nginx-ingress-controller@sha256:b312c91d0de688a21075078982b5e3a48b13b46eda4df743317d3059fc3ca0d9","quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.30.0"],"sizeBytes":114165218},{"names":["k8s.gcr.io/kube-proxy:v1.15.3"],"sizeBytes":97345619},{"names":["k8s.gcr.io/kube-scheduler:v1.15.3"],"sizeBytes":96545500},{"names":["docker.io/kindest/kindnetd:0.5.0"],"sizeBytes":83630307},{"names":["k8s.gcr.io/coredns:1.3.1"],"sizeBytes":40532361},{"names":["quay.io/prometheus/prometheus:v2.4.3"],"sizeBytes":36710876},{"names":null,"sizeBytes":22167426},{"names":["quay.io/coreos/prometheus-operator@sha256:cf808807d756ba15d48c343b2f55dfabb06dff77ba0121fc2e697eec677fa574","quay.io/coreos/prometheus-operator:v0.38.0"],"sizeBytes":11334368},{"names":["quay.io/coreos/kube-rbac-proxy:v0.3.1"],"sizeBytes":11012194},{"names":["gcr.io/google-samples/hello-app:1.0"],"sizeBytes":10119109},{"names":["quay.io/coreos/addon-resizer:1.0"],"sizeBytes":8471728},{"names":["quay.io/prometheus/node-exporter:v0.16.0"],"sizeBytes":8289635},{"names":["quay.io/coreos/kube-state-metrics:v1.3.1"],"sizeBytes":6782843},{"names":["quay.io/coreos/prometheus-config-reloader@sha256:c1faf05c9d6c39df8f319ff870740b4c77bb02995989859856d1c00a2b9aa015","quay.io/coreos/prometheus-config-reloader:v0.38.0"],"sizeBytes":4247500},{"names":["docker.io/jimmidyson/configmap-reload@sha256:d107c7a235c266273b1c3502a391fec374430e5625539403d0de797fa9c556a2","docker.io/jimmidyson/configmap-reload:v0.3.0"],"sizeBytes":4063371},{"names":["k8s.gcr.io/pause:3.1"],"sizeBytes":746400}]}}]}
    , Error("invalid type: null, expected a sequence", line: 1, column: 3486)

How to fix it?

@clux
Copy link
Member

clux commented Apr 5, 2020

That might be a bug in kind.

The error is from {"names":null,"sizeBytes":22167426} under images, and these are not optional in k8s_openapi::api::core::v1::ContainerImage. Not sure how kind has injected a null there. Not sure if they are doing something dodgy or not.

This can probably also be fixed upstream in k8s-openapi by adding a #[serde(default)] annotation to the field.

I cannot do anything about it in here unfortunately.

@clux clux added bug Something isn't working wontfix This is unlikely to be worked on labels Apr 5, 2020
@kobeHub
Copy link
Author

kobeHub commented Apr 5, 2020

Appreciate for your reply, I will report the bug in kind.

@clux
Copy link
Member

clux commented Jun 15, 2020

Did you get to the bottom of this?

@clux
Copy link
Member

clux commented May 12, 2021

kubernetes bug for this in kubernetes/kubernetes#93606

@olix0r
Copy link
Contributor

olix0r commented May 20, 2021

More discussion here kubernetes/kubernetes#100802

It looks like a workaround was already implemented in k8s-openapi here.

I tried to use the git version of k8s-openapi with kube-rs v0.53.0 but I hit some build errors as it looks like the k8s-openapi api has changed. @clux Are you open to a PR that updates k8s-openapi in this repo?

@clux
Copy link
Member

clux commented May 20, 2021

Yes please! I believe master on k8s-openapi has a sizable Option-removal change which might break some examples, so a branch here would be appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working wontfix This is unlikely to be worked on
Projects
None yet
Development

No branches or pull requests

3 participants