-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Show how to use serverSideApply() properly #6780
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
Comments
For example, given this monstrocity:
how would I use a |
Always apply the whole thing and let the server figure it out. No need to think of it as selectively updating fields. |
Are you saying that the following pattern is correct?
I just realized that my example is a poor one because Thanks. |
No if / else, just serverSideApply. |
Okay, thank you. Please consider linking to sample code near the section I referenced in the FAQ. |
If possible please open a PR. |
Normally I would just add a link to https://github.com/fabric8io/kubernetes-client/blob/main/doc/CHEATSHEET.md#server-side-apply but it doesn't make direct use of the client.pods().inNamespace("default").resource(pod).serverSideApply(); which is more of what I would expect. Is there a reason that https://github.com/fabric8io/kubernetes-client/blob/main/doc/CHEATSHEET.md#server-side-apply advocates the use of |
That doc probably pre-dates when the first class method was added. |
Hi @cowwoc |
@manusa I just created #6784 but I've got a question regarding editing https://github.com/fabric8io/kubernetes-client/blob/13b390964ccd813926895af43f4e9ea82f98ffef/doc/FAQ.md There is a note that says:
and later:
Do these concerns still hold with the new https://github.com/fabric8io/kubernetes-client/blob/13b390964ccd813926895af43f4e9ea82f98ffef/doc/FAQ.md might require a bigger cleanup than I am comfortable applying by myself. Are you able to contribute on this front? |
What is meant here is doing something like:
That is probably not what you want to do. Rather than trying to remove everything you aren't responsible for, instead supply only the desired state known to the current owner - even if that looks like building the same resource from scratch every time. This is known as reconstructive usage of SSA in the context of operators: https://kubernetes.io/blog/2022/10/20/advanced-server-side-apply/#reconstructive-controllers
We can continue to collaborate here or on a PR if that works for you. |
I pushed a second PR for the FAQ.md Once merged, I believe we can close this issue. Thank you for your help. |
Is your enhancement related to a problem? Please describe
https://github.com/fabric8io/kubernetes-client/blob/13b390964ccd813926895af43f4e9ea82f98ffef/doc/FAQ.md reads:
I don't understand what is meant in that last sentence...
Describe the solution you'd like
Please provide a short example along the lines of:
Say you want to update X to Y, instead of doing:
do this:
Either provide this inline in the FAQ or link to it from this paragraph. Thank you in advance.
The text was updated successfully, but these errors were encountered: