Closed csviri closed 4 years ago
I think you can try createOrReplace()
here is an example:
https://github.com/fabric8io/kubernetes-client/blob/a97aeb90b2c8f0a1e3623429d59101d98912f6e4/kubernetes-tests/src/test/java/io/fabric8/kubernetes/client/mock/TypedCustomResourceApiTest.java#L92-L94
We have a typeless api also with which you can use plain json/HashMap to deal with Custom Resources: https://github.com/fabric8io/kubernetes-client/blob/master/doc/CHEATSHEET.md#customresource-typeless-api
@rohanKanojia the createOrReplace
is what I want to avoid. Since its not a patch it can lead to "lost update problem" if I don't use optimistic locking (i.e. lock version) - what I want to also avoid here.
(Also note that, kubernetes api supports https://tools.ietf.org/html/rfc6902, which I need to use in this case since want to do additive operation on a list)
But will check the typeless api, thank you for now!
This issue has been automatically marked as stale because it has not had any activity since 90 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions!
@csviri have you managed to figure out how to safely patch using this library?
@janotav no. (We took other appraoch for unrelated reasons.)
Hi, I would like to add / delete some attributes using patch on custom resources. However its not clear to me how this should work using current API. (In my case I would like to add a finalizer)
This is the API I try to use
I assume this should be then a merge patch like defined here: https://kubernetes.io/docs/tasks/run-application/update-api-object-kubectl-patch/#use-a-json-merge-patch-to-update-a-deployment
And in this RFC: https://tools.ietf.org/html/rfc7386
Does this mean that I should only set values that will be added / altered in the custom resource POJO? And other values should be null? But then how should I delete a field?
Thanks!
(also Is there a way to use similar to Json-P ?)