kubernetes-client / csharp

Officially supported dotnet Kubernetes Client library
Apache License 2.0
1.1k stars 296 forks source link

`KubernetesClientConfiguration.JsonSerializerOptions` always returns null. #1598

Open davidivkovic opened 4 days ago

davidivkovic commented 4 days ago

Describe the bug KubernetesClientConfiguration.JsonSerializerOptions always returns null.

The getter for this property calls the KubernetesJson.AddJsonOptions method which is empty.

https://github.com/kubernetes-client/csharp/blob/61e6b13fd7828eb3d76b249b259b3444b0462564/src/KubernetesClient/KubernetesClientConfiguration.cs#L122-L139

https://github.com/kubernetes-client/csharp/blob/61e6b13fd7828eb3d76b249b259b3444b0462564/src/KubernetesClient.Aot/KubernetesJson.cs#L76-L78

Kubernetes C# SDK Client Version KubernetesClient.Aot 15.0.1

Server Kubernetes Version 1.30.2

Dotnet Runtime Version .net9

To Reproduce Create a KubernetesClientConfiguration and call the JsonSerializerOptions property.

Expected behavior A System.Text.Json.JsonSerializerOptions instance to be returned.

Where do you run your app with Kubernetes SDK (please complete the following information): Linux

tg123 commented 4 days ago

aot should not expose this prop as you can't config it

davidivkovic commented 4 days ago

Is it possible to register a serializer context for custom types used with client.CustomObjects.CreateNamespacedCustomObjectWithHttpMessagesAsync(customObject)?

tg123 commented 4 days ago

it is not possible in aot everything is compiled ahead of time, no dynamic code allowed in this mode

if the main sdk good for you, aot is for performance scenarios only

davidivkovic commented 4 days ago

So it's currently not possible to use the CreateNamespacedCustomObject method in AOT?