What is the feature and why do you need it:
Working with Istio I create new resources through the command line and not by code. The custom resource name is serviceentries. With kubectl you would do:
kubectl get serviceentries
Apparently it is not possible to get custom resources if they are not created by the python client itself. Don't if this is 100% sure, but I haven't seen a simple solution for this.
Describe the solution you'd like to see:
Would be cool if we can do something like this:
api.list_custom_resources_for_all_namespaces(resource="serviceentries")
@djamaile you should be able to get your custom resources using the python client like this:
kubernetes.client.CustomObjectsApi().list_cluster_custom_object(group=<group>, version=<version>, plural=<plural>)
So for example if you have a custom resource named my-resources.example.com which serves version v1alpha1, you would run:
kubernetes.client.CustomObjectsApi().list_cluster_custom_object(group="example.com", version="v1alpha1", plural="my-resources")
Give that a try and let us know if that worked 馃槃
Oh it worked! I asked this question on stackoverflow and someone told me that it is not possible. Here is the question: https://stackoverflow.com/questions/61594447/python-kubernetes-client-equivalent-of-kubectl-get-custom-resource/61594809#61594809
Maybe I worded it wrong? Either way you can give an answer there and i'll accept it or update the question with my own answer. Thanks!
Thanks for pointing that out!
I'll share my answer there as well, feel free to mark it as the working solution 馃槃
Glad to help!!
Most helpful comment
Oh it worked! I asked this question on stackoverflow and someone told me that it is not possible. Here is the question: https://stackoverflow.com/questions/61594447/python-kubernetes-client-equivalent-of-kubectl-get-custom-resource/61594809#61594809
Maybe I worded it wrong? Either way you can give an answer there and i'll accept it or update the question with my own answer. Thanks!