Skip to content

Commit

Permalink
Merge pull request #1157 from visavis2k/iss_1156
Browse files Browse the repository at this point in the history
  • Loading branch information
fusesource-ci authored Jul 27, 2018
2 parents b78e130 + 8f7d1a6 commit eddf24b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

#### 4.0.4 (To be released)
Bugs

* Fix #1156 : Watcher does not have correct authentication information in Openshift environment.

* Fix #1144 : Get Request with OpenShift Mock Server Not Working

* Fix #1147: Cluster context was being ignored when loading the Config from a kubeconfig file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import io.fabric8.kubernetes.client.*;
import io.fabric8.kubernetes.client.dsl.base.BaseOperation;
import io.fabric8.kubernetes.client.dsl.base.OperationSupport;
import io.fabric8.kubernetes.client.utils.HttpClientUtils;
import io.fabric8.kubernetes.client.utils.Utils;
import okhttp3.*;
import okio.ByteString;
Expand Down Expand Up @@ -70,7 +69,7 @@ public class WatchConnectionManager<T extends HasMetadata, L extends KubernetesR
private final URL requestUrl;

private WebSocket webSocket;
private OkHttpClient okhttpClient;
private OkHttpClient clonedClient;

public WatchConnectionManager(final OkHttpClient client, final BaseOperation<T, L, ?, ?> baseOperation, final String version, final Watcher<T> watcher, final int reconnectInterval, final int reconnectLimit, long websocketTimeout, int maxIntervalExponent) throws MalformedURLException {
this.resourceVersion = new AtomicReference<>(version); // may be a reference to null
Expand All @@ -81,8 +80,7 @@ public WatchConnectionManager(final OkHttpClient client, final BaseOperation<T,
this.websocketTimeout = websocketTimeout;
this.maxIntervalExponent = maxIntervalExponent;

Config requestConfig = new ConfigBuilder(baseOperation.getConfig()).withRequestTimeout((int)this.websocketTimeout).build();
this.okhttpClient = HttpClientUtils.createHttpClient(requestConfig);
this.clonedClient = client.newBuilder().readTimeout(this.websocketTimeout, TimeUnit.MILLISECONDS).build();

// The URL is created, validated and saved once, so that reconnect attempts don't have to deal with
// MalformedURLExceptions that would never occur
Expand Down Expand Up @@ -151,7 +149,7 @@ private final void runWatch() {
.addHeader("Origin", requestUrl.getProtocol() + "://" + requestUrl.getHost() + ":" + requestUrl.getPort())
.build();

webSocket = okhttpClient.newWebSocket(request, new WebSocketListener() {
webSocket = clonedClient.newWebSocket(request, new WebSocketListener() {
@Override
public void onOpen(final WebSocket webSocket, Response response) {
if (response != null && response.body() != null) {
Expand Down

0 comments on commit eddf24b

Please sign in to comment.