Skip to content

Commit

Permalink
Merge branch 'try-ipv6-sankar' into 'main'
Browse files Browse the repository at this point in the history
update tests for running in kubernetes clusters configured  for IPV6 addresses

See merge request weblogic-cloud/weblogic-kubernetes-operator!4496
  • Loading branch information
rjeberhard committed Nov 13, 2023
2 parents c87440d + a2b05f8 commit 141657b
Show file tree
Hide file tree
Showing 39 changed files with 500 additions and 185 deletions.
22 changes: 18 additions & 4 deletions Jenkinsfile.kindnightly
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ def kind_k8s_map = [
def _kind_image = null
CRON_SETTINGS = '''H 1 * * * % MAVEN_PROFILE_NAME=kind-parallel
H 2 * * * % MAVEN_PROFILE_NAME=kind-sequential
H 3 * * * % MAVEN_PROFILE_NAME=kind-upgrade;KUBE_VERSION=1.24.12;KIND_VERSION=0.18.0'''
H 3 * * * % MAVEN_PROFILE_NAME=kind-upgrade;KUBE_VERSION=1.24.12;KIND_VERSION=0.18.0
H 4 * * * % MAVEN_PROFILE_NAME=ipv6;IP_FAMILY=ipv6'''


pipeline {
Expand Down Expand Up @@ -108,6 +109,14 @@ pipeline {
description: 'The branch to run the tests on',
defaultValue: 'main'
)
choice(name: 'IP_FAMILY',
description: 'Ip Family.',
choices: [
'ipv4',
'ipv6',
'dual'
]
)
choice(name: 'MAVEN_PROFILE_NAME',
description: 'Profile to use in mvn command to run the tests. Possible values are kind-parallel (the default), kind-sequential, kind-upgrade,toolkits-srg, wls-srg and integration-tests. Refer to weblogic-kubernetes-operator/integration-tests/pom.xml on the branch.',
choices: [
Expand All @@ -116,7 +125,8 @@ pipeline {
'kind-upgrade',
'integration-tests',
'toolkits-srg',
'wls-srg'
'wls-srg',
'ipv6'
]
)
string(name: 'IT_TEST',
Expand Down Expand Up @@ -434,7 +444,7 @@ pipeline {
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
networking:
podSubnet: 192.168.0.0/16
ipFamily: ${IP_FAMILY}
containerdConfigPatches:
- |-
[plugins."io.containerd.grpc.v1.cri".registry.mirrors."localhost:${registry_port}"]
Expand Down Expand Up @@ -525,7 +535,11 @@ EOF
export KUBECONFIG=${kubeconfig_file}
mkdir -m777 -p "${WORKSPACE}/.mvn"
touch ${WORKSPACE}/.mvn/maven.config
K8S_NODEPORT_HOST=$(kubectl get node kind-worker -o jsonpath='{.status.addresses[?(@.type == "InternalIP")].address}')
address_stack=$(kubectl get node kind-worker -o jsonpath='{.status.addresses[?(@.type == "InternalIP")].address}')
addresses=($address_stack)
echo address_stack
echo "IPV4 address ${addresses[0]}"
K8S_NODEPORT_HOST=${addresses[0]}
if [ "${MAVEN_PROFILE_NAME}" == "kind-sequential" ]; then
PARALLEL_RUN='false'
fi
Expand Down
65 changes: 63 additions & 2 deletions integration-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,69 @@
</includes-failsafe>
</properties>
</profile>

<profile>
<id>ipv6</id>
<properties>
<skipITs>false</skipITs>
<includes-failsafe>
**/ItCoherenceTests,
**/ItConfigDistributionStrategy,
**/ItConsensusLeasingValidation,
**/ItDataHomeOverride,
**/ItDiagnosticsCompleteAvailableCondition,
**/ItElasticLoggingFluentd,
**/ItElasticLoggingSample,
**/ItEvictedPodsCycling,
**/ItExternalNodePortService,
**/ItHorizontalPodAutoscaler,
**/ItHorizontalPodAutoscalerCustomMetrics,
**/ItInitContainers,
**/ItIntrospectVersion,
**/ItIstioCoherenceTests,
**/ItIstioDomainInImage,
**/ItIstioManagedCoherence,
**/ItIstioMiiDomain,
**/ItIstioMonitoringExporter,
**/ItIstioProductionSecureMode,
**/ItIstioSessionMigration,
**/ItKubernetesDomainEvents,
**/ItKubernetesNameSpaceWatchingEvents,
**/ItLBTwoDomainsNginx,
**/ItLBTwoDomainsTraefik,
**/ItLivenessProbeCustomization,
**/ItManageNameSpace,
**/ItManagedCoherence,
**/ItMaxConcurOptions,
**/ItMiiAuxiliaryImage,
**/ItMiiClusterResource,
**/ItMiiCreateAuxImageWithImageTool,
**/ItMiiCustomSslStore,
**/ItMiiDomain,
**/ItMiiDomainModelInPV,
**/ItMiiDynamicUpdatePart1,
**/ItMiiDynamicUpdatePart2,
**/ItMiiDynamicUpdatePart3,
**/ItMiiMultiModel,
**/ItMiiUpdateDomainConfig,
**/ItMonitoringExporterSideCar,
**/ItOperatorRestart,
**/ItPodTemplates,
**/ItPodsRestart,
**/ItPodsShutdownOption,
**/ItProductionSecureMode,
**/ItRecoveryDomainInPV,
**/ItRemoteConsole,
**/ItRetryImprovementMisc,
**/ItRetryImprovements,
**/ItServerStartPolicy,
**/ItServerStartPolicyConfigCluster,
**/ItServerStartPolicyDynamicCluster,
**/ItSystemResOverrides,
**/ItTwoDomainsManagedByTwoOperators,
**/ItWlsDomainOnPV
</includes-failsafe>
</properties>
</profile>
<profile>
<id>wko-okd-fmw-cert</id>
<properties>
Expand All @@ -605,7 +667,6 @@
</includes-failsafe>
</properties>
</profile>

<profile>
<id>wko-okd-wls-cert</id>
<properties>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2020, 2022, Oracle and/or its affiliates.
// Copyright (c) 2020, 2022, 2023, Oracle and/or its affiliates.
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.

package oracle.weblogic.kubernetes;
Expand Down Expand Up @@ -384,7 +384,7 @@ private static void buildApplicationsAndDomains() {
@DisplayName("Check cross domain transaction works")
void testCrossDomainTransaction() {

String curlRequest = String.format("curl -v --show-error --noproxy '*' "
String curlRequest = String.format("curl -g -v --show-error --noproxy '*' "
+ "http://%s/TxForward/TxForward?urls=t3://%s.%s:7001,t3://%s1.%s:8001,t3://%s1.%s:8001,t3://%s2.%s:8001",
hostAndPort, domain1AdminServerPodName, domain1Namespace,
domain1ManagedServerPrefix, domain1Namespace, domain2ManagedServerPrefix, domain2Namespace,
Expand Down Expand Up @@ -418,7 +418,7 @@ void testCrossDomainTransaction() {
@DisplayName("Check cross domain transaction with TMAfterTLogBeforeCommitExit property commits")
void testCrossDomainTransactionWithFailInjection() {

String curlRequest = String.format("curl -v --show-error --noproxy '*' "
String curlRequest = String.format("curl -g -v --show-error --noproxy '*' "
+ "http://%s/cdttxservlet/cdttxservlet?namespaces=%s,%s",
hostAndPort, domain1Namespace, domain2Namespace);

Expand Down Expand Up @@ -462,7 +462,7 @@ void testCrossDomainTranscatedMDB() {

logger.info("MDB application is activated on domain1/cluster");

String curlRequest = String.format("curl -v --show-error --noproxy '*' "
String curlRequest = String.format("curl -g -v --show-error --noproxy '*' "
+ "\"http://%s/jmsservlet/jmstest?"
+ "url=t3://domain2-cluster-cluster-1.%s:8001&"
+ "cf=jms.ClusterConnectionFactory&"
Expand All @@ -486,7 +486,7 @@ void testCrossDomainTranscatedMDB() {
}

private boolean checkLocalQueue() {
String curlString = String.format("curl -v --show-error --noproxy '*' "
String curlString = String.format("curl -g -v --show-error --noproxy '*' "
+ "\"http://%s/jmsservlet/jmstest?"
+ "url=t3://localhost:7001&"
+ "action=receive&dest=jms.testAccountingQueue\"",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,11 @@ private static void buildApplicationsAndDomains() {
// We can not verify Rest Management console thru Adminstration NodePort
// in istio, as we can not enable Adminstration NodePort
if (!WEBLOGIC_SLIM) {
String consoleUrl = "http://" + hostAndPort + "/console/login/LoginForm.jsp";
String host = K8S_NODEPORT_HOST;
if (host.contains(":")) {
host = "[" + host + "]";
}
String consoleUrl = "http://" + host + ":" + istioIngressPort + "/console/login/LoginForm.jsp";
boolean checkConsole =
checkAppUsingHostHeader(consoleUrl, "domain1-" + domain1Namespace + ".org");
assertTrue(checkConsole, "Failed to access WebLogic console on domain1");
Expand Down Expand Up @@ -445,7 +449,7 @@ void testIstioCrossDomainTransaction() {
@DisplayName("Check cross domain transaction with istio and with TMAfterTLogBeforeCommitExit property commits")
@DisabledIfEnvironmentVariable(named = "OKE_CLUSTER", matches = "true")
void testIstioCrossDomainTransactionWithFailInjection() {
String curlRequest = String.format("curl -v --show-error --noproxy '*' "
String curlRequest = String.format("curl -g -v --show-error --noproxy '*' "
+ "-H 'host:domain1-" + domain1Namespace + ".org' "
+ "http://%s:%s/cdttxservlet/cdttxservlet?namespaces=%s,%s",
K8S_NODEPORT_HOST, istioIngressPort, domain1Namespace, domain2Namespace);
Expand Down Expand Up @@ -491,21 +495,27 @@ void testIstioCrossDomainTranscatedMDB() {
"MDB application can not be activated on domain1/cluster");

logger.info("MDB application is activated on domain1/cluster");

String host = K8S_NODEPORT_HOST;
if (host.contains(":")) {
host = "[" + host + "]";
}
String curlRequest = OKE_CLUSTER
? String.format("curl -v --show-error --noproxy '*' "
? String.format("curl -g -v --show-error --noproxy '*' "
+ "-H 'host:domain1-" + domain1Namespace + ".org' "
+ "\"http://%s/jmsservlet/jmstest?"
+ "url=t3://domain2-cluster-cluster-1.%s:8001&"
+ "cf=jms.ClusterConnectionFactory&"
+ "action=send&"
+ "dest=jms/testCdtUniformTopic\"", hostAndPort, domain2Namespace)
: String.format("curl -v --show-error --noproxy '*' "
: String.format("curl -g -v --show-error --noproxy '*' "
+ "-H 'host:domain1-" + domain1Namespace + ".org' "
+ "\"http://%s:%s/jmsservlet/jmstest?"
+ "url=t3://domain2-cluster-cluster-1.%s:8001&"
+ "cf=jms.ClusterConnectionFactory&"
+ "action=send&"
+ "dest=jms/testCdtUniformTopic\"", K8S_NODEPORT_HOST, istioIngressPort, domain2Namespace);
+ "dest=jms/testCdtUniformTopic\"",
host, istioIngressPort, domain2Namespace);

ExecResult result = null;
logger.info("curl command {0}", curlRequest);
Expand All @@ -521,23 +531,27 @@ void testIstioCrossDomainTranscatedMDB() {
}

private boolean checkLocalQueue() {
String host = K8S_NODEPORT_HOST;
if (host.contains(":")) {
host = "[" + host + "]";
}
// In internal OKE env, use Istio EXTERNAL-IP;
// in non-internal-OKE env, use K8S_NODEPORT_HOST + ":" + istioIngressPort
String hostAndPort = getServiceExtIPAddrtOke(istioIngressServiceName, istioNamespace) != null
? getServiceExtIPAddrtOke(istioIngressServiceName, istioNamespace)
: K8S_NODEPORT_HOST + ":" + istioIngressPort;
: host + ":" + istioIngressPort;

String curlString = OKE_CLUSTER
? String.format("curl -v --show-error --noproxy '*' "
? String.format("curl -g -v --show-error --noproxy '*' "
+ "-H 'host:domain1-" + domain1Namespace + ".org' "
+ "\"http://%s/jmsservlet/jmstest?"
+ "url=t3://localhost:7001&"
+ "action=receive&dest=jms.testAccountingQueue\"", hostAndPort)
: String.format("curl -v --show-error --noproxy '*' "
: String.format("curl -g -v --show-error --noproxy '*' "
+ "-H 'host:domain1-" + domain1Namespace + ".org' "
+ "\"http://%s:%s/jmsservlet/jmstest?"
+ "url=t3://localhost:7001&"
+ "action=receive&dest=jms.testAccountingQueue\"", K8S_NODEPORT_HOST, istioIngressPort);
+ "action=receive&dest=jms.testAccountingQueue\"", host, istioIngressPort);

logger.info("curl command {0}", curlString);
testUntil(assertDoesNotThrow(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2022, Oracle and/or its affiliates.
// Copyright (c) 2022, 2023, Oracle and/or its affiliates.
// Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.

package oracle.weblogic.kubernetes;
Expand Down Expand Up @@ -331,7 +331,11 @@ void testIstioEnabledFmwModelInImageWithDbOperator() {
// We can not verify Rest Management console thru Adminstration NodePort
// in istio, as we can not enable Adminstration NodePort
if (!WEBLOGIC_SLIM) {
String consoleUrl = "http://" + K8S_NODEPORT_HOST + ":" + istioIngressPort + "/console/login/LoginForm.jsp";
String host = K8S_NODEPORT_HOST;
if (host.contains(":")) {
host = "[" + host + "]";
}
String consoleUrl = "http://" + host + ":" + istioIngressPort + "/console/login/LoginForm.jsp";
boolean checkConsole =
checkAppUsingHostHeader(consoleUrl, fmwDomainNamespace + ".org");
assertTrue(checkConsole, "Failed to access WebLogic console");
Expand All @@ -353,10 +357,14 @@ void testIstioEnabledFmwModelInImageWithDbOperator() {
}

if (isWebLogicPsuPatchApplied()) {
String curlCmd2 = "curl -j -sk --show-error --noproxy '*' "
String host = K8S_NODEPORT_HOST;
if (host.contains(":")) {
host = "[" + host + "]";
}
String curlCmd2 = "curl -g -j -sk --show-error --noproxy '*' "
+ " -H 'Host: " + fmwDomainNamespace + ".org'"
+ " --user " + ADMIN_USERNAME_DEFAULT + ":" + ADMIN_PASSWORD_DEFAULT
+ " --url http://" + K8S_NODEPORT_HOST + ":" + istioIngressPort
+ " --url http://" + host + ":" + istioIngressPort
+ "/management/weblogic/latest/domainRuntime/domainSecurityRuntime?"
+ "link=none";

Expand Down Expand Up @@ -389,7 +397,11 @@ void testIstioEnabledFmwModelInImageWithDbOperator() {
logger.info("Application deployment returned {0}", result.toString());
assertEquals("202", result.stdout(), "Deployment didn't return HTTP status code 202");

String url = "http://" + K8S_NODEPORT_HOST + ":" + istioIngressPort + "/testwebapp/index.jsp";
String host = K8S_NODEPORT_HOST;
if (host.contains(":")) {
host = "[" + host + "]";
}
String url = "http://" + host + ":" + istioIngressPort + "/testwebapp/index.jsp";
logger.info("Application Access URL {0}", url);
hostHeader = fmwDomainNamespace + ".org";
boolean checkApp = checkAppUsingHostHeader(url, hostHeader);
Expand Down Expand Up @@ -622,7 +634,7 @@ private void runJmsClientOnAdminPod(String action, String queue) {
**/
private boolean checkJmsServerRuntime(String jmsServer, String managedServer) {
String hostAndPort = getHostAndPort(adminSvcExtRouteHost, wlDomainIstioIngressPort);
StringBuffer curlString = new StringBuffer("status=$(curl --user "
StringBuffer curlString = new StringBuffer("status=$(curl -g --user "
+ ADMIN_USERNAME_DEFAULT + ":" + ADMIN_PASSWORD_DEFAULT
+ " -H 'host: " + hostHeader + " ' ");
curlString.append("http://" + hostAndPort)
Expand Down Expand Up @@ -651,7 +663,7 @@ private boolean checkJmsServerRuntime(String jmsServer, String managedServer) {
**/
private boolean checkStoreRuntime(String storeName, String managedServer) {
String hostAndPort = getHostAndPort(adminSvcExtRouteHost, wlDomainIstioIngressPort);
StringBuffer curlString = new StringBuffer("status=$(curl --user "
StringBuffer curlString = new StringBuffer("status=$(curl -g --user "
+ ADMIN_USERNAME_DEFAULT + ":" + ADMIN_PASSWORD_DEFAULT + " "
+ " -H 'host: " + hostHeader + " ' ");
curlString.append("http://" + hostAndPort)
Expand Down Expand Up @@ -682,7 +694,7 @@ private boolean checkStoreRuntime(String storeName, String managedServer) {
**/
private boolean checkJtaRecoveryServiceRuntime(String managedServer, String recoveryService, String active) {
String hostAndPort = getHostAndPort(adminSvcExtRouteHost, wlDomainIstioIngressPort);
StringBuffer curlString = new StringBuffer("curl --user "
StringBuffer curlString = new StringBuffer("curl -g --user "
+ ADMIN_USERNAME_DEFAULT + ":" + ADMIN_PASSWORD_DEFAULT
+ " -H 'host: " + hostHeader + " ' ");
curlString.append("\"http://" + hostAndPort)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,13 @@ void testIstioDomainHomeInImage() {
// We can not verify Rest Management console thru Adminstration NodePort
// in istio, as we can not enable Adminstration NodePort
if (!WEBLOGIC_SLIM) {
String consoleUrl = "http://" + hostAndPort + "/console/login/LoginForm.jsp";
boolean checkConsole = checkAppUsingHostHeader(consoleUrl, domainNamespace + ".org");
String host = K8S_NODEPORT_HOST;
if (host.contains(":")) {
host = "[" + host + "]";
}
String consoleUrl = "http://" + host + ":" + istioIngressPort + "/console/login/LoginForm.jsp";
boolean checkConsole =
checkAppUsingHostHeader(consoleUrl, domainNamespace + ".org");
assertTrue(checkConsole, "Failed to access WebLogic console");
logger.info("WebLogic console is accessible");
String localhost = "localhost";
Expand Down Expand Up @@ -252,14 +257,19 @@ void testIstioDomainHomeInImage() {
assertEquals("202", result.stdout(), "Deployment didn't return HTTP status code 202");
logger.info("Application {0} deployed successfully at {1}", "testwebapp.war", domainUid + "-" + clusterName);

String host = K8S_NODEPORT_HOST;
if (host.contains(":")) {
host = "[" + host + "]";
}
String url = "http://" + host + ":" + istioIngressPort + "/testwebapp/index.jsp";

if (OKE_CLUSTER) {
testUntil(isAppInServerPodReady(domainNamespace,
managedServerPrefix + 1, 8001, "/testwebapp/index.jsp", "testwebapp"),
logger, "Check Deployed App {0} in server {1}",
archivePath,
target);
} else {
String url = "http://" + hostAndPort + "/testwebapp/index.jsp";
logger.info("Application Access URL {0}", url);
boolean checkApp = checkAppUsingHostHeader(url, domainNamespace + ".org");
assertTrue(checkApp, "Failed to access WebLogic application");
Expand All @@ -272,10 +282,10 @@ void testIstioDomainHomeInImage() {

logger.info("Istio Ingress Port is {0}", istioIngressPort);
if (isWebLogicPsuPatchApplied()) {
String curlCmd2 = "curl -j -sk --show-error --noproxy '*' "
String curlCmd2 = "curl -g -j -sk --show-error --noproxy '*' "
+ " -H 'Host: " + domainNamespace + ".org'"
+ " --user " + ADMIN_USERNAME_DEFAULT + ":" + ADMIN_PASSWORD_DEFAULT
+ " --url http://" + hostAndPort
+ " --url http://" + host + ":" + istioIngressPort
+ "/management/weblogic/latest/domainRuntime/domainSecurityRuntime?"
+ "link=none";

Expand Down
Loading

0 comments on commit 141657b

Please sign in to comment.