Issue with PatchDeployment Using Kubernetes Client in C# After Upgrade #1607
-
| Issue with  | 
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
| see #772 | 
Beta Was this translation helpful? Give feedback.
-
| Thanks for the reply. I’ve been trying to patch a Kubernetes deployment using a JSON patch approach provided in mentioned discussion section, but I keep running into this error: Let me know which one of the below approach I should go for. What I’ve Tried
 
 | 
Beta Was this translation helpful? Give feedback.
-
| Issue Resolved: Using Manual PatchOperations Instead of JsonPatchDocumentHi all, Solution: Manual PatchOperationsvar patchOperations = new List<object>
       {
           new
           {
               op = "replace",
               path = "/spec",
               value = serviceSpec.Spec
           }
       };
var jsonPatch = System.Text.Json.JsonSerializer.Serialize(patchOperations); // Serialize the patch
var updateData = new V1Patch(jsonPatch, V1Patch.PatchType.JsonPatch); // Wrap into V1Patch
logger.LogInfoLine($"Patch content: {jsonPatch}"); // Log for debugging | 
Beta Was this translation helpful? Give feedback.
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
JsonPatchDocumentapproach. Instead, I implemented manual patch operations using aList<object>and serialized it into a JSON Patch. This method avoids the additional complexities and dependencies on theJsonPatchpackage.Solution: Manual PatchOperations