You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hit following error to parse getNamespacedCustomObject() result into KruiseAppsV1alpha1CloneSet (gson 2.8.9).
com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at path $.status.conditions[0].lastTransitionTime
unfortunately I don't have the status.conditions[0].lastTransitionTime field as it does not normally exists in the cloneset object and we didn't save a copy when it happened (I will add an example if this happens again in the future). I wonder whether there is a possible mismatch between the expected and real format of the field. Or like to know if there is a better way to obtain KruiseAppsV1alpha1CloneSet from the returned obj.
ApiClient client = Config.defaultClient();
Configuration.setDefaultApiClient(client);
CustomObjectsApi customObjectsApi = new CustomObjectsApi(client);
Object obj = customObjectsApi.getNamespacedCustomObject(
"apps.kruise.io", // group
"v1alpha1", // version
K8sCommon.getNamespaceFromEnv(), // namespace
"clonesets", // plural
cloneset // name
);
Gson gson = new JSON().getGson();
KruiseAppsV1alpha1CloneSet v1cs = gson.fromJson(
gson.toJsonTree(obj).getAsJsonObject(), KruiseAppsV1alpha1CloneSet.class);
The text was updated successfully, but these errors were encountered:
@FillZpp I caught and logged one example below. I am not sure under what condition k8s include the "conditions" field and whether different versions of k8s returns different format. The "conditions" field only appears sometime in which case the parse will fail.
"status": {
"availableReplicas": 199.0,
"collisionCount": 0.0,
"conditions": [
{
"lastTransitionTime": "2022-01-04T18:09:54Z",
"message": "The POST operation against Pod could not be completed at this time, please try again.",
"status": "True",
"type": "FailedScale"
}
],
"labelSelector": "app=nodemanager-894d7",
"observedGeneration": 2329.0,
"readyReplicas": 199.0,
"replicas": 199.0,
"updateRevision": "nodemanager-894d7-6b7579fb78",
"updatedReadyReplicas": 199.0,
"updatedReplicas": 199.0
}
Hit following error to parse getNamespacedCustomObject() result into KruiseAppsV1alpha1CloneSet (gson 2.8.9).
unfortunately I don't have the status.conditions[0].lastTransitionTime field as it does not normally exists in the cloneset object and we didn't save a copy when it happened (I will add an example if this happens again in the future). I wonder whether there is a possible mismatch between the expected and real format of the field. Or like to know if there is a better way to obtain KruiseAppsV1alpha1CloneSet from the returned obj.
The text was updated successfully, but these errors were encountered: