-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Openshift InvalidFormatException Cannot deserialize value for Kind Template #3460
Comments
Hello, I am having a similar issue. I am trying to load an object with the Run this test in
It fails with The same happens, when I try to deserialize a Templace containing an array |
The current logic seems to only support string value parameters. It will fail otherwise because it's using strongly typed instances when parsing the objects. @rohanKanojia @manusa the quickest change that I can think of here would be to change HasMetadata to GenericKubernetesResource:
There is logic in OpenShiftNamespaceVisitFromServerGetWatchDeleteRecreateWaitApplicableListImpl related to templates that would continue to work as far as I can tell. However it would be a breaking change for anyone manually constructing a Template. Is there a simple way to continue to use HasMetadata, but instead direct the deserialization to use GenericKubernetesResource as the instance type? Seems like it may require a new Deserializer. |
Discussed with @manusa an alternative that would somehow redirect the parser to use something like additionalProperties to track any value that doesn't parse. There are some possible facilities in jackson for this, such as a DeserializationProblemHandler implementing handleWeirdStringValue - but that can only change the value. It cannot redirect the value to additionalProperties as the context doesn't convey which field or the hierarchy at that point you are dealing with. There is also the issue that additionalProperties are not on all resource types, in particular CustomResoruces, so we'd just need to use a reflective check for the existence of such a field and state by convention or check to make sure that annotations are compatible with this usage. I'll defer to Marc if there seems to be something that can be done in the near-term on this. |
Thanks for documenting this @shawkins We have a similar problem for this when trying to deserialize and serialize YAML resources intended to be used with Helm. The overall idea would be to improve the default deserializer (+ serializer) so that values that can't be deserialized due to type conflicts (e.g. a DeploymentSpec#replicas cannot hold a value As Steven suggested, one option would be to use the additionalProperties. IMO we should probably add an additional Map for this case, since it might help cover any additional problems (such as the typed value being set between deserialization and serialization) and won't mess with the current JsonAnyGetter/JsonAnySetter functionality. An overview of the process can be:
Given the previous procedure, I only see one issue, which is what happens with mistakes or errors in the original deserialized resource? With the described approach |
Hello,
With the openshift-client library
I try to get a template :
The template contains an object with :
And a parameter :
When executing the Java code, the error is thrown
The runAsUser is effectivly a long in the destination object, but in the template It's a string refered by the parameter
The text was updated successfully, but these errors were encountered: