I'm using the python kubernetes client to control deployment of resources. I'd like to poll the status of multiple resources at once to provide near-realtime feedback on when a given set of resources is available. Right now I have to query each resources individually, which seems excessive on a system where each set of resources scales by N users (so if there are 6 resources there would be N(6) requests for a status check).
Is there way to query the API and get the status of all resources that match a given label selector? If not, is there another approach I should consider?
I started out by seeing how
kubectl
does it, because at high enough verbosity levels, it shows the actual underlying HTTP transactions:seems to issue two separate
GET
calls, so I believe it is just putting them in flight concurrently and then awaiting the threads.As for the other half of your question,
does the same thing as the CSV version, but instead appears to do something akin to
kubectl api-resources
(or maybe has a hard-coded list of what it considersall
?) and then does the same thing: putting multipleGET
in flight and awaiting the threadsYou may be interested in exploring how
kubectl rollout status
operates, to see if that might help you. I also tried adding--watch
to theget all
and was informed: