Closed
Description
Repro code, Cause and Workaround
using System;
using k8s;
using k8s.Models;
using Microsoft.AspNetCore.JsonPatch;
namespace patch
{
internal class Program
{
private static void Main(string[] args)
{
var config = KubernetesClientConfiguration.BuildConfigFromConfigFile();
IKubernetes client = new Kubernetes(config);
Console.WriteLine("Starting Request!");
var patch = new JsonPatchDocument<V1HorizontalPodAutoscaler>();
patch.Replace(h => h.Spec.MinReplicas, 10);
// Root cause, Path does not honor JsonProperty. so, it would be /spec/minreplicas
Console.WriteLine(patch.Operations[0].path);
// Workaround
patch.Operations[0].path = "/spec/minReplicas";
var name = "<target-hpa>";
var result = client.PatchNamespacedHorizontalPodAutoscaler(new V1Patch(patch), name, "default");
Console.WriteLine(result.Spec.MinReplicas);
}
}
}
- Latest
Microsoft.AspNetCore.JsonPatch
had been resolved this issue. - Will PR later.
Metadata
Metadata
Assignees
Labels
No labels