45
45
import static oracle .weblogic .kubernetes .TestConstants .GRAFANA_CHART_VERSION ;
46
46
import static oracle .weblogic .kubernetes .TestConstants .K8S_NODEPORT_HOST ;
47
47
import static oracle .weblogic .kubernetes .TestConstants .OKD ;
48
+ import static oracle .weblogic .kubernetes .TestConstants .OKE_CLUSTER_PRIVATEIP ;
48
49
import static oracle .weblogic .kubernetes .TestConstants .PROMETHEUS_CHART_VERSION ;
49
50
import static oracle .weblogic .kubernetes .TestConstants .RESULTS_ROOT ;
50
51
import static oracle .weblogic .kubernetes .actions .ActionConstants .MODEL_DIR ;
58
59
import static oracle .weblogic .kubernetes .actions .impl .primitive .Kubernetes .copyFileToPod ;
59
60
import static oracle .weblogic .kubernetes .actions .impl .primitive .Kubernetes .deleteNamespace ;
60
61
import static oracle .weblogic .kubernetes .actions .impl .primitive .Kubernetes .exec ;
62
+ import static oracle .weblogic .kubernetes .utils .CommonTestUtils .createIngressPathRouting ;
63
+ import static oracle .weblogic .kubernetes .utils .CommonTestUtils .getServiceExtIPAddrtOke ;
61
64
import static oracle .weblogic .kubernetes .utils .LoadBalancerUtils .createIngressForDomainAndVerify ;
62
65
import static oracle .weblogic .kubernetes .utils .LoadBalancerUtils .installAndVerifyNginx ;
63
66
import static oracle .weblogic .kubernetes .utils .MonitoringUtils .checkMetricsViaPrometheus ;
91
94
@ DisplayName ("Verify WebLogic Metric is processed as expected by MonitoringExporter WebApp via Prometheus and Grafana" )
92
95
@ IntegrationTest
93
96
@ Tag ("olcne-mrg" )
94
- @ Tag ("oke-sequential " )
97
+ @ Tag ("oke-gate " )
95
98
@ Tag ("kind-sequential" )
96
99
@ Tag ("okd-wls-mrg" )
97
100
class ItMonitoringExporterWebApp {
@@ -108,6 +111,7 @@ class ItMonitoringExporterWebApp {
108
111
private static int nodeportshttp = 0 ;
109
112
private static int nodeportshttps = 0 ;
110
113
private static List <String > ingressHost1List = null ;
114
+ private static String ingressIP = null ;
111
115
112
116
private static String monitoringNS = null ;
113
117
PrometheusParams promHelmParams = null ;
@@ -193,6 +197,8 @@ public static void initAll(@Namespaces(6) List<String> namespaces) {
193
197
nginxHelmParams = installAndVerifyNginx (nginxNamespace , 0 , 0 );
194
198
195
199
String nginxServiceName = nginxHelmParams .getHelmParams ().getReleaseName () + "-ingress-nginx-controller" ;
200
+ ingressIP = getServiceExtIPAddrtOke (nginxServiceName , nginxNamespace ) != null
201
+ ? getServiceExtIPAddrtOke (nginxServiceName , nginxNamespace ) : K8S_NODEPORT_HOST ;
196
202
logger .info ("NGINX service name: {0}" , nginxServiceName );
197
203
nodeportshttp = getServiceNodePort (nginxNamespace , nginxServiceName , "http" );
198
204
nodeportshttps = getServiceNodePort (nginxNamespace , nginxServiceName , "https" );
@@ -210,6 +216,9 @@ public static void initAll(@Namespaces(6) List<String> namespaces) {
210
216
host = "[" + host + "]" ;
211
217
}
212
218
exporterUrl = String .format ("http://%s:%s/wls-exporter/" , host , nodeportshttp );
219
+ if (OKE_CLUSTER_PRIVATEIP ) {
220
+ exporterUrl = String .format ("http://%s/wls-exporter/" , ingressIP );
221
+ }
213
222
HashMap <String , String > labels = new HashMap <>();
214
223
labels .put ("app" , "monitoring" );
215
224
labels .put ("weblogic.domainUid" , "test" );
@@ -249,7 +258,11 @@ void testBasicFunctionality() throws Exception {
249
258
ingressHost1List
250
259
= createIngressForDomainAndVerify (domain1Uid , domain1Namespace , 0 , clusterNameMsPortMap ,
251
260
false , ingressClassName , false , 0 );
252
- verifyMonExpAppAccessThroughNginx (ingressHost1List .get (0 ), 1 , nodeportshttp );
261
+ if (OKE_CLUSTER_PRIVATEIP ) {
262
+ verifyMonExpAppAccessThroughNginx (ingressHost1List .get (0 ), 1 , ingressIP );
263
+ } else {
264
+ verifyMonExpAppAccessThroughNginx (ingressHost1List .get (0 ), 1 , nodeportshttp );
265
+ }
253
266
// Need to expose the admin server external service to access the console in OKD cluster only
254
267
} else {
255
268
String hostName = createRouteForOKD (clusterService , domain1Namespace );
@@ -425,10 +438,16 @@ private void installPrometheusGrafana(String promChartVersion,
425
438
host = "[" + host + "]" ;
426
439
}
427
440
hostPortPrometheus = host + ":" + nodeportPrometheus ;
441
+ if (OKE_CLUSTER_PRIVATEIP ) {
442
+ hostPortPrometheus = ingressIP ;
443
+ }
428
444
if (OKD ) {
429
445
hostPortPrometheus = createRouteForOKD ("prometheus" + releaseSuffix
430
446
+ "-service" , monitoringNS ) + ":" + nodeportPrometheus ;
431
447
}
448
+ String ingressClassName = nginxHelmParams .getIngressClassName ();
449
+ createIngressPathRouting (monitoringNS , "/api" ,
450
+ prometheusReleaseName + "-server" , 80 , ingressClassName );
432
451
}
433
452
//if prometheus already installed change CM for specified domain
434
453
if (!prometheusRegexValue .equals (prometheusDomainRegexValue )) {
0 commit comments