Skip to content

Commit 95eb094

Browse files
committed
Modified TIMEOUT VALUE
1 parent b69ff9f commit 95eb094

File tree

1 file changed

+5
-4
lines changed
  • examples/src/main/java/io/kubernetes/client/examples

1 file changed

+5
-4
lines changed

examples/src/main/java/io/kubernetes/client/examples/Example.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public class Example {
4545

4646
private final CoreV1Api corev1Api;
4747
private final static String DEFAULT_NAME_SPACE = "default";
48+
private final static Integer TIME_OUT_VALUE = 180;
4849

4950
/*
5051
For API_SERVER_NAME, you can get the server name as follows.
@@ -57,7 +58,7 @@ public class Example {
5758
$ kubectl describe secret $(kubectl get secrets | grep default | cut -f1 -d ' ') | grep -E '^token' | cut -f2 -d':' | tr -d '\t'
5859
*/
5960
private static final String ACCESS_TOKEN = "********************************";
60-
61+
6162
private final static Logger LOGGER = Logger.getLogger(Example.class.getName());
6263

6364
/**
@@ -123,7 +124,7 @@ public void executeCommand() throws ApiException {
123124
* @throws ApiException
124125
*/
125126
public List<String> getAllNameSapces() throws ApiException {
126-
V1NamespaceList listNamespace = corev1Api.listNamespace("true", null, null, Boolean.FALSE, null, Integer.SIZE, null, Integer.BYTES, Boolean.FALSE);
127+
V1NamespaceList listNamespace = corev1Api.listNamespace("true", null, null, Boolean.FALSE, null, 0, null, Integer.MAX_VALUE, Boolean.FALSE);
127128
List<String> list = listNamespace.getItems()
128129
.stream()
129130
.map(v1Namespace -> v1Namespace.getMetadata().getName())
@@ -176,7 +177,7 @@ public List<String> getNamespacedPod(String namespace) throws ApiException {
176177
* @throws ApiException
177178
*/
178179
public List<String> getNamespacedPod(String namespace, String label) throws ApiException {
179-
V1PodList listNamespacedPod = corev1Api.listNamespacedPod(namespace, null, null, null, Boolean.FALSE, label, Integer.SIZE, null, Integer.BYTES, Boolean.FALSE);
180+
V1PodList listNamespacedPod = corev1Api.listNamespacedPod(namespace, null, null, null, Boolean.FALSE, label, Integer.MAX_VALUE, null, TIME_OUT_VALUE, Boolean.FALSE);
180181
List<String> listPods = listNamespacedPod.getItems()
181182
.stream()
182183
.map(v1pod -> v1pod.getMetadata().getName())
@@ -191,7 +192,7 @@ public List<String> getNamespacedPod(String namespace, String label) throws ApiE
191192
* @throws ApiException
192193
*/
193194
public List<String> getServices() throws ApiException {
194-
V1ServiceList listNamespacedService = corev1Api.listNamespacedService(DEFAULT_NAME_SPACE, null, null, null, Boolean.FALSE, null, Integer.SIZE, null, Integer.BYTES, Boolean.FALSE);
195+
V1ServiceList listNamespacedService = corev1Api.listNamespacedService(DEFAULT_NAME_SPACE, null, null, null, Boolean.FALSE, null, Integer.MAX_VALUE, null, TIME_OUT_VALUE, Boolean.FALSE);
195196
return listNamespacedService.getItems().stream().map(v1service -> v1service.getMetadata().getName()).collect(Collectors.toList());
196197
}
197198

0 commit comments

Comments
 (0)