Tested on a cluster with spot nodes, which causes the
kubecost-cost-analyzer pod to occasionally die in a Completed state,
which cannot serve requests. This change makes kubectl-cost
work correctly in that environment.
How does this PR impact users? (This is the kind of thing that goes in release notes!)
kubectl cost will only port-forward to Pods in a Ready state. Previously, kubectl cost could fail with a panic if the first cost-analyzer pod listed by the equivalent of kubectl get pods was in a non-Ready state (like Error or Completed).
How was this PR tested?
Against a cluster with cost-analyzer pods in a Completed state. Before the change, kubectl cost panicked. Afterward, it functions correctly.
What does this PR change?
Tested on a cluster with spot nodes, which causes the kubecost-cost-analyzer pod to occasionally die in a Completed state, which cannot serve requests. This change makes kubectl-cost work correctly in that environment.
How does this PR impact users? (This is the kind of thing that goes in release notes!)
kubectl get pods
was in a non-Ready state (like Error or Completed).How was this PR tested?
Against a cluster with cost-analyzer pods in a Completed state. Before the change,
kubectl cost
panicked. Afterward, it functions correctly.