Find API call to create object from yaml config
See original GitHub issueI have a yaml file containing configs that I would like to apply as kubectl apply -f my_file.yml
would. It is possible to pass configs loaded from yaml unmodified to API calls as discussed in https://github.com/kubernetes-incubator/client-python/issues/63 and illustrated in the create_deployment.py
example. However, if you have a collection of objects you have to figure out which call to make on which API version to apply each item of config, while the apiVersion
and kind
keys in the config, which carry this information, get ignored.
Is there any way to find the right API version object and function given the apiVersion
and kind
values other than to have a mapping in my own code? If not, would it be possible to add such a thing, and maybe generic create
and delete
calls that read those attributes from the body, thus behaving similarly to kubectl?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:24
- Comments:13 (3 by maintainers)
Top GitHub Comments
https://github.com/kubernetes/kubernetes/issues/73723
As this is the most requested feature in this repo by far I thought I nudge it to the top of the issues. (https://github.com/kubernetes-client/python/issues?q=is%3Aissue+is%3Aopen+sort%3Areactions-%2B1-desc) Does someone have a plan on how to implement this? pykube handles this by having a mapping: https://github.com/kelproject/pykube/blob/master/pykube/objects.py I guess kubectl also has this mapping internally? or does it create a list of possible objects and their endpoints each time by querying the server?