Skip to content

Commit

Permalink
Merge branch 'istio-monexp' into 'main'
Browse files Browse the repository at this point in the history
Fix for podman nightly failures

See merge request weblogic-cloud/weblogic-kubernetes-operator!4676
  • Loading branch information
jshum2479 committed Apr 25, 2024
2 parents 0f64e8f + 547b139 commit 95390f9
Show file tree
Hide file tree
Showing 7 changed files with 142 additions and 43 deletions.
23 changes: 21 additions & 2 deletions Jenkinsfile.podman
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,9 @@ pipeline {
if kind delete cluster --name ${kind_name} --kubeconfig "${kubeconfig_file}"; then
echo "Deleted orphaned kind cluster ${kind_name}"
fi
# settings needed by elastic logging tests
echo "running sudo sysctl -w vm.max_map_count=262144"
sudo sysctl -w vm.max_map_count=262144
cat <<EOF | kind create cluster --name "${kind_name}" --kubeconfig "${kubeconfig_file}" --config=-
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
Expand Down Expand Up @@ -420,7 +423,7 @@ nodes:
protocol: TCP
- containerPort: 32170
hostPort: 2173
protocol: TCP
protocol: TCP
- containerPort: 32189
hostPort: 2182
protocol: TCP
Expand All @@ -432,7 +435,22 @@ nodes:
protocol: TCP
- containerPort: 32343
hostPort: 2343
protocol: TCP
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
extraMounts:
- hostPath: ${pv_root}
containerPath: ${pv_root}
Expand All @@ -447,6 +465,7 @@ EOF
for node in $(kind get nodes --name "${kind_name}"); do
kubectl annotate node ${node} tilt.dev/registry=localhost:${registry_port};
done
podman exec -it kind-worker bash -c "sysctl vm.max_map_count"

# Document the local registry
# https://github.com/kubernetes/enhancements/tree/master/keps/sig-cluster-lifecycle/generic/1755-communicating-a-local-registry
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@ public static void init(@Namespaces(2) List<String> namespaces) {
"elasticsearch:7.8.1", ELASTICSEARCH_IMAGE),"Failed to replace String: " + ELASTICSEARCH_IMAGE);
assertDoesNotThrow(() -> replaceStringInFile(destELKConfigFilePath.toString(),
"kibana:7.8.1", KIBANA_IMAGE),"Failed to replace String: " + KIBANA_IMAGE);
if (TestConstants.KIND_CLUSTER
&& !TestConstants.WLSIMG_BUILDER.equals(TestConstants.WLSIMG_BUILDER_DEFAULT)) {
assertDoesNotThrow(() -> replaceStringInFile(destELKConfigFilePath.toString(),
"'-w', 'vm.max_map_count=262144'", "'vm.max_map_count'"),
"Failed to replace String: " + "'-w', 'vm.max_map_count=262144'");
}

// install and verify Elasticsearch and Kibana;
elasticSearchHost = "elasticsearch." + elasticSearchNs + ".svc.cluster.local";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
package oracle.weblogic.kubernetes;

import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
Expand Down Expand Up @@ -47,13 +49,21 @@
import static oracle.weblogic.kubernetes.TestConstants.ADMIN_PASSWORD_DEFAULT;
import static oracle.weblogic.kubernetes.TestConstants.ADMIN_SERVER_NAME_BASE;
import static oracle.weblogic.kubernetes.TestConstants.ADMIN_USERNAME_DEFAULT;
import static oracle.weblogic.kubernetes.TestConstants.ITHPACUSTOMNGINX_INGRESS_HTTPS_NODEPORT;
import static oracle.weblogic.kubernetes.TestConstants.ITHPACUSTOMNGINX_INGRESS_HTTP_HOSTPORT;
import static oracle.weblogic.kubernetes.TestConstants.ITHPACUSTOMNGINX_INGRESS_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.MANAGED_SERVER_NAME_BASE;
import static oracle.weblogic.kubernetes.TestConstants.NGINX_CHART_VERSION;
import static oracle.weblogic.kubernetes.TestConstants.OKE_CLUSTER;
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 @@ -212,15 +222,23 @@ public static void initAll(@Namespaces(4) List<String> namespaces) {
);

// install and verify NGINX
nginxHelmParams = installAndVerifyNginx(nginxNamespace, 0, 0);

nginxHelmParams = installAndVerifyNginx(nginxNamespace, ITHPACUSTOMNGINX_INGRESS_HTTP_NODEPORT,
ITHPACUSTOMNGINX_INGRESS_HTTPS_NODEPORT, NGINX_CHART_VERSION, (OKE_CLUSTER ? null : "NodePort"));
String nginxServiceName = nginxHelmParams.getHelmParams().getReleaseName() + "-ingress-nginx-controller";
logger.info("NGINX service name: {0}", nginxServiceName);
nodeportshttp = getServiceNodePort(nginxNamespace, nginxServiceName, "http");
logger.info("NGINX http node port: {0}", nodeportshttp);
String host = formatIPv6Host(K8S_NODEPORT_HOST);
ingressIP = getServiceExtIPAddrtOke(nginxServiceName, nginxNamespace) != null
? getServiceExtIPAddrtOke(nginxServiceName, nginxNamespace) : host;
if (KIND_CLUSTER && !WLSIMG_BUILDER.equals(WLSIMG_BUILDER_DEFAULT)) {
try {
ingressIP = formatIPv6Host(InetAddress.getLocalHost().getHostAddress());
} catch (UnknownHostException ex) {
logger.severe(ex.getLocalizedMessage());
}
nodeportshttp = ITHPACUSTOMNGINX_INGRESS_HTTP_HOSTPORT;
}

