Skip to content

Commit

Permalink
Merge branch 'fix-for-mon' into 'main'
Browse files Browse the repository at this point in the history
Fix for nightly failures in main in monitoring exporter

See merge request weblogic-cloud/weblogic-kubernetes-operator!4686
  • Loading branch information
jshum2479 committed May 3, 2024
2 parents c06bc07 + 0abf3ae commit 54bbf58
Show file tree
Hide file tree
Showing 25 changed files with 317 additions and 239 deletions.
134 changes: 74 additions & 60 deletions Jenkinsfile.podman
Original file line number Diff line number Diff line change
Expand Up @@ -395,72 +395,86 @@ nodes:
- role: worker
image: ${kind_image}
extraPortMappings:
- containerPort: 30880
hostPort: 2080
protocol: TCP
- containerPort: 30443
hostPort: 2443
protocol: TCP
- containerPort: 31880
hostPort: 2180
protocol: TCP
- containerPort: 31443
hostPort: 2543
- containerPort: 30881
hostPort: 2081
protocol: TCP
- containerPort: 30444
hostPort: 2444
protocol: TCP
- containerPort: 30511
hostPort: 1511
- containerPort: 32480
hostPort: 2480
- containerPort: 32490
hostPort: 2490
- containerPort: 32156
hostPort: 2490
- containerPort: 30080
hostPort: 2080
- containerPort: 30443
hostPort: 2043
- containerPort: 30180
hostPort: 2090
- containerPort: 30143
hostPort: 2053
- containerPort: 31000
hostPort: 2100
- containerPort: 31004
hostPort: 2104
- containerPort: 31008
hostPort: 2108
- containerPort: 31012
hostPort: 2112
- containerPort: 31016
hostPort: 2116
- containerPort: 31020
hostPort: 2120
- containerPort: 31024
hostPort: 2124
- containerPort: 31028
hostPort: 2128
- containerPort: 31032
hostPort: 2132
- containerPort: 31036
hostPort: 2136
- containerPort: 31040
hostPort: 2140
- containerPort: 31044
hostPort: 2144
- containerPort: 31048
hostPort: 2148
- containerPort: 31052
hostPort: 2152
- containerPort: 31056
hostPort: 2156
- containerPort: 30511
hostPort: 1511
- containerPort: 32159
- containerPort: 31060
hostPort: 2160
- containerPort: 32169
- containerPort: 31064
hostPort: 2164
- containerPort: 31068
hostPort: 2168
- containerPort: 31072
hostPort: 2172
protocol: TCP
- containerPort: 32170
hostPort: 2173
protocol: TCP
- containerPort: 32189
hostPort: 2182
protocol: TCP
- containerPort: 32185
hostPort: 2175
protocol: TCP
- containerPort: 32143
hostPort: 2143
protocol: TCP
- containerPort: 32343
hostPort: 2343
protocol: TCP
- containerPort: 30538
hostPort: 2538
protocol: TCP
- containerPort: 30544
hostPort: 2539
protocol: TCP
- containerPort: 32331
hostPort: 2331
protocol: TCP
- containerPort: 31781
hostPort: 2781
protocol: TCP
- containerPort: 31744
hostPort: 2782
protocol: TCP
- containerPort: 31785
hostPort: 2785
protocol: TCP
- containerPort: 31746
hostPort: 2786
protocol: TCP
- containerPort: 31076
hostPort: 2176
- containerPort: 31080
hostPort: 2180
- containerPort: 31084
hostPort: 2184
- containerPort: 31088
hostPort: 2188
- containerPort: 31092
hostPort: 2192
- containerPort: 31096
hostPort: 2196
- containerPort: 31100
hostPort: 2200
- containerPort: 31104
hostPort: 2204
- containerPort: 31108
hostPort: 2208
- containerPort: 31112
hostPort: 2212
- containerPort: 31116
hostPort: 2216
- containerPort: 31120
hostPort: 2220
- containerPort: 31124
hostPort: 2224
- containerPort: 31128
hostPort: 2228
extraMounts:
- hostPath: ${pv_root}
containerPath: ${pv_root}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,19 @@
import static oracle.weblogic.kubernetes.TestConstants.ADMIN_USERNAME_DEFAULT;
import static oracle.weblogic.kubernetes.TestConstants.GRAFANA_CHART_VERSION;
import static oracle.weblogic.kubernetes.TestConstants.INGRESS_CLASS_FILE_NAME;
import static oracle.weblogic.kubernetes.TestConstants.IT_MONITORINGEXPORTER_PROMETHEUS_HTTP_HOSTPORT;
import static oracle.weblogic.kubernetes.TestConstants.IT_MONITORINGEXPORTERMF_ALERT_HTTP_NODEPORT;
import static oracle.weblogic.kubernetes.TestConstants.IT_MONITORINGEXPORTERMF_PROMETHEUS_HTTP_HOSTPORT;
import static oracle.weblogic.kubernetes.TestConstants.IT_MONITORINGEXPORTERMF_PROMETHEUS_HTTP_NODEPORT;
import static oracle.weblogic.kubernetes.TestConstants.K8S_NODEPORT_HOST;
import static oracle.weblogic.kubernetes.TestConstants.KIND_CLUSTER;
import static oracle.weblogic.kubernetes.TestConstants.OKD;
import static oracle.weblogic.kubernetes.TestConstants.OKE_CLUSTER_PRIVATEIP;
import static oracle.weblogic.kubernetes.TestConstants.PROMETHEUS_CHART_VERSION;
import static oracle.weblogic.kubernetes.TestConstants.RESULTS_ROOT;
import static oracle.weblogic.kubernetes.TestConstants.TRAEFIK_INGRESS_HTTPS_HOSTPORT;
import static oracle.weblogic.kubernetes.TestConstants.TRAEFIK_INGRESS_HTTP_HOSTPORT;
import static oracle.weblogic.kubernetes.TestConstants.WLSIMG_BUILDER;
import static oracle.weblogic.kubernetes.TestConstants.WLSIMG_BUILDER_DEFAULT;
import static oracle.weblogic.kubernetes.actions.ActionConstants.MODEL_DIR;
import static oracle.weblogic.kubernetes.actions.ActionConstants.RESOURCE_DIR;
import static oracle.weblogic.kubernetes.actions.TestActions.deleteImage;
Expand Down Expand Up @@ -180,8 +185,7 @@ public void initAll(@Namespaces(4) List<String> namespaces) throws IOException {
miiImage = MonitoringUtils.createAndVerifyMiiImage(monitoringExporterAppDir, modelList,
STICKYSESS_APP_NAME, SESSMIGR_APP_NAME, MONEXP_IMAGE_NAME);
host = formatIPv6Host(K8S_NODEPORT_HOST);
if (TestConstants.KIND_CLUSTER
&& !TestConstants.WLSIMG_BUILDER.equals(TestConstants.WLSIMG_BUILDER_DEFAULT)) {
if (KIND_CLUSTER && !WLSIMG_BUILDER.equals(WLSIMG_BUILDER_DEFAULT)) {
host = formatIPv6Host(InetAddress.getLocalHost().getHostAddress());
}

Expand Down Expand Up @@ -521,19 +525,26 @@ private void installPrometheusGrafana(String promChartVersion,
final String prometheusRegexValue = String.format("regex: %s;%s", domainNS, domainUid);
if (promHelmParams == null) {
cleanupPromGrafanaClusterRoles(prometheusReleaseName, grafanaReleaseName);
String promHelmValuesFileDir = Paths.get(RESULTS_ROOT,this.getClass().getSimpleName(),
String promHelmValuesFileDir = Paths.get(RESULTS_ROOT, this.getClass().getSimpleName(),
"prometheus" + releaseSuffix).toString();
promHelmParams = installAndVerifyPrometheus(releaseSuffix,
monitoringNS,
promChartVersion,
prometheusRegexValue, promHelmValuesFileDir);
if (KIND_CLUSTER && !WLSIMG_BUILDER.equals(WLSIMG_BUILDER_DEFAULT)) {
promHelmParams = installAndVerifyPrometheus(releaseSuffix,
monitoringNS,
promChartVersion,
prometheusRegexValue, promHelmValuesFileDir, null,
IT_MONITORINGEXPORTERMF_PROMETHEUS_HTTP_NODEPORT, IT_MONITORINGEXPORTERMF_ALERT_HTTP_NODEPORT);
} else {
promHelmParams = installAndVerifyPrometheus(releaseSuffix,
monitoringNS,
promChartVersion,
prometheusRegexValue, promHelmValuesFileDir);
}
assertNotNull(promHelmParams, " Failed to install prometheus");
nodeportPrometheus = promHelmParams.getNodePortServer();
String host = formatIPv6Host(K8S_NODEPORT_HOST);
if (TestConstants.KIND_CLUSTER
&& !TestConstants.WLSIMG_BUILDER.equals(TestConstants.WLSIMG_BUILDER_DEFAULT)) {
if (KIND_CLUSTER && !WLSIMG_BUILDER.equals(WLSIMG_BUILDER_DEFAULT)) {
host = formatIPv6Host(InetAddress.getLocalHost().getHostAddress());
nodeportPrometheus = IT_MONITORINGEXPORTER_PROMETHEUS_HTTP_HOSTPORT;
nodeportPrometheus = IT_MONITORINGEXPORTERMF_PROMETHEUS_HTTP_HOSTPORT;
}
hostPortPrometheus = host + ":" + nodeportPrometheus;

Expand Down Expand Up @@ -753,7 +764,7 @@ private void appendConfiguration(String configFile) throws Exception {
private static void installTraefikIngressController() throws IOException {
// install and verify Traefik
logger.info("Installing Traefik controller using helm");
if (TestConstants.WLSIMG_BUILDER.equals(TestConstants.WLSIMG_BUILDER_DEFAULT)) {
if (WLSIMG_BUILDER.equals(WLSIMG_BUILDER_DEFAULT)) {
traefikParams = installAndVerifyTraefik(traefikNamespace, 0, 0);
traefikHelmParams = traefikParams.getHelmParams();
ingressClassName = traefikParams.getIngressClassName();
Expand All @@ -763,8 +774,7 @@ private static void installTraefikIngressController() throws IOException {
}

private int getTraefikLbNodePort(boolean isHttps) {
if (TestConstants.KIND_CLUSTER
&& !TestConstants.WLSIMG_BUILDER.equals(TestConstants.WLSIMG_BUILDER_DEFAULT)) {
if (KIND_CLUSTER && !WLSIMG_BUILDER.equals(WLSIMG_BUILDER_DEFAULT)) {
return isHttps ? TRAEFIK_INGRESS_HTTPS_HOSTPORT : TRAEFIK_INGRESS_HTTP_HOSTPORT;
}
logger.info("Getting web node port for Traefik loadbalancer {0}", traefikHelmParams.getReleaseName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,16 @@
import static oracle.weblogic.kubernetes.TestConstants.ADMIN_USERNAME_DEFAULT;
import static oracle.weblogic.kubernetes.TestConstants.GRAFANA_CHART_VERSION;
import static oracle.weblogic.kubernetes.TestConstants.IMAGE_PULL_POLICY;
import static oracle.weblogic.kubernetes.TestConstants.IT_MONITORINGEXPORTER_PROMETHEUS_HTTP_HOSTPORT;
import static oracle.weblogic.kubernetes.TestConstants.IT_MONITORINGEXPORTERSAMPLES_ALERT_HTTP_NODEPORT;
import static oracle.weblogic.kubernetes.TestConstants.IT_MONITORINGEXPORTERSAMPLES_NGINX_HTTPS_HOSTPORT;
import static oracle.weblogic.kubernetes.TestConstants.IT_MONITORINGEXPORTERSAMPLES_NGINX_HTTPS_NODEPORT;
import static oracle.weblogic.kubernetes.TestConstants.IT_MONITORINGEXPORTERSAMPLES_NGINX_HTTP_HOSTPORT;
import static oracle.weblogic.kubernetes.TestConstants.IT_MONITORINGEXPORTERSAMPLES_NGINX_HTTP_NODEPORT;
import static oracle.weblogic.kubernetes.TestConstants.IT_MONITORINGEXPORTERSAMPLES_PROMETHEUS_HTTP_HOSTPORT;
import static oracle.weblogic.kubernetes.TestConstants.IT_MONITORINGEXPORTERSAMPLES_PROMETHEUS_HTTP_NODEPORT;
import static oracle.weblogic.kubernetes.TestConstants.K8S_NODEPORT_HOST;
import static oracle.weblogic.kubernetes.TestConstants.KIND_CLUSTER;
import static oracle.weblogic.kubernetes.TestConstants.MANAGED_SERVER_NAME_BASE;
import static oracle.weblogic.kubernetes.TestConstants.NGINX_INGRESS_HTTPS_HOSTPORT;
import static oracle.weblogic.kubernetes.TestConstants.NGINX_INGRESS_HTTPS_NODEPORT;
import static oracle.weblogic.kubernetes.TestConstants.NGINX_INGRESS_HTTP_HOSTPORT;
import static oracle.weblogic.kubernetes.TestConstants.NGINX_INGRESS_HTTP_NODEPORT;
import static oracle.weblogic.kubernetes.TestConstants.OKD;
import static oracle.weblogic.kubernetes.TestConstants.OKE_CLUSTER_PRIVATEIP;
import static oracle.weblogic.kubernetes.TestConstants.PROMETHEUS_CHART_VERSION;
Expand All @@ -71,6 +74,8 @@
import static oracle.weblogic.kubernetes.TestConstants.TEST_IMAGES_REPO_SECRET_NAME;
import static oracle.weblogic.kubernetes.TestConstants.WEBLOGIC_IMAGE_NAME;
import static oracle.weblogic.kubernetes.TestConstants.WEBLOGIC_IMAGE_TAG;
import static oracle.weblogic.kubernetes.TestConstants.WLSIMG_BUILDER;
import static oracle.weblogic.kubernetes.TestConstants.WLSIMG_BUILDER_DEFAULT;
import static oracle.weblogic.kubernetes.actions.ActionConstants.MODEL_DIR;
import static oracle.weblogic.kubernetes.actions.ActionConstants.WLS;
import static oracle.weblogic.kubernetes.actions.TestActions.deleteImage;
Expand Down Expand Up @@ -247,21 +252,20 @@ public static void initAll(@Namespaces(6) List<String> namespaces) {
SESSMIGR_APP_NAME, MONEXP_IMAGE_NAME);
if (!OKD) {
// install and verify NGINX
if (!OKE_CLUSTER_PRIVATEIP) {
nginxHelmParams = installAndVerifyNginx(nginxNamespace,
NGINX_INGRESS_HTTP_NODEPORT, NGINX_INGRESS_HTTPS_NODEPORT);
if (OKE_CLUSTER_PRIVATEIP) {
nginxHelmParams = installAndVerifyNginx(nginxNamespace, 0, 0);
} else {
nginxHelmParams = installAndVerifyNginx(nginxNamespace,
0,0);
IT_MONITORINGEXPORTERSAMPLES_NGINX_HTTP_NODEPORT,
IT_MONITORINGEXPORTERSAMPLES_NGINX_HTTPS_NODEPORT);
}
String nginxServiceName = nginxHelmParams.getHelmParams().getReleaseName() + "-ingress-nginx-controller";
ingressIP = getServiceExtIPAddrtOke(nginxServiceName, nginxNamespace) != null
? getServiceExtIPAddrtOke(nginxServiceName, nginxNamespace) : K8S_NODEPORT_HOST;
logger.info("NGINX service name: {0}", nginxServiceName);
if (TestConstants.KIND_CLUSTER
&& !TestConstants.WLSIMG_BUILDER.equals(TestConstants.WLSIMG_BUILDER_DEFAULT)) {
nodeportshttp = NGINX_INGRESS_HTTP_HOSTPORT;
nodeportshttps = NGINX_INGRESS_HTTPS_HOSTPORT;
if (KIND_CLUSTER && !WLSIMG_BUILDER.equals(WLSIMG_BUILDER_DEFAULT)) {
nodeportshttp = IT_MONITORINGEXPORTERSAMPLES_NGINX_HTTP_HOSTPORT;
nodeportshttps = IT_MONITORINGEXPORTERSAMPLES_NGINX_HTTPS_HOSTPORT;
} else {
nodeportshttp = getServiceNodePort(nginxNamespace, nginxServiceName, "http");
nodeportshttps = getServiceNodePort(nginxNamespace, nginxServiceName, "https");
Expand Down Expand Up @@ -418,18 +422,23 @@ private void installPrometheusGrafana(String promChartVersion,
cleanupPromGrafanaClusterRoles(prometheusReleaseName,grafanaReleaseName);
String promHelmValuesFileDir = Paths.get(RESULTS_ROOT, this.getClass().getSimpleName(),
"prometheus" + releaseSuffix).toString();
promHelmParams = installAndVerifyPrometheus(releaseSuffix,
monitoringNS,
promChartVersion,
prometheusRegexValue,
promHelmValuesFileDir,
webhookNS);
if (KIND_CLUSTER && !WLSIMG_BUILDER.equals(WLSIMG_BUILDER_DEFAULT)) {
promHelmParams = installAndVerifyPrometheus(releaseSuffix,
monitoringNS,
promChartVersion,
prometheusRegexValue, promHelmValuesFileDir, webhookNS,
IT_MONITORINGEXPORTERSAMPLES_PROMETHEUS_HTTP_NODEPORT, IT_MONITORINGEXPORTERSAMPLES_ALERT_HTTP_NODEPORT);
} else {
promHelmParams = installAndVerifyPrometheus(releaseSuffix,
monitoringNS,
promChartVersion,
prometheusRegexValue, promHelmValuesFileDir, webhookNS);
}
assertNotNull(promHelmParams, " Failed to install prometheus");
nodeportPrometheus = promHelmParams.getNodePortServer();
String host = formatIPv6Host(K8S_NODEPORT_HOST);
if (TestConstants.KIND_CLUSTER
&& !TestConstants.WLSIMG_BUILDER.equals(TestConstants.WLSIMG_BUILDER_DEFAULT)) {
nodeportPrometheus = IT_MONITORINGEXPORTER_PROMETHEUS_HTTP_HOSTPORT;
if (KIND_CLUSTER && !WLSIMG_BUILDER.equals(WLSIMG_BUILDER_DEFAULT)) {
nodeportPrometheus = IT_MONITORINGEXPORTERSAMPLES_PROMETHEUS_HTTP_HOSTPORT;
host = formatIPv6Host(InetAddress.getLocalHost().getHostAddress());
}
prometheusDomainRegexValue = prometheusRegexValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,19 @@

import static oracle.weblogic.kubernetes.TestConstants.DOMAIN_STATUS_CONDITION_FAILED_TYPE;
import static oracle.weblogic.kubernetes.TestConstants.GRAFANA_CHART_VERSION;
import static oracle.weblogic.kubernetes.TestConstants.IT_MONITORINGEXPORTER_PROMETHEUS_HTTP_HOSTPORT;
import static oracle.weblogic.kubernetes.TestConstants.IT_MONITORINGEXPORTERSIDECAR_ALERT_HTTP_NODEPORT;
import static oracle.weblogic.kubernetes.TestConstants.IT_MONITORINGEXPORTERSIDECAR_PROMETHEUS_HTTP_HOSTPORT;
import static oracle.weblogic.kubernetes.TestConstants.IT_MONITORINGEXPORTERSIDECAR_PROMETHEUS_HTTP_NODEPORT;
import static oracle.weblogic.kubernetes.TestConstants.K8S_NODEPORT_HOST;
import static oracle.weblogic.kubernetes.TestConstants.KIND_CLUSTER;
import static oracle.weblogic.kubernetes.TestConstants.KUBERNETES_CLI;
import static oracle.weblogic.kubernetes.TestConstants.OKD;
import static oracle.weblogic.kubernetes.TestConstants.OKE_CLUSTER_PRIVATEIP;
import static oracle.weblogic.kubernetes.TestConstants.PROMETHEUS_CHART_VERSION;
import static oracle.weblogic.kubernetes.TestConstants.RESULTS_ROOT;
import static oracle.weblogic.kubernetes.TestConstants.TEST_IMAGES_REPO_SECRET_NAME;
import static oracle.weblogic.kubernetes.TestConstants.WLSIMG_BUILDER;
import static oracle.weblogic.kubernetes.TestConstants.WLSIMG_BUILDER_DEFAULT;
import static oracle.weblogic.kubernetes.actions.ActionConstants.MODEL_DIR;
import static oracle.weblogic.kubernetes.actions.ActionConstants.RESOURCE_DIR;
import static oracle.weblogic.kubernetes.actions.TestActions.deletePersistentVolume;
Expand Down Expand Up @@ -471,11 +476,18 @@ private void installPrometheusGrafana(String promChartVersion,
cleanupPromGrafanaClusterRoles(prometheusReleaseName,grafanaReleaseName);
String promHelmValuesFileDir = Paths.get(RESULTS_ROOT, this.getClass().getSimpleName(),
"prometheus" + releaseSuffix).toString();
promHelmParams = installAndVerifyPrometheus(releaseSuffix,
monitoringNS,
promChartVersion,
prometheusRegexValue,
promHelmValuesFileDir);
if (KIND_CLUSTER && !WLSIMG_BUILDER.equals(WLSIMG_BUILDER_DEFAULT)) {
promHelmParams = installAndVerifyPrometheus(releaseSuffix,
monitoringNS,
promChartVersion,
prometheusRegexValue, promHelmValuesFileDir, null,
IT_MONITORINGEXPORTERSIDECAR_PROMETHEUS_HTTP_NODEPORT, IT_MONITORINGEXPORTERSIDECAR_ALERT_HTTP_NODEPORT);
} else {
promHelmParams = installAndVerifyPrometheus(releaseSuffix,
monitoringNS,
promChartVersion,
prometheusRegexValue, promHelmValuesFileDir);
}
assertNotNull(promHelmParams, " Failed to install prometheus");
String command1 = KUBERNETES_CLI + " get svc -n " + monitoringNS;
assertDoesNotThrow(() -> ExecCommand.exec(command1,true));
Expand All @@ -489,10 +501,9 @@ private void installPrometheusGrafana(String promChartVersion,
if (!OKE_CLUSTER_PRIVATEIP) {
nodeportPrometheus = promHelmParams.getNodePortServer();
String host = formatIPv6Host(K8S_NODEPORT_HOST);
if (TestConstants.KIND_CLUSTER
&& !TestConstants.WLSIMG_BUILDER.equals(TestConstants.WLSIMG_BUILDER_DEFAULT)) {
if (KIND_CLUSTER && !WLSIMG_BUILDER.equals(WLSIMG_BUILDER_DEFAULT)) {
host = formatIPv6Host(InetAddress.getLocalHost().getHostAddress());
nodeportPrometheus = IT_MONITORINGEXPORTER_PROMETHEUS_HTTP_HOSTPORT;
nodeportPrometheus = IT_MONITORINGEXPORTERSIDECAR_PROMETHEUS_HTTP_HOSTPORT;
logger.info("Running in podman Debug 1 : {0}", hostPortPrometheus);
}
hostPortPrometheus = host + ":" + nodeportPrometheus;
Expand Down
Loading

0 comments on commit 54bbf58

Please sign in to comment.