Skip to content

Commit

Permalink
fix: withReadyWaitTimeout defaults to 0, which means no waiting
Browse files Browse the repository at this point in the history
Signed-off-by: Marc Nuri <[email protected]>
  • Loading branch information
manusa authored Nov 26, 2024
1 parent fbf9326 commit 606d359
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
* Fix #5351: Removed deprecated `io.fabric8:openshift-server-mock` artifact
* Fix #6081: Moved Java baseline from 8 (1.8) to 11
* Fix #6138: Removed unused `io:fabric8:kubernetes-model` artifact
* Fix #6140: withReadyWaitTimeout defaults to 0, which means no waiting
* Fix #6156: Removed deprecated extension `io:fabric8:service-catalog`
* Fix #6158: Removed deprecated methods from `io.fabric8.kubernetes.client.utils.IOHelpers` class
* Fix #6159: Removed deprecated `io.fabric8.kubernetes.client.utils.Utils.getPluralFromKind` method
Expand Down
16 changes: 16 additions & 0 deletions doc/MIGRATION-v7.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- [Java baseline set to Java 11](#java-11)
- [Vert.x as default HttpClient implementation](#vertx-httpclient)
- [Bouncy Castle is no longer needed](#bouncy-castle)
- [Default Pod wait until ready timeout changed to 0](#pod-wait-timeout)
- [Config changes](#config-changes)
- [Support for multiple kubeconfig files](#config-changes-multiple-kubeconfig)
- [Model Changes](#model-changes)
Expand Down Expand Up @@ -56,6 +57,21 @@ The Bouncy Castle library is no longer needed as a dependency.
In previous versions, this was an optional dependency needed for Elliptic Curve (EC) Keys.
The Kubernetes client now uses the default Java security provider which should be enough to handle all scenarios.

## Default Pod wait until ready timeout changed to 0 <a href="#pod-wait-timeout" id="pod-wait-timeout"/>

The default timeout for Pod readiness has been changed from 5 seconds to 0 seconds.

In previous versions, the default timeout for waiting until a Pod is ready was 5 seconds.
This was causing issues in scenarios where the Pod was not marked as ready.
For example, when the Pod contained an init container, it was impossible to wait for the Pod to be ready while performing operations on that container.

We've changed the behavior to make Pod readiness waits opt-in.
If you want to preserve the previous behavior, you can set the timeout with the `withReadyWaitTimeout` method.

``` java
client.pods().withName($podName).withReadyWaitTimeout(5000).getLog();
```

## Config changes <a href="#config-changes" id="config-changes"/>

The `Config` class has been completely refactored to improve its reliability and usability.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ public PodOperationContext withDir(String dir) {
return this.toBuilder().dir(dir).build();
}

public PodOperationContext withReadyWaitTimeout(Integer logWaitTimeout) {
return this.toBuilder().readyWaitTimeout(logWaitTimeout).build();
public PodOperationContext withReadyWaitTimeout(Integer readyWaitTimeout) {
return this.toBuilder().readyWaitTimeout(readyWaitTimeout).build();
}

public String getLogParameters() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public class PodOperationsImpl extends HasMetadataOperation<Pod, PodList, PodRes
implements PodResource, EphemeralContainersResource, CopyOrReadable {

public static final int HTTP_TOO_MANY_REQUESTS = 429;
public static final int DEFAULT_POD_READY_WAIT_TIMEOUT_MS = 5000;
public static final int DEFAULT_POD_READY_WAIT_TIMEOUT_MS = 0;
private static final String[] EMPTY_COMMAND = { "/bin/sh", "-i" };
public static final String DEFAULT_CONTAINER_ANNOTATION_NAME = "kubectl.kubernetes.io/default-container";

Expand Down Expand Up @@ -193,8 +193,8 @@ public LogWatch watchLog(OutputStream out) {
}

@Override
public PodOperationsImpl withReadyWaitTimeout(Integer logWaitTimeout) {
return new PodOperationsImpl(getContext().withReadyWaitTimeout(logWaitTimeout), context);
public PodOperationsImpl withReadyWaitTimeout(Integer readyWaitTimeout) {
return new PodOperationsImpl(getContext().withReadyWaitTimeout(readyWaitTimeout), context);
}

@Override
Expand Down

0 comments on commit 606d359

Please sign in to comment.