kubernetes-client
kubernetes-client copied to clipboard
deserialize value of type `int` from String
template = client.templates().inNamespace(NamespaceName).withName(templateName).get();
Caused by: com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot deserialize value of type `int` from String "${{NUMBER_OF_INSTANCES}}": not a valid `int` value
at [Source: UNKNOWN; byte offset: #UNKNOWN] (through reference chain: io.fabric8.openshift.api.model.Template["objects"]->java.util.ArrayList[3]->io.fabric8.kubernetes.api.model.apps.StatefulSet["spec"]->io.fabric8.kubernetes.api.model.apps.StatefulSetSpec["replicas"])
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>openshift-client</artifactId>
<version>5.12.2</version>
</dependency>
This is a known issue with retrieving templates in their object form - it could be addressed by #4034
The workaround for now is that you either need to use withParameters to supply the template values, or retrieve as a generic kubernetes resource.
This is a known issue with retrieving templates in their object form - it could be addressed by #4034
The workaround for now is that you either need to use withParameters to supply the template values, or retrieve as a generic kubernetes resource.
Can you provide an example source for a workaround?
To replace the parameter values:
client.templates().inNamespace(NamespaceName).withName(templateName).process(map)
To read the template as a generic
client.genericKubernetesResources("template.openshift.io/v1", "Template").inNamespace(NamespaceName).withName(templateName).get()
or
client.genericKubernetesResources(ResourceDefinitionContext.fromResourceType(Template.class)).withName(templateName).get()
@ho-yasla : polite ping, Did the suggestion from Steven worked for your use case?
This issue has been automatically marked as stale because it has not had any activity since 90 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions!
Fixed by #4292