python
python copied to clipboard
Allow utils.create_from_yaml to use server side apply
What is the feature and why do you need it:
Currently utils.create_from_yaml
will only create resources. If the resource already exists then it throws an error.
Describe the solution you'd like to see:
We could add an apply
parameter to the functions in the utils class. If we provide a default value of False
to that parameter, it shouldn't break any existing behavior, but if apply=True
is passed in then utils could use a dynamic client and use the server_side_apply
function. This would allow applying yaml manifests directly even if the resources already exist.
I currently have a working model locally and would be willing to contribute a patch for this if it seems like a good approach to y'all.
A similar approach was discussed in https://github.com/kubernetes-client/python/issues/1168, but it seems it never landed.