nforgeio / neonKUBE

Public NeonKUBE Kubernetes distribution related projects
https://neonkube.io
Apache License 2.0
76 stars 13 forks source link

Cluster setup failed: converter specified on 'Neon.Kube.Resources.Istio.CorsPolicy.AllowMethods' is not compatible #1874

Closed jefflill closed 6 months ago

jefflill commented 6 months ago

Cluster setup is failiung at:

*** ERROR: [System.InvalidOperationException]: The converter specified on 'Neon.Kube.Resources.Istio.CorsPolicy.AllowMethods' is not compatible with the type 'System.Collections.Generic.List`1[Neon.Kube.Resources.Istio.HTTPMethod]'.
*** STACK:
   at System.Text.Json.ThrowHelper.ThrowInvalidOperationException_SerializationConverterOnAttributeNotCompatible(Type classTypeAttributeIsOn, MemberInfo memberInfo, Type typeToConvert)
   at System.Text.Json.Serialization.Metadata.DefaultJsonTypeInfoResolver.GetConverterFromAttribute(JsonConverterAttribute converterAttribute, Type typeToConvert, MemberInfo memberInfo, JsonSerializerOptions options)
   at System.Text.Json.Serialization.Metadata.DefaultJsonTypeInfoResolver.CreatePropertyInfo(JsonTypeInfo typeInfo, Type typeToConvert, MemberInfo memberInfo, JsonSerializerOptions options, Boolean shouldCheckForRequiredKeyword, Boolean hasJsonIncludeAttribute)
   at System.Text.Json.Serialization.Metadata.DefaultJsonTypeInfoResolver.AddMembersDeclaredBySuperType(JsonTypeInfo typeInfo, Type currentType, Boolean constructorHasSetsRequiredMembersAttribute, PropertyHierarchyResolutionState& state)
   at System.Text.Json.Serialization.Metadata.DefaultJsonTypeInfoResolver.PopulateProperties(JsonTypeInfo typeInfo)
   at System.Text.Json.Serialization.Metadata.DefaultJsonTypeInfoResolver.CreateTypeInfoCore(Type type, JsonConverter converter, JsonSerializerOptions options)
   at System.Text.Json.Serialization.Metadata.DefaultJsonTypeInfoResolver.GetTypeInfo(Type type, JsonSerializerOptions options)
   at System.Text.Json.JsonSerializerOptions.CachingContext.CreateCacheEntry(Type type, CachingContext context)
