fix ExecCredentialResponse deserializion in aot (#1643)
* Add ExecCredentialResponseContext for JSON serialization support * Added ExecStatus JsonPropertyNames
This commit is contained in:
@@ -8,9 +8,13 @@ namespace k8s.KubeConfigModels
|
||||
public class ExecStatus
|
||||
{
|
||||
#nullable enable
|
||||
[JsonPropertyName("expirationTimestamp")]
|
||||
public DateTime? ExpirationTimestamp { get; set; }
|
||||
[JsonPropertyName("token")]
|
||||
public string? Token { get; set; }
|
||||
[JsonPropertyName("clientCertificateData")]
|
||||
public string? ClientCertificateData { get; set; }
|
||||
[JsonPropertyName("clientKeyData")]
|
||||
public string? ClientKeyData { get; set; }
|
||||
#nullable disable
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace k8s.KubeConfigModels
|
||||
{
|
||||
[JsonSerializable(typeof(ExecCredentialResponse))]
|
||||
internal partial class ExecCredentialResponseContext : JsonSerializerContext
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -523,7 +523,10 @@ namespace k8s
|
||||
throw new KubeConfigException("external exec failed due to timeout");
|
||||
}
|
||||
|
||||
var responseObject = KubernetesJson.Deserialize<ExecCredentialResponse>(process.StandardOutput.ReadToEnd());
|
||||
var responseObject = JsonSerializer.Deserialize(
|
||||
process.StandardOutput.ReadToEnd(),
|
||||
ExecCredentialResponseContext.Default.ExecCredentialResponse);
|
||||
|
||||
if (responseObject == null || responseObject.ApiVersion != config.ApiVersion)
|
||||
{
|
||||
throw new KubeConfigException(
|
||||
|
||||
Reference in New Issue
Block a user