Skip to content

Issue with PatchDeployment Using Kubernetes Client in C# After Upgrade #1607

Closed Answered by CleverFool77
CleverFool77 asked this question in Q&A
Discussion options

You must be logged in to vote

Issue Resolved: Using Manual PatchOperations Instead of JsonPatchDocument

Hi all,
I wanted to share an update that I’ve successfully resolved the issue by bypassing the JsonPatchDocument approach. Instead, I implemented manual patch operations using a List<object> and serialized it into a JSON Patch. This method avoids the additional complexities and dependencies on the JsonPatch package.

Solution: Manual PatchOperations

var patchOperations = new List<object>
       {
           new
           {
               op = "replace",
               path = "/spec",
               value = serviceSpec.Spec
           }
       };

var jsonPatch = System.Text.Json.JsonSerializer.Serialize(patchOperations

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by CleverFool77
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants