-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
kubectl create -f <yaml file> #504
Comments
The easiest is load the yaml file and use it as body to a specific method, see: https://github.com/kubernetes-client/python/blob/master/examples/create_deployment.py |
Ah, I see that makes a lot of sense thanks. |
I will bump this issue - any method that would accept raw datastructure rather than create_namespaced_deployment? My use case is to create multiple resources of different types in same loop. Think of trying example @sebgoa mentioned, but where https://github.com/kubernetes-client/python/blob/master/examples/nginx-deployment.yaml will have more resources (like Namespace or Service) |
+1 I wonder what is beneath the create_namespaced_* calls. Where can we see the source of these calls? |
I think at this point the easiest thing to do is just to use |
I cannot really believe this functionality is not there. So strange. |
I think the purpose of kubernetes-client is to give access to APIs in as flexible a way as possible, not duplicate kubectl. Perhaps higher level functionality like this issue describes would make more sense in a separate library that wraps kubernetes-client. |
I don't understand the discussion actually. You can create any object with the python client, you just need to find the correct method for it. what |
Exactly, there is a bit of this magic: parsing of YAML files, going over each object in them, determining which type it is, and then calling the appropriate create method. This would be great to have here in Python interface. |
I created an application with the idea of using a yaml template to specify values that need to be changed, passing directly to the dictionary that was created in the past |
I'll take a crack at it. |
/assign @micw523 |
@roycaihw: GitHub didn't allow me to assign the following users: micw523. Note that only kubernetes-client members and repo collaborators can be assigned. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
I'm not sure how different |
@nakulpathak3 I think using "apply" is a separate feature and could be possibly filed as another issue. Although, I don't think the implementation would be too different from what I have in #655 ... |
Please try out #655 (already merged in Master). This functionality is not perfect yet, subject to an existing issue #376 such as when you need to create a CRD, and it is not able to create lists #671. Otherwise please file complaints here and I’ll tend to it. Apply would require an internal diff and I’ll see if the repo owners are interested in rolling out this function before I test the waters. |
Is |
I'm interested in the Kubernetes server-side apply feature, which has more capability than client-side (kubectl) apply. Hopefully that feature will rollout in 1.13 as alpha and we can try it out using the python client. The original feature requested by this issue (create -f) has been added. Closing this issue now /close |
@roycaihw: Closing this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Just another point of view to complement the discussion, having the Python client execute YAML files enables the versioning of said YAML files, separate from the script code. That is in itself very useful, at least for me :) It's wasn't about replicating kubectl per se... |
|
Hey team,
Firstly, I absolutely love the Python client.
That said, I'm running into an issue with how to use the Python client to emulate the behavior from the command line, specifically
kubectl create -f <yaml file>
Is there a way that I can accomplish this currently?
Regards,
Vivek
The text was updated successfully, but these errors were encountered: