Message: parsing time "2024-10-16T14:36:58 02:00" as "2006-01-02T15:04:05Z07:00": cannot parse " 02:00" as "Z07:00". #6459
Closed
Description
Describe the bug
Here's an example on using .sinceTime()
kubernetes-client/doc/CHEATSHEET.md
Lines 2342 to 2345 in 08e54a9
When I use this with a timezoned timestamp with fabric8 kubernetes client 6.13.0, I get an exception from the remote:
Failure executing: GET at: https://api.crc.testing:6443/api/v1/namespaces/redhat-ods-operator/pods/rhods-operator-76bb96fb9d-qg2cs/log?pretty=false&sinceTime=2024-10-16T14:36:58+02:00. Message: parsing time "2024-10-16T14:36:58 02:00" as "2006-01-02T15:04:05Z07:00": cannot parse " 02:00" as "Z07:00". Received status: Status(apiVersion=v1, code=400, details=null, kind=Status, message=parsing time "2024-10-16T14:36:58 02:00" as "2006-01-02T15:04:05Z07:00": cannot parse " 02:00" as "Z07:00", metadata=ListMeta(_continue=null, remainingItemCount=null, resourceVersion=null, selfLink=null, additionalProperties={}), reason=BadRequest, status=Failure, additionalProperties={}).
io.fabric8.kubernetes.client.KubernetesClientException: Failure executing: GET at: https://api.crc.testing:6443/api/v1/namespaces/redhat-ods-operator/pods/rhods-operator-76bb96fb9d-qg2cs/log?pretty=false&sinceTime=2024-10-16T14:36:58+02:00. Message: parsing time "2024-10-16T14:36:58 02:00" as "2006-01-02T15:04:05Z07:00": cannot parse " 02:00" as "Z07:00". Received status: Status(apiVersion=v1, code=400, details=null, kind=Status, message=parsing time "2024-10-16T14:36:58 02:00" as "2006-01-02T15:04:05Z07:00": cannot parse " 02:00" as "Z07:00", metadata=ListMeta(_continue=null, remainingItemCount=null, resourceVersion=null, selfLink=null, additionalProperties={}), reason=BadRequest, status=Failure, additionalProperties={}).
at io.fabric8.kubernetes.client.dsl.internal.OperationSupport.requestFailure(OperationSupport.java:660)
at io.fabric8.kubernetes.client.dsl.internal.OperationSupport.requestFailure(OperationSupport.java:640)
at io.fabric8.kubernetes.client.dsl.internal.OperationSupport.assertResponseCode(OperationSupport.java:589)
at io.fabric8.kubernetes.client.dsl.internal.OperationSupport.handleRaw(OperationSupport.java:739)
at io.fabric8.kubernetes.client.dsl.internal.OperationSupport.handleRawGet(OperationSupport.java:474)
at io.fabric8.kubernetes.client.dsl.internal.core.v1.PodOperationsImpl.doGetLog(PodOperationsImpl.java:133)
at io.fabric8.kubernetes.client.dsl.internal.core.v1.PodOperationsImpl.getLog(PodOperationsImpl.java:141)
at io.fabric8.kubernetes.client.dsl.internal.core.v1.PodOperationsImpl.getLog(PodOperationsImpl.java:166)
at io.fabric8.kubernetes.client.utils.internal.PodOperationUtil.getLog(PodOperationUtil.java:109)
at io.fabric8.kubernetes.client.dsl.internal.apps.v1.ReplicaSetOperationsImpl.getLog(ReplicaSetOperationsImpl.java:86)
at io.fabric8.kubernetes.client.dsl.internal.apps.v1.DeploymentOperationsImpl.getLog(DeploymentOperationsImpl.java:130)
at io.fabric8.kubernetes.client.dsl.internal.apps.v1.RollableScalableResourceOperation.getLog(RollableScalableResourceOperation.java:89)
The problem appears to be that the +
character in the timestamp is not urlencoded.
Fabric8 Kubernetes Client version
6.13.0
Steps to reproduce
client.pods().inNamespace("test").withName("foo").sinceTime("2024-10-16T14:36:58+02:00").getLog();
Expected behavior
I'd expect fabric8 to urlencode the timestamp.
Runtime
OpenShift
Kubernetes API Server version
other (please specify in additional context)
Environment
Linux, macOS
Fabric8 Kubernetes Client Logs
No response
Additional context
% oc version
Client Version: 4.17.0
Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
Server Version: 4.16.7
Kubernetes Version: v1.29.7+6abe8a1