-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create generic objects from manifest files #91
Comments
The loading from manifests and marshaling into the Kubernetes types largely happens in https://github.com/vapor-ware/kubetest/blob/master/kubetest/manifest.py and is exposed through the object wrapper base class in the load method kubetest/kubetest/objects/api_object.py Line 205 in 924075a
It is kept fairly generic, so it should work for object wrappers that kubetest defines. Unfortunately, I haven't found a good way of automatically wrapping objects/having a fallback to do basic wrapping around objects that don't have explicit wrappers defined. The thought we had was that as support for more objects were needed, they could be added either by us or contributors. You are welcome to open a PR with any additional object wrapper support, or open an issue for any additional objects and we can work on adding them. |
So I think this is a feature that I'm after. We're using istio within our k8s cluster, which defines some additional resources. While I can add these locally (and in this case it may be desirable to add some convenience methods), I don't think it would be reasonable of me to upstream these into kubetest. Do you have any ideas for how to approach the generic wrapping of k8s api objects? This might be closely related to #158 |
I've been thinking about this on and off since this issue was opened and haven't really come up with anything that I think is particularly great. I think the best that could be done is to some sort of generic object (whether thats a new I think thats basically as far as things can go in terms of generic objects though (in the current implementation of kubetest). It should fulfill the requirement of being able to load from manifest, but thats pretty much it. I don't see any straightforward path for adding in any sort of generic utility functions for these generic objects (e.g. refresh/get, wait, delete, ...) because AFAIK, you need to know what the object is in order to interact with it (e.g. That said, this feature does seem useful and generally necessary for this project to remain broadly useful and maintainable, so I think that it is going to be the core of v1 development. I'll probably start work on a development branch to try some things out around this, but generally speaking, I think this can be accomplished by trying to auto-determine the python API calls based on the object type of the api object. I doubt I can get it to work for all API objects initially, but I do think that it should work for the majority of them, and any common outliers could be implemented more manually. So I guess the TL;DR here is that:
I'm more than happy to discuss any ideas you may have or any other use cases/features/etc you can think of that would be useful to include in v1 |
Just being able to load it from a manifest would definitely help in our case, particularly if we could then access any properties on the deployed api object by treating the object like a dict. With the way the code is currently structured (relying on the swagger generated clients/models) it isn't entirely clear to me how you would go about handling objects that are under custom resources and therefore can't have generated swagger api clients included unless they're generated somehow. |
Currently the
create
method support creating resources from python objects, but how can I create objects from manifest files? There is support for wrappers for some objects, but not for everything (service account, cluster role, CRD etc). How can I create them?The text was updated successfully, but these errors were encountered: