-
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
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
Comments
Maybe encoding the parameter at this point fixes the issue: Line 146 in 25ecf84
That whole method should be refactored to treat the URL correctly. |
Looks like a legit fix @Test
void testEncode() {
String timestamp = "2024-10-16T14:36:58+02:00";
String encoded = URLUtils.encodeToUTF(timestamp);
System.out.println("encoded: " + encoded);
} prints and if I try the original url from error message, I get failure
but after replacing the parameter with the encoded timestamp
So I do like the general direction. For now I fixed this by using |
Sorry, it's unclear to me if the suggested change does fix the issue, from your comments my understanding is that it would but it's not 100% clear. If so, we can proceed with an initial quick fix and maybe later further refactor the complete method to use an URL builder instead. |
I did not test the suggested change, I only did what I said I did, completely outside of fabric8 code. I did not know you're intending to actually be fixing it right now, I thought it's just random speculation on your part. Right, I'll go figure out how to do the whole "build a snapshot version of fabric8 and run my project with that". It's like back in my younger days, this Java+Maven stuff, again. |
No, no, no worries. I mean, feel free to do it if you want to feel young again ;) Just wanted to have a clear path to the fix once we can tackle the issue so there's no need to re-read everything again.
I understand, didn't do this in the scope of the project but you actually executed the request. What is/was unclear to me is if the response actually contains what you requested i.e. are the logs returned within the specified time range. If this is right, we can proceed with the suggested fix (not right away). |
I'll figure it out, but yeah, feeling none the wiser than my younger self, dealing with stuff like that. |
diff --git a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/PodOperationContext.java b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/PodOperationContext.java
index f22c63ad4..47253cfb3 100644
--- a/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/PodOperationContext.java
+++ b/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/dsl/internal/PodOperationContext.java
@@ -17,6 +17,7 @@ package io.fabric8.kubernetes.client.dsl.internal;
import io.fabric8.kubernetes.client.KubernetesClientException;
import io.fabric8.kubernetes.client.dsl.ExecListener;
+import io.fabric8.kubernetes.client.utils.URLUtils;
import io.fabric8.kubernetes.client.utils.URLUtils.URLBuilder;
import lombok.AllArgsConstructor;
import lombok.Builder;
@@ -143,7 +144,7 @@ public class PodOperationContext {
if (sinceSeconds != null) {
sb.append("&sinceSeconds=").append(sinceSeconds);
} else if (sinceTimestamp != null) {
- sb.append("&sinceTime=").append(sinceTimestamp);
+ sb.append("&sinceTime=").append(URLUtils.encodeToUTF(sinceTimestamp));
}
if (tailingLines != null) {
sb.append("&tailLines=").append(tailingLines); This does work, but it mangles the timestamp a bit too much. It goes from Thanks for your moral support with testing! What I'm running (for my future reference) is
|
I'm not sure what the util class is actually doing here, we can probably use something else instead ( Otherwise, I don't think it's important how the URL looks in the end since this should be mostly transparent for the user (except for MockWebServer expectations, here there might be some problems) Thanks for checking this out, much appreciated 🙏 |
Right. I had to do |
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:
The problem appears to be that the
+
character in the timestamp is not urlencoded.Fabric8 Kubernetes Client version
6.13.0
Steps to reproduce
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
The text was updated successfully, but these errors were encountered: