-
Notifications
You must be signed in to change notification settings - Fork 308
Open
Description
Describe the bug
VersionOperationsExtensions.GetCodeAsync
throws an exception in AOT scenarios.
Kubernetes C# SDK Client Version
16.0.2
Server Kubernetes Version
1.26.1
Dotnet Runtime Version
net9
To Reproduce
Install KubernetesClient.Aot
, and then try to query the version information from Kubernetes:
var config = KubernetesClientConfiguration.BuildConfigFromConfigFile(configFile);
var kubernetes = new Kubernetes(config);
for (var i = 0; i < maximumWaitSeconds && !cancellationToken.IsCancellationRequested; i++)
{
try
{
var code = await kubernetes.Version.GetCodeAsync(cancellationToken);
_logger.LogInformation($"Connected to API server, Kubernetes is running version: {code.Major}.{code.Minor}");
return kubernetes;
}
catch (HttpRequestException ex)
{
_logger.LogWarning($"Failed to connect to Kubernetes API server; it might still be starting up: {ex}");
if (i < maximumWaitSeconds - 1)
{
await Task.Delay(1000, cancellationToken);
}
}
cancellationToken.ThrowIfCancellationRequested();
}
cancellationToken.ThrowIfCancellationRequested();
This results in the following exception:
System.ArgumentNullException: Value cannot be null. (Parameter 'jsonTypeInfo')
at System.Text.Json.ThrowHelper.ThrowArgumentNullException(String)
at System.Text.Json.JsonSerializer.Deserialize(Stream, JsonTypeInfo)
at k8s.KubernetesJson.Deserialize[TValue](Stream, JsonSerializerOptions )
at k8s.Kubernetes.CreateResultAsync[T](HttpRequestMessage, HttpResponseMessage, Nullable`1, CancellationToken)
at k8s.AbstractKubernetes.IVersionOperations_GetCodeWithHttpMessagesAsync[T](IReadOnlyDictionary`2, CancellationToken)
at k8s.AbstractKubernetes.k8s.IVersionOperations.GetCodeWithHttpMessagesAsync(IReadOnlyDictionary`2, CancellationToken)
at k8s.VersionOperationsExtensions.GetCodeAsync(IVersionOperations, CancellationToken )
at Redpoint.KubernetesManager.Services.DefaultKubernetesClientFactory.ConnectToClusterAsync(String, Int32, CancellationToken)
at Redpoint.KubernetesManager.Components.ControllerOnly.KubernetesClientComponent.OnStartedAsync(IContext context, IAssociatedData data, CancellationToken cancellationToken)
at Redpoint.KubernetesManager.Signalling.Executor.<>c__DisplayClass12_1.<<RaiseSignalAsync>b__1>d.MoveNext()
Expected behavior
AOT should work.
Metadata
Metadata
Assignees
Labels
No labels