Skip to content

Commit 5cd447e

Browse files
authored
Merge pull request #2115 from yue9944882/deprecate-no-args-informer-factory
Deprecating no-arg informer-factory
2 parents ae3bb03 + 9749883 commit 5cd447e

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

examples/examples-release-13/src/main/java/io/kubernetes/client/examples/InformerExample.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,16 @@ public static void main(String[] args) throws Exception {
4141
apiClient.getHttpClient().newBuilder().readTimeout(0, TimeUnit.SECONDS).build();
4242
apiClient.setHttpClient(httpClient);
4343

44-
SharedInformerFactory factory = new SharedInformerFactory();
44+
SharedInformerFactory factory = new SharedInformerFactory(apiClient);
4545

4646
// Node informer
4747
SharedIndexInformer<V1Node> nodeInformer =
4848
factory.sharedIndexInformerFor(
4949
(CallGeneratorParams params) -> {
50+
// **NOTE**:
51+
// The following "CallGeneratorParams" lambda merely generates a stateless
52+
// HTTPs requests, the effective apiClient is the one specified when constructing
53+
// the informer-factory.
5054
return coreV1Api.listNodeCall(
5155
null,
5256
null,

examples/examples-release-14/src/main/java/io/kubernetes/client/examples/InformerExample.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,16 @@ public static void main(String[] args) throws Exception {
4141
apiClient.getHttpClient().newBuilder().readTimeout(0, TimeUnit.SECONDS).build();
4242
apiClient.setHttpClient(httpClient);
4343

44-
SharedInformerFactory factory = new SharedInformerFactory();
44+
SharedInformerFactory factory = new SharedInformerFactory(apiClient);
4545

4646
// Node informer
4747
SharedIndexInformer<V1Node> nodeInformer =
4848
factory.sharedIndexInformerFor(
4949
(CallGeneratorParams params) -> {
50+
// **NOTE**:
51+
// The following "CallGeneratorParams" lambda merely generates a stateless
52+
// HTTPs requests, the effective apiClient is the one specified when constructing
53+
// the informer-factory.
5054
return coreV1Api.listNodeCall(
5155
null,
5256
null,

examples/examples-release-15/src/main/java/io/kubernetes/client/examples/InformerExample.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,15 @@ public static void main(String[] args) throws Exception {
4141
apiClient.getHttpClient().newBuilder().readTimeout(0, TimeUnit.SECONDS).build();
4242
apiClient.setHttpClient(httpClient);
4343

44-
SharedInformerFactory factory = new SharedInformerFactory();
44+
SharedInformerFactory factory = new SharedInformerFactory(apiClient);
4545

4646
// Node informer
4747
SharedIndexInformer<V1Node> nodeInformer =
4848
factory.sharedIndexInformerFor(
49+
// **NOTE**:
50+
// The following "CallGeneratorParams" lambda merely generates a stateless
51+
// HTTPs requests, the effective apiClient is the one specified when constructing
52+
// the informer-factory.
4953
(CallGeneratorParams params) -> {
5054
return coreV1Api.listNodeCall(
5155
null,

util/src/main/java/io/kubernetes/client/informer/SharedInformerFactory.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ public class SharedInformerFactory {
4949
private ApiClient apiClient;
5050

5151
/** Constructor w/ default thread pool. */
52+
/** DEPRECATE: In favor of explicit apiClient constructor to avoid misguiding */
53+
@Deprecated
5254
public SharedInformerFactory() {
5355
this(Configuration.getDefaultApiClient().setReadTimeout(0), Executors.newCachedThreadPool());
5456
}

0 commit comments

Comments
 (0)