Skip to content
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

Fabric8 builds JdkHttpClientImpl with 0 as timeout, and that leads to "Invalid duration: PT0S" #4569

Closed
egvili opened this issue Nov 8, 2022 · 1 comment · Fixed by #4570
Assignees
Milestone

Comments

@egvili
Copy link

egvili commented Nov 8, 2022

Describe the bug

When using fabric8 with JDKHttpClient, as recommended by RedHat and as means to workaround #4562 , we get the error: Invalid duration: PT0S
From a short debugging it appears that when PodOperationsImpl builds HttpClient in setupConnectionToPod() it uses 0 as readTimeout. But JDKHttpClient doesn't handle this well and throws error.
In JDKHttpClient inside HttpRequestBuilderImpl they make a validation against negative and zero values:

 if (duration.isNegative() || Duration.ZERO.equals(duration))
            throw new IllegalArgumentException("Invalid duration: " + duration);

Fabric8 Kubernetes Client version

6.2.0

Steps to reproduce

  1. Use fabric8 version 6.2.0 with JDKHttpClient. For example using Gradle:
    implementation ("io.fabric8:kubernetes-client:${fabricVersion}"){
    exclude group: "io.fabric8", module: "kubernetes-httpclient-okhttp"
    }
    implementation ("io.fabric8:kubernetes-httpclient-jdk:${fabricVersion}"){
    force = true
    }

  2. Try to connect to Kubernetes using fabric8

Expected behavior

Either pass a value different than 0, or make it configurable.

Runtime

Kubernetes (vanilla)

Kubernetes API Server version

other (please specify in additional context)

Environment

Amazon

Fabric8 Kubernetes Client Logs

Invalid duration: PT0S

Additional context

Kubernetes version: 1.19

@shawkins
Copy link
Contributor

shawkins commented Nov 8, 2022

This is a regression from #4490 - the new configuration logic is effectively omitting the 0 duration check. I'm not sure why there wasn't coverage for that.

@shawkins shawkins added this to the 6.3.0 milestone Nov 8, 2022
shawkins added a commit to shawkins/kubernetes-client that referenced this issue Nov 8, 2022
manusa pushed a commit to shawkins/kubernetes-client that referenced this issue Nov 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants