@@ -239,7 +239,9 @@ public static boolean checkHasServiceChannelPort(
239
239
logger .info (" Find services in namespage " + namespace + " with command: '" + cmd + "'" );
240
240
241
241
ExecResult result = ExecCommand .exec (cmd .toString ());
242
- String stdout = getServices (namespace );
242
+ String stdout = result .stdout ();
243
+ logger .info (" Services found: " );
244
+ logger .info (stdout );
243
245
String stdoutlines [] = stdout .split ("\\ r?\\ n" );
244
246
if (result .exitValue () == 0 && stdoutlines .length > 0 ) {
245
247
for (String stdoutline : stdoutlines ) {
@@ -251,18 +253,52 @@ public static boolean checkHasServiceChannelPort(
251
253
return false ;
252
254
}
253
255
254
- public static String getServices (String namespace ) throws Exception {
255
- StringBuffer cmd = new StringBuffer ("kubectl get services " );
256
+ /**
257
+ * kubectl describe service serviceName -n namespace
258
+ *
259
+ * @param namespace namespace where the service is located
260
+ * @param serviceName name of the service to be described
261
+ * @return String containing output of the kubectl describe service command
262
+ * @throws Exception
263
+ */
264
+ public static String describeService (String namespace , String serviceName ) throws Exception {
265
+ StringBuffer cmd = new StringBuffer ("kubectl describe service " );
266
+ cmd .append (serviceName );
256
267
cmd .append (" -n " ).append (namespace );
257
- logger .info (" Find services in namespage " + namespace + " with command: '" + cmd + "'" );
268
+ logger .info (
269
+ " Describe service "
270
+ + serviceName
271
+ + " in namespage "
272
+ + namespace
273
+ + " with command: '"
274
+ + cmd
275
+ + "'" );
258
276
259
277
ExecResult result = ExecCommand .exec (cmd .toString ());
260
278
String stdout = result .stdout ();
261
- logger .info (" Services found: " );
279
+ logger .info (" Service " + serviceName + " found: " );
262
280
logger .info (stdout );
263
281
return stdout ;
264
282
}
265
283
284
+ /**
285
+ * kubectl get pods -o wide -n namespace
286
+ *
287
+ * @param namespace namespace in which the pods are to be listed
288
+ * @return String containing output of the kubectl get pods command
289
+ * @throws Exception
290
+ */
291
+ public static String getPods (String namespace ) throws Exception {
292
+ StringBuffer cmd = new StringBuffer ("kubectl get pods -o wide " );
293
+ cmd .append (" -n " ).append (namespace );
294
+ logger .info (" Get pods in namespage " + namespace + " with command: '" + cmd + "'" );
295
+
296
+ ExecResult result = ExecCommand .exec (cmd .toString ());
297
+ String stdout = result .stdout ();
298
+ logger .info (" Pods found: " );
299
+ logger .info (stdout );
300
+ return stdout ;
301
+ }
266
302
/**
267
303
* First, kill the mgd server process in the container three times to cause the node manager to
268
304
* mark the server 'failed not restartable'. This in turn is detected by the liveness probe, which
0 commit comments