@@ -1189,6 +1189,39 @@ public static void copyFile(String fromFile, String toFile) throws Exception {
1189
1189
Files .copy (new File (fromFile ).toPath (), Paths .get (toFile ), StandardCopyOption .REPLACE_EXISTING );
1190
1190
}
1191
1191
1192
+ /**
1193
+ * retrieve IP address info for cluster service.
1194
+ *
1195
+ * @param domainUID - name of domain.
1196
+ * @param clusterName - name Web Logic cluster
1197
+ * @param domainNS - domain namespace
1198
+ * @throws Exception - exception will be thrown if kubectl command will fail
1199
+ */
1200
+ public static String retrieveClusterIP (String domainUID , String clusterName , String domainNS )
1201
+ throws Exception {
1202
+ // kubectl get service domainonpvwlst-cluster-cluster-1 | grep ClusterIP | awk '{print $3}'
1203
+ StringBuffer cmd = new StringBuffer ("kubectl get service " );
1204
+ cmd .append (domainUID );
1205
+ cmd .append ("-cluster-" );
1206
+ cmd .append (clusterName );
1207
+ cmd .append (" -n " ).append (domainNS );
1208
+ cmd .append (" | grep ClusterIP | awk '{print $3}' " );
1209
+ logger .info (
1210
+ " Get ClusterIP for "
1211
+ + clusterName
1212
+ + " in namespace "
1213
+ + domainNS
1214
+ + " with command: '"
1215
+ + cmd
1216
+ + "'" );
1217
+
1218
+ ExecResult result = ExecCommand .exec (cmd .toString ());
1219
+ String stdout = result .stdout ();
1220
+ logger .info (" ClusterIP for cluster: " + clusterName + " found: " );
1221
+ logger .info (stdout );
1222
+ return stdout ;
1223
+ }
1224
+
1192
1225
/**
1193
1226
* Create dir to save Web Service App files. Copy the shell script file and all App files over to
1194
1227
* the admin pod Run the shell script to build WARs files and deploy the Web Service App and it's
@@ -1224,6 +1257,7 @@ public static void buildDeployWebServiceAppInPod(
1224
1257
String domainNS = domain .getDomainNS ();
1225
1258
int managedServerPort = ((Integer ) (domain .getDomainMap ()).get ("managedServerPort" )).intValue ();
1226
1259
String wsServiceName = (args .length == 0 ) ? BaseTest .TESTWSSERVICE : args [0 ];
1260
+ /*
1227
1261
String clusterDNS =
1228
1262
domain.getDomainUid()
1229
1263
+ "-cluster-"
@@ -1232,6 +1266,11 @@ public static void buildDeployWebServiceAppInPod(
1232
1266
+ domainNS
1233
1267
+ ".svc.cluster.local:"
1234
1268
+ managedServerPort;
1269
+ */
1270
+ String clusterDNS =
1271
+ retrieveClusterIP (domain .getDomainUid (), domain .getClusterName (), domainNS )
1272
+ + ":"
1273
+ + managedServerPort ;
1235
1274
logger .info (
1236
1275
"Build and deploy WebService App: "
1237
1276
+ appName
0 commit comments