@@ -45,6 +45,7 @@ public class Example {
45
45
46
46
private final CoreV1Api corev1Api ;
47
47
private final static String DEFAULT_NAME_SPACE = "default" ;
48
+ private final static Integer TIME_OUT_VALUE = 180 ;
48
49
49
50
/*
50
51
For API_SERVER_NAME, you can get the server name as follows.
@@ -57,7 +58,7 @@ public class Example {
57
58
$ kubectl describe secret $(kubectl get secrets | grep default | cut -f1 -d ' ') | grep -E '^token' | cut -f2 -d':' | tr -d '\t'
58
59
*/
59
60
private static final String ACCESS_TOKEN = "********************************" ;
60
-
61
+
61
62
private final static Logger LOGGER = Logger .getLogger (Example .class .getName ());
62
63
63
64
/**
@@ -123,7 +124,7 @@ public void executeCommand() throws ApiException {
123
124
* @throws ApiException
124
125
*/
125
126
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 );
127
128
List <String > list = listNamespace .getItems ()
128
129
.stream ()
129
130
.map (v1Namespace -> v1Namespace .getMetadata ().getName ())
@@ -176,7 +177,7 @@ public List<String> getNamespacedPod(String namespace) throws ApiException {
176
177
* @throws ApiException
177
178
*/
178
179
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 );
180
181
List <String > listPods = listNamespacedPod .getItems ()
181
182
.stream ()
182
183
.map (v1pod -> v1pod .getMetadata ().getName ())
@@ -191,7 +192,7 @@ public List<String> getNamespacedPod(String namespace, String label) throws ApiE
191
192
* @throws ApiException
192
193
*/
193
194
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 );
195
196
return listNamespacedService .getItems ().stream ().map (v1service -> v1service .getMetadata ().getName ()).collect (Collectors .toList ());
196
197
}
197
198
0 commit comments