Arnavion / k8s-openapi

Rust definitions of the resource types in the Kubernetes client API
Apache License 2.0
379 stars 41 forks source link

Listing pods does not list pods that are currently terminating? #74

Closed emilyaherbert closed 4 years ago

emilyaherbert commented 4 years ago

Hello. I am writing an application that requires me to wait until pods have finished terminating, and I am planning to use a loop to pull a list of pods (by label) and exit once there are no pods remaining.

However, it seems that when listing pods, pods that are currently terminating do not show up. Is there some way to do this?

I am using kube::api::typed::Api<kube::api::resource::Object<k8s_openapi::v1_17::api::core::v1::pod_spec::PodSpec, k8s_openapi::v1_17::api::core::v1::pod_status::PodStatus>> .list() with a ListParams object.

Arnavion commented 4 years ago

Issues with kube need to be reported at https://github.com/clux/kube-rs/issues

That said, what you see is presumably due to what is explained in https://github.com/kubernetes/kubectl/issues/450#issuecomment-446259960 and its follow-up comment. That is, terminating pods have status.phase as Some("Running"), and you're expected to look at their .metadata.deletion_timestamp being Some(...) to deduce that they're terminating. See kubectl's source doing this same thing here.

emilyaherbert commented 4 years ago

Hmm, I think it might be something else going on. .list() doesn't find the terminating pods at all. There is no metatdata to look at. Thanks though, I'll open an issue there.