// create cluster resouce with limits and requests in serverPod
ClusterResource clusterResource =
Expand Down Expand Up @@ -289,6 +307,15 @@ void testHPAWithCustomMetrics() {
//invoke app 20 times to generate metrics with number of opened sessions > 5
String host = formatIPv6Host(K8S_NODEPORT_HOST);
String hostPort = OKE_CLUSTER_PRIVATEIP ? ingressIP : host + ":" + nodeportshttp;
if (KIND_CLUSTER && !WLSIMG_BUILDER.equals(WLSIMG_BUILDER_DEFAULT)) {
try {
host = formatIPv6Host(InetAddress.getLocalHost().getHostAddress());
} catch (UnknownHostException ex) {
logger.severe(ex.getLocalizedMessage());
}
nodeportshttp = ITHPACUSTOMNGINX_INGRESS_HTTP_HOSTPORT;
hostPort = host + ":" + nodeportshttp;
}
String curlCmd =
String.format("curl --silent --show-error --noproxy '*' -H 'host: %s' http://%s:%s@%s/" + SESSMIGT_APP_URL,
ingressHostList.get(0),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

package oracle.weblogic.kubernetes;

import java.net.InetAddress;
import java.net.UnknownHostException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
Expand All @@ -24,7 +26,11 @@

import static oracle.weblogic.kubernetes.TestConstants.ADMIN_PASSWORD_DEFAULT;
import static oracle.weblogic.kubernetes.TestConstants.ADMIN_USERNAME_DEFAULT;
import static oracle.weblogic.kubernetes.TestConstants.ISTIO_HTTP_HOSTPORT;
import static oracle.weblogic.kubernetes.TestConstants.IT_ISTIOMONITORINGEXPORTER_PROM_HTTP_CONAINERPORT;
import static oracle.weblogic.kubernetes.TestConstants.IT_ISTIOMONITORINGEXPORTER_PROM_HTTP_HOSTPORT;
import static oracle.weblogic.kubernetes.TestConstants.K8S_NODEPORT_HOST;
import static oracle.weblogic.kubernetes.TestConstants.OCNE;
import static oracle.weblogic.kubernetes.TestConstants.OKE_CLUSTER;
import static oracle.weblogic.kubernetes.TestConstants.OKE_CLUSTER_PRIVATEIP;
import static oracle.weblogic.kubernetes.TestConstants.RESULTS_ROOT;
Expand All @@ -38,7 +44,6 @@
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.createTestWebAppWarFile;
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.formatIPv6Host;
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.getImageBuilderExtraArgs;
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.getNextFreePort;
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.getServiceExtIPAddrtOke;
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.startPortForwardProcess;
import static oracle.weblogic.kubernetes.utils.CommonTestUtils.stopPortForwardProcess;
Expand Down Expand Up @@ -140,7 +145,7 @@ public static void initAll(@Namespaces(3) List<String> namespaces) {

// install and verify operator
installAndVerifyOperator(opNamespace, domain1Namespace, domain2Namespace);
prometheusPort = getNextFreePort();
prometheusPort = IT_ISTIOMONITORINGEXPORTER_PROM_HTTP_CONAINERPORT;
}

/**
Expand Down Expand Up @@ -223,6 +228,14 @@ private void deployPrometheusAndVerify(String domainNamespace, String domainUid,
// In internal OKE env, use Istio EXTERNAL-IP; in non-OKE env, use K8S_NODEPORT_HOST + ":" + istioIngressPort
hostPortPrometheus = getServiceExtIPAddrtOke(istioIngressServiceName, istioNamespace) != null
? getServiceExtIPAddrtOke(istioIngressServiceName, istioNamespace) : host + ":" + prometheusPort;
if (!TestConstants.WLSIMG_BUILDER.equals(TestConstants.WLSIMG_BUILDER_DEFAULT) && !OCNE) {
try {
hostPortPrometheus = InetAddress.getLocalHost().getHostAddress()
+ ":" + IT_ISTIOMONITORINGEXPORTER_PROM_HTTP_HOSTPORT;
} catch (UnknownHostException ex) {
logger.severe(ex.getLocalizedMessage());
}
}

if (OKE_CLUSTER_PRIVATEIP) {
String localhost = "localhost";
Expand All @@ -233,7 +246,6 @@ private void deployPrometheusAndVerify(String domainNamespace, String domainUid,
logger.info("Forwarded local port is {0}", forwardPort);
hostPortPrometheus = localhost + ":" + forwardPort;
isPrometheusPortForward = true;

}
} else {
String newRegex = String.format("regex: %s;%s", domainNamespace, domainUid);
Expand Down Expand Up @@ -394,7 +406,17 @@ private void setupIstioModelInImageDomain(String miiImage, String domainNamespac
// In internal OKE env, use Istio EXTERNAL-IP; in non-OKE env, use K8S_NODEPORT_HOST + ":" + istioIngressPort
String hostAndPort = getServiceExtIPAddrtOke(istioIngressServiceName, istioNamespace) != null
? getServiceExtIPAddrtOke(istioIngressServiceName, istioNamespace) : host + ":" + istioIngressPort;


String deployHost = K8S_NODEPORT_HOST;
if (!TestConstants.WLSIMG_BUILDER.equals(TestConstants.WLSIMG_BUILDER_DEFAULT) && !OCNE) {
istioIngressPort = ISTIO_HTTP_HOSTPORT;
try {
hostAndPort = InetAddress.getLocalHost().getHostAddress() + ":" + istioIngressPort;
deployHost = InetAddress.getLocalHost().getHostAddress();
} catch (UnknownHostException ex) {
logger.severe(ex.getLocalizedMessage());
}
}
String readyAppUrl = "http://" + hostAndPort + "/weblogic/ready";
boolean checlReadyApp =
checkAppUsingHostHeader(readyAppUrl, domainNamespace + ".org");
Expand All @@ -406,7 +428,7 @@ private void setupIstioModelInImageDomain(String miiImage, String domainNamespac
ExecResult result = OKE_CLUSTER
? deployUsingRest(hostAndPort, ADMIN_USERNAME_DEFAULT, ADMIN_PASSWORD_DEFAULT,
target, archivePath, domainNamespace + ".org", "testwebapp")
: deployToClusterUsingRest(K8S_NODEPORT_HOST,
: deployToClusterUsingRest(deployHost,
String.valueOf(istioIngressPort),
ADMIN_USERNAME_DEFAULT, ADMIN_PASSWORD_DEFAULT,
clusterName, archivePath, domainNamespace + ".org", "testwebapp");
Expand Down
Loading

0 comments on commit 95390f9

Please sign in to comment.