3
3
4
4
package oracle .weblogic .kubernetes ;
5
5
6
+ import java .net .InetAddress ;
7
+ import java .net .UnknownHostException ;
6
8
import java .nio .file .Path ;
7
9
import java .nio .file .Paths ;
8
10
import java .util .ArrayList ;
24
26
25
27
import static oracle .weblogic .kubernetes .TestConstants .ADMIN_PASSWORD_DEFAULT ;
26
28
import static oracle .weblogic .kubernetes .TestConstants .ADMIN_USERNAME_DEFAULT ;
29
+ import static oracle .weblogic .kubernetes .TestConstants .ISTIO_HTTP_HOSTPORT ;
30
+ import static oracle .weblogic .kubernetes .TestConstants .IT_ISTIOMONITORINGEXPORTER_PROM_HTTP_CONAINERPORT ;
31
+ import static oracle .weblogic .kubernetes .TestConstants .IT_ISTIOMONITORINGEXPORTER_PROM_HTTP_HOSTPORT ;
27
32
import static oracle .weblogic .kubernetes .TestConstants .K8S_NODEPORT_HOST ;
33
+ import static oracle .weblogic .kubernetes .TestConstants .OCNE ;
28
34
import static oracle .weblogic .kubernetes .TestConstants .OKE_CLUSTER ;
29
35
import static oracle .weblogic .kubernetes .TestConstants .OKE_CLUSTER_PRIVATEIP ;
30
36
import static oracle .weblogic .kubernetes .TestConstants .RESULTS_ROOT ;
38
44
import static oracle .weblogic .kubernetes .utils .CommonTestUtils .createTestWebAppWarFile ;
39
45
import static oracle .weblogic .kubernetes .utils .CommonTestUtils .formatIPv6Host ;
40
46
import static oracle .weblogic .kubernetes .utils .CommonTestUtils .getImageBuilderExtraArgs ;
41
- import static oracle .weblogic .kubernetes .utils .CommonTestUtils .getNextFreePort ;
42
47
import static oracle .weblogic .kubernetes .utils .CommonTestUtils .getServiceExtIPAddrtOke ;
43
48
import static oracle .weblogic .kubernetes .utils .CommonTestUtils .startPortForwardProcess ;
44
49
import static oracle .weblogic .kubernetes .utils .CommonTestUtils .stopPortForwardProcess ;
@@ -140,7 +145,7 @@ public static void initAll(@Namespaces(3) List<String> namespaces) {
140
145
141
146
// install and verify operator
142
147
installAndVerifyOperator (opNamespace , domain1Namespace , domain2Namespace );
143
- prometheusPort = getNextFreePort () ;
148
+ prometheusPort = IT_ISTIOMONITORINGEXPORTER_PROM_HTTP_CONAINERPORT ;
144
149
}
145
150
146
151
/**
@@ -223,6 +228,14 @@ private void deployPrometheusAndVerify(String domainNamespace, String domainUid,
223
228
// In internal OKE env, use Istio EXTERNAL-IP; in non-OKE env, use K8S_NODEPORT_HOST + ":" + istioIngressPort
224
229
hostPortPrometheus = getServiceExtIPAddrtOke (istioIngressServiceName , istioNamespace ) != null
225
230
? getServiceExtIPAddrtOke (istioIngressServiceName , istioNamespace ) : host + ":" + prometheusPort ;
231
+ if (!TestConstants .WLSIMG_BUILDER .equals (TestConstants .WLSIMG_BUILDER_DEFAULT ) && !OCNE ) {
232
+ try {
233
+ hostPortPrometheus = InetAddress .getLocalHost ().getHostAddress ()
234
+ + ":" + IT_ISTIOMONITORINGEXPORTER_PROM_HTTP_HOSTPORT ;
235
+ } catch (UnknownHostException ex ) {
236
+ logger .severe (ex .getLocalizedMessage ());
237
+ }
238
+ }
226
239
227
240
if (OKE_CLUSTER_PRIVATEIP ) {
228
241
String localhost = "localhost" ;
@@ -233,7 +246,6 @@ private void deployPrometheusAndVerify(String domainNamespace, String domainUid,
233
246
logger .info ("Forwarded local port is {0}" , forwardPort );
234
247
hostPortPrometheus = localhost + ":" + forwardPort ;
235
248
isPrometheusPortForward = true ;
236
-
237
249
}
238
250
} else {
239
251
String newRegex = String .format ("regex: %s;%s" , domainNamespace , domainUid );
@@ -394,7 +406,17 @@ private void setupIstioModelInImageDomain(String miiImage, String domainNamespac
394
406
// In internal OKE env, use Istio EXTERNAL-IP; in non-OKE env, use K8S_NODEPORT_HOST + ":" + istioIngressPort
395
407
String hostAndPort = getServiceExtIPAddrtOke (istioIngressServiceName , istioNamespace ) != null
396
408
? getServiceExtIPAddrtOke (istioIngressServiceName , istioNamespace ) : host + ":" + istioIngressPort ;
397
-
409
+
410
+ String deployHost = K8S_NODEPORT_HOST ;
411
+ if (!TestConstants .WLSIMG_BUILDER .equals (TestConstants .WLSIMG_BUILDER_DEFAULT ) && !OCNE ) {
412
+ istioIngressPort = ISTIO_HTTP_HOSTPORT ;
413
+ try {
414
+ hostAndPort = InetAddress .getLocalHost ().getHostAddress () + ":" + istioIngressPort ;
415
+ deployHost = InetAddress .getLocalHost ().getHostAddress ();
416
+ } catch (UnknownHostException ex ) {
417
+ logger .severe (ex .getLocalizedMessage ());
418
+ }
419
+ }
398
420
String readyAppUrl = "http://" + hostAndPort + "/weblogic/ready" ;
399
421
boolean checlReadyApp =
400
422
checkAppUsingHostHeader (readyAppUrl , domainNamespace + ".org" );
@@ -406,7 +428,7 @@ private void setupIstioModelInImageDomain(String miiImage, String domainNamespac
406
428
ExecResult result = OKE_CLUSTER
407
429
? deployUsingRest (hostAndPort , ADMIN_USERNAME_DEFAULT , ADMIN_PASSWORD_DEFAULT ,
408
430
target , archivePath , domainNamespace + ".org" , "testwebapp" )
409
- : deployToClusterUsingRest (K8S_NODEPORT_HOST ,
431
+ : deployToClusterUsingRest (deployHost ,
410
432
String .valueOf (istioIngressPort ),
411
433
ADMIN_USERNAME_DEFAULT , ADMIN_PASSWORD_DEFAULT ,
412
434
clusterName , archivePath , domainNamespace + ".org" , "testwebapp" );
0 commit comments