--- End of stack trace from previous location ---
   at System.Text.Json.JsonSerializerOptions.GetTypeInfoInternal(Type type, Boolean ensureConfigured, Nullable`1 ensureNotNull, Boolean resolveIfMutable, Boolean fallBackToNearestAncestorType)
   at System.Text.Json.Serialization.Metadata.JsonPropertyInfo.Configure()
   at System.Text.Json.Serialization.Metadata.JsonTypeInfo.ConfigureProperties()
   at System.Text.Json.Serialization.Metadata.JsonTypeInfo.Configure()
   at System.Text.Json.Serialization.Metadata.JsonTypeInfo.<EnsureConfigured>g__ConfigureSynchronized|172_0()
   at System.Text.Json.JsonSerializerOptions.GetTypeInfoInternal(Type type, Boolean ensureConfigured, Nullable`1 ensureNotNull, Boolean resolveIfMutable, Boolean fallBackToNearestAncestorType)
   at System.Text.Json.Serialization.Metadata.JsonTypeInfo.Configure()
   at System.Text.Json.Serialization.Metadata.JsonTypeInfo.<EnsureConfigured>g__ConfigureSynchronized|172_0()
   at System.Text.Json.JsonSerializerOptions.GetTypeInfoInternal(Type type, Boolean ensureConfigured, Nullable`1 ensureNotNull, Boolean resolveIfMutable, Boolean fallBackToNearestAncestorType)
   at System.Text.Json.Serialization.Metadata.JsonPropertyInfo.Configure()
   at System.Text.Json.Serialization.Metadata.JsonTypeInfo.ConfigureProperties()
   at System.Text.Json.Serialization.Metadata.JsonTypeInfo.Configure()
   at System.Text.Json.Serialization.Metadata.JsonTypeInfo.<EnsureConfigured>g__ConfigureSynchronized|172_0()
   at System.Text.Json.JsonSerializerOptions.GetTypeInfoInternal(Type type, Boolean ensureConfigured, Nullable`1 ensureNotNull, Boolean resolveIfMutable, Boolean fallBackToNearestAncestorType)
   at System.Text.Json.Serialization.Metadata.JsonPropertyInfo.Configure()
   at System.Text.Json.Serialization.Metadata.JsonTypeInfo.ConfigureProperties()
   at System.Text.Json.Serialization.Metadata.JsonTypeInfo.Configure()
   at System.Text.Json.Serialization.Metadata.JsonTypeInfo.<EnsureConfigured>g__ConfigureSynchronized|172_0()
   at System.Text.Json.JsonSerializerOptions.GetTypeInfoInternal(Type type, Boolean ensureConfigured, Nullable`1 ensureNotNull, Boolean resolveIfMutable, Boolean fallBackToNearestAncestorType)
   at System.Text.Json.JsonSerializerOptions.TryGetPolymorphicTypeInfoForRootType(Object rootValue, JsonTypeInfo& polymorphicTypeInfo)
   at System.Text.Json.Serialization.Metadata.JsonTypeInfo`1.Serialize(Utf8JsonWriter writer, T& rootValue, Object rootValueBoxed)
   at System.Text.Json.JsonSerializer.WriteString[TValue](TValue& value, JsonTypeInfo`1 jsonTypeInfo)
   at k8s.Kubernetes.SendRequest[T](String relativeUri, HttpMethod method, IReadOnlyDictionary`2 customHeaders, T body, CancellationToken cancellationToken)
   at k8s.AbstractKubernetes.ICustomObjectsOperations_CreateNamespacedCustomObjectWithHttpMessagesAsync[T](Object body, String group, String version, String namespaceParameter, String plural, String dryRun, String fieldManager, Nullable`1 pretty, IReadOnlyDictionary`2 customHeaders, CancellationToken cancellationToken)
   at k8s.AbstractKubernetes.k8s.ICustomObjectsOperations.CreateNamespacedCustomObjectWithHttpMessagesAsync(Object body, String group, String version, String namespaceParameter, String plural, String dryRun, String fieldManager, Nullable`1 pretty, IReadOnlyDictionary`2 customHeaders, CancellationToken cancellationToken)
   at k8s.CustomObjectsOperationsExtensions.CreateNamespacedCustomObjectAsync(ICustomObjectsOperations operations, Object body, String group, String version, String namespaceParameter, String plural, String dryRun, String fieldManager, Nullable`1 pretty, CancellationToken cancellationToken)
   at Neon.Kube.K8s.KubernetesExtensions.CreateNamespacedCustomObjectAsync[T](ICustomObjectsOperations k8s, T body, String name, String namespaceParameter, String dryRun, String fieldManager, CancellationToken cancellationToken) in C:\src\neonKUBE\Lib\Neon.Kube\Kubernetes\KubernetesExtensions.NamespacedCustom.cs:line 458
   at Neon.Kube.K8s.KubernetesExtensions.UpsertNamespacedCustomObjectAsync[T](ICustomObjectsOperations k8s, T body, String name, String namespaceParameter, String dryRun, String fieldManager, CancellationToken cancellationToken) in C:\src\neonKUBE\Lib\Neon.Kube\Kubernetes\KubernetesExtensions.NamespacedCustom.cs:line 613
   at Neon.Kube.Setup.KubeSetup.<>c__DisplayClass127_0.<<ConfigureApiserverIngressAsync>b__2>d.MoveNext() in C:\src\neonKUBE\Lib\Neon.Kube.Setup\KubeSetup.Operations.cs:line 2418
--- End of stack trace from previous location ---
   at Neon.Kube.SSH.NodeSshProxy`1.InvokeIdempotentAsync(String actionId, Func`1 action) in C:\src\neonKUBE\Lib\Neon.Kube\SSH\NodeSshProxy.cs:line 513
   at Neon.Kube.Setup.KubeSetup.ConfigureApiserverIngressAsync(ISetupController controller, NodeSshProxy`1 controlNode) in C:\src\neonKUBE\Lib\Neon.Kube.Setup\KubeSetup.Operations.cs:line 2373
   at Neon.Kube.Setup.KubeSetup.<>c__DisplayClass114_0.<<SetupClusterAsync>b__1>d.MoveNext() in C:\src\neonKUBE\Lib\Neon.Kube.Setup\KubeSetup.Operations.cs:line 438
--- End of stack trace from previous location ---
   at Neon.Retry.LinearRetryPolicy.InvokeAsync(Func`1 action, CancellationToken cancellationToken) in C:\src\neonSDK\Lib\Neon.Common\Retry\LinearRetryPolicy.cs:line 245
jefflill commented 6 months ago

FIXED: This was a type conversion problem for the CoresPolicy.AllowMethods property. This has been defined as the List type and the converter was having trouble converting this into a List. I resolved this by just changing the property type to List.

jefflill commented 6 months ago

BETTER FIXED: Changed the property type to IEnumerable<HttpMethod>