Hi I am following this doc https://github.com/kubernetes/kubernetes/blob/master/docs/devel/api-conventions.md#strategic-merge-patch for strategic-merge-patch to partially update the JSON objects using PATCH REST API. The document says that it can add or delete the object, but I have tried, whenever I add new object to existing JSON it just replaces that instead of adding new. I am trying this to modify pod definition in OpenShift 3.2. can anyone please help me how it works, probably with example. I need to use delete operation also , where I can delete the value by name.
kubernetes strategic merge patch
Asked Answered
Can you provide example JSON files? –
Roark
Please provide the JSON files you are trying to PATCH. It's easier to help or let you know where you are going wrong. :) –
Mantling
As documented it depends on annotations of the types. AFAIS the strategic merge only works if patchStrategy
and patchMergeKey
are given. For example, this is the case in pod.spec.containers
and pod.spec.volumes
.
For an example you need to provide more information about the type you want to merge.
Where is it "documented"? Been looking several hours for such documentation and found 0 documentation on that. All there is, is the extremely terse "documentation" (if you can call those explanations that feel like 2 half-assed sentences that) on strategic merge patches in general. I am trying to add a volume to an existing deployment through a strategic merge patch and it just won't work. How are the elements you mentioned to be adjusted for the patch to work in the explained scenario? –
Merovingian
Probably this can help someone: #71165668 –
Muse
This is documented here github.com/kubernetes/community/blob/master/contributors/devel/… –
Togo
© 2022 - 2025 — McMap. All rights reserved.