Repository navigation
Closed
Description
Describe the bug
Than you for your work ont this library about kubernetes :)
We would like to activate .NET 8 AOT on SlimFaas which is also an open source project.
Compilation work, but execution crash on that line : https://github.com/AxaFrance/SlimFaas/blob/5c5a1f39ae3b0e6bee8a8cdf27ec85f95607b404/src/SlimFaas/Kubernetes/KubernetesService.cs#L66
--- End of stack trace from previous location ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x1c
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task) + 0xbe
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task, ConfigureAwaitOptions) + 0x4e
at k8s.AbstractKubernetes.<IAppsV1Operations_ListNamespacedDeploymentWithHttpMessagesAsync>d__606`1.MoveNext() + 0x664
...
System.InvalidOperationException: JsonSerializerOptions instance must specify a TypeInfoResolver setting before being marked as read-only.
at System.Text.Json.ThrowHelper.ThrowInvalidOperationException_JsonSerializerOptionsNoTypeInfoResolverSpecified() + 0x27
at System.Text.Json.JsonSerializerOptions.ConfigureForJsonSerializer() + 0x20
at System.Text.Json.JsonSerializer.GetTypeInfo(JsonSerializerOptions, Type) + 0x2d
at System.Text.Json.JsonSerializer.GetTypeInfo[T](JsonSerializerOptions) + 0x2b
at System.Text.Json.JsonSerializer.Deserialize[TValue](Stream, JsonSerializerOptions) + 0x1f
at k8s.Kubernetes.<CreateResultAsync>d__46`1.MoveNext() + 0x249
The SlimFaas PullRequest : SlimPlanet/SlimFaas#23
Kubernetes C# SDK Client Version
<PackageReference Include="KubernetesClient" Version="12.0.16" />Dotnet Runtime Version
8.0.100-preview.7.23376.3
To Reproduce
Build an AOT program which use this function : https://github.com/AxaFrance/SlimFaas/blob/5c5a1f39ae3b0e6bee8a8cdf27ec85f95607b404/src/SlimFaas/Kubernetes/KubernetesService.cs#L66
Expected behavior
Does not crash once compile with AOT
### Tasks
- [ ] https://github.com/kubernetes-client/csharp/pull/1417
Metadata
Metadata
Assignees
Labels
No labels
Activity
IvanJosipovic commentedon Sep 7, 2023
This looks to be related to #1311
tg123 commentedon Sep 7, 2023
AOT will be supported for sure
[-].NET 8 and OAT compatibility[/-][+].NET 8 and AOT compatibility[/+]guillaume-chervet commentedon Sep 12, 2023
Can't wait for it 😜 it would be awesome!
tg123 commentedon Sep 14, 2023
PR is also welcomed,
m3nax commentedon Nov 24, 2023
related #1463
tg123 commentedon Dec 14, 2023
hi @guillaume-chervet here is a draft version of aot
too many warnings and many things need to be fixed
but first working code
https://github.com/tg123/csharp/tree/aotfinal/examples/aot
~20M binary
your input is welcomed, i am still working on cleaning things up
guillaume-chervet commentedon Dec 15, 2023
Hi @tg123 thank you very much! Is it possible to publish alpha version? I need at least a working trimming mode. AOT will be the next step.
tg123 commentedon Dec 18, 2023
seems too many lib to cleanu, i am thinking add a
Kubenetesclient.AOTfor aot onlywhy do you want trim only? btw
guillaume-chervet commentedon Dec 18, 2023
AOT will be very fine, but Trimming for à first step will be Nice. This discution is interresting dotnet/dotNext#200 (comment)
guillaume-chervet commentedon Jan 3, 2024
Hi @tg123 are your still working on this?
I really need to activate trimming and better will be AOT for Slimfaas :
https://github.com/AxaFrance/SlimFaas
I may be will have more time if you need some help.
tg123 commentedon Jan 3, 2024
yup please allow more time on this
guillaume-chervet commentedon Jan 30, 2024
hi @tg123 ,
Thank you s much for your work.
Is it possible to publish a beta of KubernetesClient.Aot ?
in order to be able to test it :)
guillaume-chervet commentedon Feb 2, 2024
I have tested it @tg123 ,
List deployments and statefulset works well. For the moment I Have activated Trimming mode (I will test AOT after having a working trimmin mode).
When try to scale down for example It crash.
The code :

Do you hav e an idea @tg123 ?
tg123 commentedon Feb 2, 2024
patch is not supported in aot yet
guillaume-chervet commentedon Feb 2, 2024
Hi @tg123 ,
Do you think it will be very soon ?

My Image shrink a lot just with Timming. I Can't wait to see used ram in production in trimming mode or AOT :)
https://github.com/AxaFrance/SlimFaas
tg123 commentedon Feb 2, 2024
i am working on watch
but let me see if i can make patch aot first
guillaume-chervet commentedon Feb 2, 2024
@tg123 Thank you,
patch aot first would be awesome :)