diff --git a/Jenkinsfile.kindnightly b/Jenkinsfile.kindnightly index 68c3e97e031..c2375aa445b 100644 --- a/Jenkinsfile.kindnightly +++ b/Jenkinsfile.kindnightly @@ -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 { @@ -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: [ @@ -116,7 +125,8 @@ pipeline { 'kind-upgrade', 'integration-tests', 'toolkits-srg', - 'wls-srg' + 'wls-srg', + 'ipv6' ] ) string(name: 'IT_TEST', @@ -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}"] @@ -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 diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml index 49ef72e9654..65ae085fbeb 100644 --- a/integration-tests/pom.xml +++ b/integration-tests/pom.xml @@ -589,7 +589,69 @@ - + + ipv6 + + false + + **/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 + + + wko-okd-fmw-cert @@ -605,7 +667,6 @@ - wko-okd-wls-cert diff --git a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItCrossDomainTransaction.java b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItCrossDomainTransaction.java index fe768a7ed2b..ee8010ece9f 100644 --- a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItCrossDomainTransaction.java +++ b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItCrossDomainTransaction.java @@ -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; @@ -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, @@ -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); @@ -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&" @@ -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\"", diff --git a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioCrossDomainTransaction.java b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioCrossDomainTransaction.java index 7873239bf94..5ea687706dc 100644 --- a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioCrossDomainTransaction.java +++ b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioCrossDomainTransaction.java @@ -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"); @@ -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); @@ -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); @@ -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( diff --git a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioDBOperator.java b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioDBOperator.java index 474bb941d5f..3cb96ab6cc5 100644 --- a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioDBOperator.java +++ b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioDBOperator.java @@ -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; @@ -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"); @@ -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"; @@ -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); @@ -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) @@ -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) @@ -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) diff --git a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioDomainInImage.java b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioDomainInImage.java index 0be04c734eb..c3850ad5143 100644 --- a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioDomainInImage.java +++ b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioDomainInImage.java @@ -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"; @@ -252,6 +257,12 @@ 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"), @@ -259,7 +270,6 @@ void testIstioDomainHomeInImage() { 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"); @@ -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"; diff --git a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioDomainInPV.java b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioDomainInPV.java index 682d7c928b2..eef58fb1a3a 100644 --- a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioDomainInPV.java +++ b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioDomainInPV.java @@ -324,12 +324,17 @@ void testIstioDomainHomeInPv() { // In internal OKE env, use Istio EXTERNAL-IP; // in non-internal-OKE env, use K8S_NODEPORT_HOST + ":" + istioIngressPort String hostAndPort = hostName.equals(K8S_NODEPORT_HOST) ? K8S_NODEPORT_HOST + ":" + istioIngressPort : hostName; + String host = K8S_NODEPORT_HOST; + if (host.contains(":")) { + host = "[" + host + "]"; + } // 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"); + if (!WEBLOGIC_SLIM) { + 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"; @@ -347,10 +352,10 @@ void testIstioDomainHomeInPv() { ExecResult result = null; 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://" + K8S_NODEPORT_HOST + ":" + istioIngressPort + + " --url http://" + host + ":" + istioIngressPort + "/management/weblogic/latest/domainRuntime/domainSecurityRuntime?" + "link=none"; @@ -376,7 +381,9 @@ void testIstioDomainHomeInPv() { String managedServerPrefix = domainUid + "-managed-"; String target = "{identity: [clusters,'" + clusterName + "']}"; - result = deployUsingRest(hostAndPort, ADMIN_USERNAME_DEFAULT, ADMIN_PASSWORD_DEFAULT, + String url = "http://" + host + ":" + istioIngressPort + "/testwebapp/index.jsp"; + logger.info("Application Access URL {0}", url); + result = deployUsingRest(host, ADMIN_USERNAME_DEFAULT, ADMIN_PASSWORD_DEFAULT, target, archivePath, domainNamespace + ".org", "testwebapp"); assertNotNull(result, "Application deployment failed"); logger.info("Application deployment returned {0}", result.toString()); @@ -384,13 +391,13 @@ void testIstioDomainHomeInPv() { logger.info("Application {0} deployed successfully at {1}", "testwebapp.war", domainUid + "-" + clusterName); testUntil(isAppInServerPodReady(domainNamespace, - managedServerPrefix + 1,8001, "/testwebapp/index.jsp","testwebapp"), + managedServerPrefix + 1, 8001, "/testwebapp/index.jsp", "testwebapp"), logger, "Check Deployed App {0} in server {1}", archivePath, target); } else { for (int i = 1; i <= 10; i++) { - result = deployToClusterUsingRest(K8S_NODEPORT_HOST, String.valueOf(istioIngressPort), + result = deployToClusterUsingRest(host, String.valueOf(istioIngressPort), ADMIN_USERNAME_DEFAULT, ADMIN_PASSWORD_DEFAULT, clusterName, archivePath, domainNamespace + ".org", "testwebapp"); assertNotNull(result, "Application deployment failed"); @@ -402,7 +409,7 @@ void testIstioDomainHomeInPv() { assertEquals("202", result.stdout(), "Application deployment failed with wrong HTTP code"); logger.info("Application {0} deployed successfully at {1}", "testwebapp.war", domainUid + "-" + clusterName); - String url = "http://" + K8S_NODEPORT_HOST + ":" + istioIngressPort + "/testwebapp/index.jsp"; + String url = "http://" + host + ":" + istioIngressPort + "/testwebapp/index.jsp"; logger.info("Application Access URL {0}", url); boolean checkApp = checkAppUsingHostHeader(url, domainNamespace + ".org"); assertTrue(checkApp, "Failed to access WebLogic application"); diff --git a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioManagedCoherence.java b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioManagedCoherence.java index 1af256d198a..a92456c0024 100644 --- a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioManagedCoherence.java +++ b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioManagedCoherence.java @@ -214,7 +214,12 @@ void testIstioMultiClusterCoherenceDomainInImageDomain() { logger.info("Istio Ingress Port is {0}", istioIngressPort); // Make sure ready app is accessible thru Istio Ingress Port - String curlCmd = "curl --silent --show-error --noproxy '*' http://" + hostAndPort + + String host = K8S_NODEPORT_HOST; + if (host.contains(":")) { + host = "[" + host + "]"; + } + String curlCmd = "curl -g --silent --show-error --noproxy '*' http://" + host + ":" + istioIngressPort + "/weblogic/ready --write-out %{http_code} -o /dev/null"; logger.info("Executing curl command {0}", curlCmd); assertTrue(callWebAppAndWaitTillReady(curlCmd, 60)); @@ -262,7 +267,12 @@ void testIstioMultiClusterCoherenceMiiDomain() { logger.info("Istio Ingress Port is {0}", istioIngressPort); // Make sure ready app is accessible thru Istio Ingress Port - String curlCmd = "curl --silent --show-error --noproxy '*' http://" + hostAndPort + + String host = K8S_NODEPORT_HOST; + if (host.contains(":")) { + host = "[" + host + "]"; + } + String curlCmd = "curl -g --silent --show-error --noproxy '*' http://" + host + ":" + istioIngressPort + "/weblogic/ready --write-out %{http_code} -o /dev/null"; logger.info("Executing curl command {0}", curlCmd); assertTrue(callWebAppAndWaitTillReady(curlCmd, 60)); @@ -366,7 +376,12 @@ void testIstioMultiClusterCoherenceMultiMiiDomain() { logger.info("Istio Ingress Port is {0}", istioIngressPort); // Make sure ready app is accessible thru Istio Ingress Port - String curlCmd = "curl --silent --show-error --noproxy '*' http://" + hostAndPort + + String host = K8S_NODEPORT_HOST; + if (host.contains(":")) { + host = "[" + host + "]"; + } + String curlCmd = "curl -g --silent --show-error --noproxy '*' http://" + host + ":" + istioIngressPort + "/weblogic/ready --write-out %{http_code} -o /dev/null"; logger.info("Executing curl command {0}", curlCmd); assertTrue(callWebAppAndWaitTillReady(curlCmd, 60)); @@ -492,6 +507,12 @@ private static void createDomainCrAndVerify(String adminSecretName, String domIm } private boolean coherenceCacheTest(int ingressServiceNodePort) { + + String host = K8S_NODEPORT_HOST; + if (host.contains(":")) { + host = "[" + host + "]"; + } + String hostAndPort = host + ":" + ingressServiceNodePort; logger.info("hostAndPort = {0} ", hostAndPort); // add the data to cache @@ -530,7 +551,7 @@ private ExecResult addDataToCache(String firstName, String secondName, String hostAndPort) { logger.info("Add initial data to cache"); - StringBuffer curlCmd = new StringBuffer("curl --silent --show-error --noproxy '*' "); + StringBuffer curlCmd = new StringBuffer("curl -g --silent --show-error --noproxy '*' "); curlCmd .append("-d 'action=add&first=") .append(firstName) @@ -554,7 +575,7 @@ private ExecResult addDataToCache(String firstName, private ExecResult getCacheSize(String hostAndPort) { logger.info("Get the number of records in cache"); - StringBuffer curlCmd = new StringBuffer("curl --silent --show-error --noproxy '*' "); + StringBuffer curlCmd = new StringBuffer("curl -g --silent --show-error --noproxy '*' "); curlCmd .append("-d 'action=size' ") .append(" http://") @@ -576,7 +597,7 @@ private ExecResult getCacheSize(String hostAndPort) { private ExecResult getCacheContents(String hostAndPort) { logger.info("Get the records from cache"); - StringBuffer curlCmd = new StringBuffer("curl --silent --show-error --noproxy '*' "); + StringBuffer curlCmd = new StringBuffer("curl -g --silent --show-error --noproxy '*' "); curlCmd .append("-d 'action=get' ") .append(" http://") @@ -598,7 +619,7 @@ private ExecResult getCacheContents(String hostAndPort) { private ExecResult clearCache(String hostAndPort) { logger.info("Clean the cache"); - StringBuffer curlCmd = new StringBuffer("curl --silent --show-error --noproxy '*' "); + StringBuffer curlCmd = new StringBuffer("curl -g --silent --show-error --noproxy '*' "); curlCmd .append("-d 'action=clear' ") .append(" http://") diff --git a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioMiiDomain.java b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioMiiDomain.java index 5fc5e1d209a..e276a1ace01 100644 --- a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioMiiDomain.java +++ b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioMiiDomain.java @@ -273,10 +273,14 @@ void testIstioModelInImageDomain() { } 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: " + domainNamespace + ".org'" + " --user " + ADMIN_USERNAME_DEFAULT + ":" + ADMIN_PASSWORD_DEFAULT - + " --url http://" + hostAndPort + + " --url http://" + host + ":" + istioIngressPort + "/management/weblogic/latest/domainRuntime/domainSecurityRuntime?" + "link=none"; @@ -316,6 +320,11 @@ void testIstioModelInImageDomain() { 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 + "]"; + } if (OKE_CLUSTER) { testUntil(isAppInServerPodReady(domainNamespace, managedServerPrefix + 1, 8001, "/testwebapp/index.jsp", "testwebapp"), @@ -323,7 +332,7 @@ void testIstioModelInImageDomain() { archivePath, target); } else { - String url = "http://" + K8S_NODEPORT_HOST + ":" + istioIngressPort + "/testwebapp/index.jsp"; + String url = "http://" + host + ":" + istioIngressPort + "/testwebapp/index.jsp"; logger.info("Application Access URL {0}", url); boolean checkApp = checkAppUsingHostHeader(url, domainNamespace + ".org"); assertTrue(checkApp, "Failed to access WebLogic application"); @@ -349,11 +358,12 @@ void testIstioModelInImageDomain() { verifyIntrospectorRuns(domainUid, domainNamespace); - String resourcePath = "/management/weblogic/latest/domainRuntime" - + "/serverRuntimes/managed-server1/applicationRuntimes" - + "/testwebapp/workManagerRuntimes/newWM/" - + "maxThreadsConstraintRuntime "; - String wmRuntimeUrl = "http://" + hostAndPort + resourcePath; + + String wmRuntimeUrl = "http://" + host + ":" + + istioIngressPort + "/management/weblogic/latest/domainRuntime" + + "/serverRuntimes/managed-server1/applicationRuntimes" + + "/testwebapp/workManagerRuntimes/newWM/" + + "maxThreadsConstraintRuntime "; boolean checkWm = checkAppUsingHostHeader(wmRuntimeUrl, domainNamespace + ".org"); assertTrue(checkWm, "Failed to access WorkManagerRuntime"); diff --git a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioMonitoringExporter.java b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioMonitoringExporter.java index abd6ce06f83..657d5d73f8c 100644 --- a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioMonitoringExporter.java +++ b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioMonitoringExporter.java @@ -204,8 +204,12 @@ private void deployPrometheusAndVerify(String domainNamespace, String domainUid, "Can't modify Prometheus CM, not possible to monitor " + domainUid); } //verify metrics via prometheus + String host = K8S_NODEPORT_HOST; + if (host.contains(":")) { + host = "[" + host + "]"; + } checkMetricsViaPrometheus(searchKey, "sessmigr", - K8S_NODEPORT_HOST + ":" + prometheusPort); + host + ":" + prometheusPort); } /** @@ -338,7 +342,11 @@ private void setupIstioModelInImageDomain(String miiImage, String domainNamespac // 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, domainNamespace + ".org"); assertTrue(checkConsole, "Failed to access WebLogic console"); @@ -357,7 +365,11 @@ private void setupIstioModelInImageDomain(String miiImage, String domainNamespac 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); } diff --git a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioTwoDomainsInImage.java b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioTwoDomainsInImage.java index 1a120bd455f..9fef17c4310 100644 --- a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioTwoDomainsInImage.java +++ b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItIstioTwoDomainsInImage.java @@ -270,16 +270,21 @@ void testIstioTwoDomainsWithSingleIngress() { int istioIngressPort = getIstioHttpIngressPort(); logger.info("Istio Ingress Port is {0}", istioIngressPort); - + + String host = K8S_NODEPORT_HOST; + if (host.contains(":")) { + host = "[" + host + "]"; + } // 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) - : K8S_NODEPORT_HOST + ":" + istioIngressPort; + : host + ":" + istioIngressPort; // 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 consoleUrl = "http://" + host + ":" + istioIngressPort + "/console/login/LoginForm.jsp"; boolean checkConsole = checkAppUsingHostHeader(consoleUrl, domainNamespace1 + ".org"); assertTrue(checkConsole, "Failed to access WebLogic console on domain1"); logger.info("WebLogic console on domain1 is accessible"); @@ -295,9 +300,9 @@ void testIstioTwoDomainsWithSingleIngress() { createBaseRepoSecret(domainNamespace1); ExecResult result = OKE_CLUSTER - ? deployUsingRest(hostAndPort, ADMIN_USERNAME_DEFAULT, ADMIN_PASSWORD_DEFAULT, + ? deployUsingRest(host, ADMIN_USERNAME_DEFAULT, ADMIN_PASSWORD_DEFAULT, target, archivePath, domainNamespace1 + ".org", "testwebapp") - : deployToClusterUsingRest(K8S_NODEPORT_HOST, String.valueOf(istioIngressPort), + : deployToClusterUsingRest(host, String.valueOf(istioIngressPort), ADMIN_USERNAME_DEFAULT, ADMIN_PASSWORD_DEFAULT, clusterName, archivePath, domainNamespace1 + ".org", "testwebapp"); @@ -314,18 +319,19 @@ void testIstioTwoDomainsWithSingleIngress() { archivePath, target); } else { - String url = "http://" + K8S_NODEPORT_HOST + ":" + istioIngressPort + resourcePath; + String url = "http://" + host + ":" + istioIngressPort + "/testwebapp/index.jsp"; logger.info("Application Access URL {0}", url); boolean checkApp = checkAppUsingHostHeader(url, domainNamespace1 + ".org"); assertTrue(checkApp, "Failed to access WebLogic application on domain1"); } - logger.info("Application {0} is accessble to {1}", resourcePath, domainUid2); + logger.info("Application {0} is accessble to {1}", resourcePath, domainUid1); // 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, domainNamespace2 + ".org"); + String consoleUrl = "http://" + host + ":" + istioIngressPort + "/console/login/LoginForm.jsp"; + boolean checkConsole + = checkAppUsingHostHeader(consoleUrl, domainNamespace2 + ".org"); assertTrue(checkConsole, "Failed to access domain2 WebLogic console"); logger.info("WebLogic console on domain2 is accessible"); } else { @@ -338,7 +344,7 @@ void testIstioTwoDomainsWithSingleIngress() { result = OKE_CLUSTER ? deployUsingRest(hostAndPort, ADMIN_USERNAME_DEFAULT, ADMIN_PASSWORD_DEFAULT, target, archivePath, domainNamespace2 + ".org", "testwebapp") - : deployToClusterUsingRest(K8S_NODEPORT_HOST, String.valueOf(istioIngressPort), + : deployToClusterUsingRest(host, String.valueOf(istioIngressPort), ADMIN_USERNAME_DEFAULT, ADMIN_PASSWORD_DEFAULT, clusterName, archivePath, domainNamespace2 + ".org", "testwebapp"); @@ -350,7 +356,7 @@ void testIstioTwoDomainsWithSingleIngress() { if (OKE_CLUSTER) { testUntil( isAppInServerPodReady(domainNamespace2, - managedServerPrefix2 + 1,8001, resourcePath,"testwebapp"), + managedServerPrefix2 + 1, 8001, resourcePath, "testwebapp"), logger, "Check Deployed App {0} in server {1}", archivePath, target); diff --git a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItLogHomeFlatStructure.java b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItLogHomeFlatStructure.java index 68847b770f1..87b5d7c8c8a 100644 --- a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItLogHomeFlatStructure.java +++ b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItLogHomeFlatStructure.java @@ -232,7 +232,7 @@ void testMiiHttpServerLogsAreOnPV() { for (String pod : podNames) { String curlCmd = "for i in {1..100}; " + "do " - + "curl -v http://" + pod + ":8001/sample-war/index.jsp;" + + "curl -g -v http://" + pod + ":8001/sample-war/index.jsp;" + "done"; testUntil( () -> { diff --git a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItManagedCoherence.java b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItManagedCoherence.java index b7ad1d515fe..6d612ce4597 100644 --- a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItManagedCoherence.java +++ b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItManagedCoherence.java @@ -1,4 +1,4 @@ -// Copyright (c) 2020, 2022, Oracle and/or its affiliates. +// Copyright (c) 2020, 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; @@ -370,7 +370,7 @@ private ExecResult addDataToCache(String firstName, String hostName, String hostAndPort) { logger.info("Add initial data to cache"); - StringBuffer curlCmd = new StringBuffer("curl --silent --show-error --noproxy '*' "); + StringBuffer curlCmd = new StringBuffer("curl -g --silent --show-error --noproxy '*' "); curlCmd .append("-d 'action=add&first=") .append(firstName) @@ -397,7 +397,7 @@ private ExecResult addDataToCache(String firstName, private ExecResult getCacheSize(String hostName, String hostAndPort) { logger.info("Get the number of records in cache"); - StringBuffer curlCmd = new StringBuffer("curl --silent --show-error --noproxy '*' "); + StringBuffer curlCmd = new StringBuffer("curl -g --silent --show-error --noproxy '*' "); curlCmd .append("-d 'action=size' ") .append("-H 'host: ") @@ -421,7 +421,7 @@ private ExecResult getCacheSize(String hostName, String hostAndPort) { private ExecResult getCacheContents(String hostName, String hostAndPort) { logger.info("Get the records from cache"); - StringBuffer curlCmd = new StringBuffer("curl --silent --show-error --noproxy '*' "); + StringBuffer curlCmd = new StringBuffer("curl -g --silent --show-error --noproxy '*' "); curlCmd .append("-d 'action=get' ") .append("-H 'host: ") @@ -445,7 +445,7 @@ private ExecResult getCacheContents(String hostName, String hostAndPort) { private ExecResult clearCache(String hostName, String hostAndPort) { logger.info("Clean the cache"); - StringBuffer curlCmd = new StringBuffer("curl --silent --show-error --noproxy '*' "); + StringBuffer curlCmd = new StringBuffer("curl -g --silent --show-error --noproxy '*' "); curlCmd .append("-d 'action=clear' ") .append("-H 'host: ") @@ -468,7 +468,7 @@ private ExecResult clearCache(String hostName, String hostAndPort) { private boolean checkCoheranceApp(String hostName, String hostAndPort) { - StringBuffer curlCmd = new StringBuffer("curl --silent --show-error --noproxy '*' "); + StringBuffer curlCmd = new StringBuffer("curl -g --silent --show-error --noproxy '*' "); curlCmd .append("-d 'action=clear' ") .append("-X POST -H 'host: ") diff --git a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMiiDomain.java b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMiiDomain.java index ddff8dad711..bd558930068 100644 --- a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMiiDomain.java +++ b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMiiDomain.java @@ -286,7 +286,7 @@ void testCreateMiiDomain() { logger.info("Found the administration service nodePort {0}", sslNodePort); String hostAndPort = getHostAndPort(adminSvcSslPortExtHost, sslNodePort); if (!WEBLOGIC_SLIM) { - String curlCmd = "curl -sk --show-error --noproxy '*' " + String curlCmd = "curl --globoff -sk --show-error --noproxy '*' " + " https://" + hostAndPort + "/console/login/LoginForm.jsp --write-out %{http_code} -o /dev/null"; logger.info("Executing default-admin nodeport curl command {0}", curlCmd); @@ -304,7 +304,7 @@ void testCreateMiiDomain() { hostAndPort = getHostAndPort(adminSvcExtHost, nodePort); if (!WEBLOGIC_SLIM) { - String curlCmd2 = "curl -s --show-error --noproxy '*' " + String curlCmd2 = "curl -g -s --show-error --noproxy '*' " + " http://" + hostAndPort + "/console/login/LoginForm.jsp --write-out %{http_code} -o /dev/null"; logger.info("Executing default nodeport curl command {0}", curlCmd2); diff --git a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMiiUpdateDomainConfig.java b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMiiUpdateDomainConfig.java index 8b9c3f9fe47..301d0acb9cc 100644 --- a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMiiUpdateDomainConfig.java +++ b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMiiUpdateDomainConfig.java @@ -270,7 +270,7 @@ void testMiiCustomEnv() { OKE_CLUSTER ? adminServerPodName + ":7001" : getHostAndPort(adminSvcExtHost, adminServiceNodePort); String curlString = new StringBuffer() - .append("curl --user ") + .append("curl -g --user ") .append(ADMIN_USERNAME_DEFAULT) .append(":") .append(ADMIN_PASSWORD_DEFAULT) @@ -1004,8 +1004,7 @@ private void verifyManagedServerConfiguration(String managedServer) { = getServiceNodePort(domainNamespace, getExternalServicePodName(adminServerPodName), "default"); String hostAndPort = OKE_CLUSTER ? adminServerPodName + ":7001" : getHostAndPort(adminSvcExtHost, adminServiceNodePort); - - StringBuffer checkClusterBaseCmd = new StringBuffer("curl --user ") + StringBuffer checkClusterBaseCmd = new StringBuffer("curl -g --user ") .append(ADMIN_USERNAME_DEFAULT) .append(":") .append(ADMIN_PASSWORD_DEFAULT) @@ -1067,7 +1066,7 @@ private void verifyJdbcRuntime(String resourcesName, String expectedOutput) { = getServiceNodePort(domainNamespace, getExternalServicePodName(adminServerPodName), "default"); ExecResult result = null; - curlString = new StringBuffer("curl --user ") + curlString = new StringBuffer("curl -g --user ") .append(ADMIN_USERNAME_DEFAULT) .append(":") .append(ADMIN_PASSWORD_DEFAULT) diff --git a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMonitoringExporterMetricsFiltering.java b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMonitoringExporterMetricsFiltering.java index 61e44ee1537..a79a5426901 100644 --- a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMonitoringExporterMetricsFiltering.java +++ b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMonitoringExporterMetricsFiltering.java @@ -182,7 +182,11 @@ public void initAll(@Namespaces(4) List namespaces) { clusterNameMsPortMap.put(cluster2Name, managedServerPort); clusterNames.add(cluster1Name); clusterNames.add(cluster2Name); - exporterUrl = String.format("http://%s:%s/wls-exporter/",K8S_NODEPORT_HOST,nodeportshttp); + String host = K8S_NODEPORT_HOST; + if (host.contains(":")) { + host = "[" + host + "]"; + } + exporterUrl = String.format("http://%s:%s/wls-exporter/", host, nodeportshttp); HashMap labels = new HashMap<>(); labels.put("app", "monitoring"); labels.put("weblogic.domainUid", "test"); @@ -505,7 +509,11 @@ private void installPrometheusGrafana(String promChartVersion, assertNotNull(promHelmParams, " Failed to install prometheus"); prometheusDomainRegexValue = prometheusRegexValue; nodeportPrometheus = promHelmParams.getNodePortServer(); - hostPortPrometheus = K8S_NODEPORT_HOST + ":" + nodeportPrometheus; + String host = K8S_NODEPORT_HOST; + if (host.contains(":")) { + host = "[" + host + "]"; + } + hostPortPrometheus = host + ":" + nodeportPrometheus; if (OKD) { hostPortPrometheus = createRouteForOKD("prometheus" + releaseSuffix + "-service", monitoringNS) + ":" + nodeportPrometheus; @@ -527,7 +535,11 @@ private void installPrometheusGrafana(String promChartVersion, grafanaHelmValuesFileDir, grafanaChartVersion); assertNotNull(grafanaHelmParams, "Grafana failed to install"); - String hostPortGrafana = K8S_NODEPORT_HOST + ":" + grafanaHelmParams.getNodePort(); + String host = K8S_NODEPORT_HOST; + if (host.contains(":")) { + host = "[" + host + "]"; + } + String hostPortGrafana = host + ":" + grafanaHelmParams.getNodePort(); if (OKD) { hostPortGrafana = createRouteForOKD(grafanaReleaseName, monitoringNS) + ":" + grafanaHelmParams.getNodePort(); } diff --git a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMonitoringExporterSamples.java b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMonitoringExporterSamples.java index ba91e4df223..e53631e5a06 100644 --- a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMonitoringExporterSamples.java +++ b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMonitoringExporterSamples.java @@ -369,7 +369,11 @@ private void installPrometheusGrafana(String promChartVersion, assertNotNull(promHelmParams, " Failed to install prometheus"); nodeportPrometheus = promHelmParams.getNodePortServer(); prometheusDomainRegexValue = prometheusRegexValue; - hostPortPrometheus = K8S_NODEPORT_HOST + ":" + nodeportPrometheus; + String host = K8S_NODEPORT_HOST; + if (host.contains(":")) { + host = "[" + host + "]"; + } + hostPortPrometheus = host + ":" + nodeportPrometheus; if (OKD) { hostPortPrometheus = createRouteForOKD("prometheus" + releaseSuffix + "-service", monitoringNS) + ":" + nodeportPrometheus; @@ -392,7 +396,11 @@ private void installPrometheusGrafana(String promChartVersion, grafanaHelmValuesFileDir, grafanaChartVersion); assertNotNull(grafanaHelmParams, "Grafana failed to install"); - String hostPortGrafana = K8S_NODEPORT_HOST + ":" + grafanaHelmParams.getNodePort(); + String host = K8S_NODEPORT_HOST; + if (host.contains(":")) { + host = "[" + host + "]"; + } + String hostPortGrafana = host + ":" + grafanaHelmParams.getNodePort(); if (OKD) { hostPortGrafana = createRouteForOKD(grafanaReleaseName, monitoringNS) + ":" + grafanaHelmParams.getNodePort(); } diff --git a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMonitoringExporterSideCar.java b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMonitoringExporterSideCar.java index 54f54781426..a2db97934b2 100644 --- a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMonitoringExporterSideCar.java +++ b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMonitoringExporterSideCar.java @@ -475,7 +475,11 @@ private void installPrometheusGrafana(String promChartVersion, prometheusDomainRegexValue = prometheusRegexValue; } logger.info("Prometheus is running"); - hostPortPrometheus = K8S_NODEPORT_HOST + ":" + nodeportPrometheus; + String host = K8S_NODEPORT_HOST; + if (host.contains(":")) { + host = "[" + host + "]"; + } + hostPortPrometheus = host + ":" + nodeportPrometheus; if (OKD) { hostPortPrometheus = createRouteForOKD("prometheus" + releaseSuffix + "-service", monitoringNS) + ":" + nodeportPrometheus; @@ -488,7 +492,7 @@ private void installPrometheusGrafana(String promChartVersion, grafanaHelmValuesFileDir, grafanaChartVersion); assertNotNull(grafanaHelmParams, "Grafana failed to install"); - String hostPortGrafana = K8S_NODEPORT_HOST + ":" + grafanaHelmParams.getNodePort(); + String hostPortGrafana = host + ":" + grafanaHelmParams.getNodePort(); if (OKD) { hostPortGrafana = createRouteForOKD(grafanaReleaseName, monitoringNS) + ":" + grafanaHelmParams.getNodePort(); } diff --git a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMonitoringExporterWebApp.java b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMonitoringExporterWebApp.java index 9b958ed2d75..073b62d87f3 100644 --- a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMonitoringExporterWebApp.java +++ b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMonitoringExporterWebApp.java @@ -205,7 +205,11 @@ public static void initAll(@Namespaces(6) List namespaces) { clusterNames.add(cluster1Name); clusterNames.add(cluster2Name); - exporterUrl = String.format("http://%s:%s/wls-exporter/",K8S_NODEPORT_HOST,nodeportshttp); + String host = K8S_NODEPORT_HOST; + if (host.contains(":")) { + host = "[" + host + "]"; + } + exporterUrl = String.format("http://%s:%s/wls-exporter/", host, nodeportshttp); HashMap labels = new HashMap<>(); labels.put("app", "monitoring"); labels.put("weblogic.domainUid", "test"); @@ -416,7 +420,11 @@ private void installPrometheusGrafana(String promChartVersion, assertNotNull(promHelmParams, " Failed to install prometheus"); prometheusDomainRegexValue = prometheusRegexValue; nodeportPrometheus = promHelmParams.getNodePortServer(); - hostPortPrometheus = K8S_NODEPORT_HOST + ":" + nodeportPrometheus; + String host = K8S_NODEPORT_HOST; + if (host.contains(":")) { + host = "[" + host + "]"; + } + hostPortPrometheus = host + ":" + nodeportPrometheus; if (OKD) { hostPortPrometheus = createRouteForOKD("prometheus" + releaseSuffix + "-service", monitoringNS) + ":" + nodeportPrometheus; @@ -439,7 +447,11 @@ private void installPrometheusGrafana(String promChartVersion, grafanaHelmValuesFileDir, grafanaChartVersion); assertNotNull(grafanaHelmParams, "Grafana failed to install"); - String hostPortGrafana = K8S_NODEPORT_HOST + ":" + grafanaHelmParams.getNodePort(); + String host = K8S_NODEPORT_HOST; + if (host.contains(":")) { + host = "[" + host + "]"; + } + String hostPortGrafana = host + ":" + grafanaHelmParams.getNodePort(); if (OKD) { hostPortGrafana = createRouteForOKD(grafanaReleaseName, monitoringNS) + ":" + grafanaHelmParams.getNodePort(); } diff --git a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMultiDomainModelsScale.java b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMultiDomainModelsScale.java index 052607bff67..b4d1468965a 100644 --- a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMultiDomainModelsScale.java +++ b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMultiDomainModelsScale.java @@ -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; @@ -552,13 +552,17 @@ private static String generateCurlCmd(String domainUid, String domainNamespace, if (OKD) { String routeHost = getRouteHost(domainNamespace, domainUid + "-cluster-" + clusterName); logger.info("routeHost = {0}", routeHost); - return String.format("curl -v --show-error --noproxy '*' http://%s/%s/index.jsp", + return String.format("curl -g -v --show-error --noproxy '*' http://%s/%s/index.jsp", routeHost, appContextRoot); } else { - return String.format("curl -v --show-error --noproxy '*' -H 'host: %s' http://%s:%s/%s/index.jsp", + String host = K8S_NODEPORT_HOST; + if (host.contains(":")) { + host = "[" + host + "]"; + } + return String.format("curl -g -v --show-error --noproxy '*' -H 'host: %s' http://%s:%s/%s/index.jsp", domainUid + "." + domainNamespace + "." + clusterName + ".test", - K8S_NODEPORT_HOST, nodeportshttp, appContextRoot); + host, nodeportshttp, appContextRoot); } } @@ -784,9 +788,13 @@ private void verifyAdminConsoleLoginUsingIngressController(String domainUid, Str if (!OKD) { assumeFalse(WEBLOGIC_SLIM, "Skipping the Console Test for slim image"); - String curlCmd = "curl --silent --show-error --noproxy '*' -H 'host: " + String host = K8S_NODEPORT_HOST; + if (host.contains(":")) { + host = "[" + host + "]"; + } + String curlCmd = "curl -g --silent --show-error --noproxy '*' -H 'host: " + domainUid + "." + domainNamespace + ".adminserver.test" - + "' http://" + K8S_NODEPORT_HOST + ":" + nodeportshttp + + "' http://" + host + ":" + nodeportshttp + "/console/login/LoginForm.jsp --write-out %{http_code} -o /dev/null"; logger.info("Executing curl command {0}", curlCmd); diff --git a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItProductionSecureMode.java b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItProductionSecureMode.java index dba5b34d4c7..93f99ef3b41 100644 --- a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItProductionSecureMode.java +++ b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItProductionSecureMode.java @@ -257,7 +257,7 @@ void testVerifyProductionSecureMode() { logger.info("result in OKE_CLUSTER is {0}", result.toString()); assertEquals(0, result.exitValue(), "Failed to access WebLogic console"); } else { - String curlCmd = "curl -sk --show-error --noproxy '*' " + String curlCmd = "curl -g -sk --show-error --noproxy '*' " + " https://" + hostAndPort + "/console/login/LoginForm.jsp --write-out %{http_code} " + " -o /dev/null"; @@ -283,7 +283,7 @@ void testVerifyProductionSecureMode() { forwardPort = startPortForwardProcess(localhost, domainNamespace, domainUid, 7002); assertNotNull(forwardPort, "port-forward fails to assign local port"); logger.info("Forwarded ssl port is {0}", forwardPort); - curlCmd = "curl -sk --show-error --noproxy '*' " + curlCmd = "curl -g -sk --show-error --noproxy '*' " + " https://" + localhost + ":" + forwardPort + "/console/login/LoginForm.jsp --write-out %{http_code} " + " -o /dev/null"; diff --git a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItRemoteConsole.java b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItRemoteConsole.java index 39e462f29f7..6550f1a1ed2 100644 --- a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItRemoteConsole.java +++ b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItRemoteConsole.java @@ -234,7 +234,7 @@ void testWlsRemoteConsoleConnectionUsingSSL() { logger.info("The hostAndPort is {0}", hostAndPort); //verify WebLogic console is accessible through default-secure nodeport - String curlCmd = "curl -sk --show-error --noproxy '*' " + String curlCmd = "curl -g -sk --show-error --noproxy '*' " + " https://" + hostAndPort + "/console/login/LoginForm.jsp --write-out %{http_code} -o /dev/null"; logger.info("Executing WebLogic console default-secure nodeport curl command {0}", curlCmd); @@ -246,7 +246,7 @@ void testWlsRemoteConsoleConnectionUsingSSL() { //curl -sk -v --show-error --user username:password http://localhost:8012/api/providers/AdminServerConnection -H //"Content-Type:application/json" --data "{ \"name\": \"asconn\", \"domainUrl\": \"https://myhost://nodeport\"}" //--write-out %{http_code} -o /dev/null - curlCmd = "curl -sk -v --show-error --noproxy '*' --user " + curlCmd = "curl -g -sk -v --show-error --noproxy '*' --user " + ADMIN_USERNAME_DEFAULT + ":" + ADMIN_PASSWORD_DEFAULT + " http://localhost:8012/api/providers/AdminServerConnection -H " + "\"" + "Content-Type:application/json" + "\"" @@ -338,10 +338,14 @@ private static void createNginxIngressPathRoutingRules() { String nginxServiceName = nginxHelmParams.getHelmParams().getReleaseName() + "-ingress-nginx-controller"; nginxNodePort = assertDoesNotThrow(() -> getServiceNodePort(nginxNamespace, nginxServiceName, "http"), "Getting Nginx loadbalancer service node port failed"); + String host = K8S_NODEPORT_HOST; + if (host.contains(":")) { + host = "[" + host + "]"; + } String hostAndPort = getServiceExtIPAddrtOke(nginxServiceName, nginxNamespace) != null - ? getServiceExtIPAddrtOke(nginxServiceName, nginxNamespace) : K8S_NODEPORT_HOST + ":" + nginxNodePort; + ? getServiceExtIPAddrtOke(nginxServiceName, nginxNamespace) : host + ":" + nginxNodePort; - String curlCmd = "curl --silent --show-error --noproxy '*' http://" + hostAndPort + String curlCmd = "curl -g --silent --show-error --noproxy '*' http://" + hostAndPort + "/weblogic/ready --write-out %{http_code} -o /dev/null"; logger.info("Executing curl command {0}", curlCmd); @@ -362,7 +366,7 @@ private static void verifyWlsRemoteConsoleConnection() { logger.info("admin svc host = {0}", adminSvcExtHost); String hostAndPort = getHostAndPort(adminSvcExtHost, nodePort); - String curlCmd = "curl -v --show-error --noproxy '*' --user " + String curlCmd = "curl -g -v --show-error --noproxy '*' --user " + ADMIN_USERNAME_DEFAULT + ":" + ADMIN_PASSWORD_DEFAULT + " http://localhost:8012/api/providers/AdminServerConnection -H " + "\"" + "Content-Type:application/json" + "\"" @@ -382,10 +386,14 @@ private static void verifyRemoteConsoleConnectionThroughLB(int nodePortOfLB) { String ingressServiceName = traefikHelmParams.getReleaseName(); String traefikNamespace = traefikHelmParams.getNamespace(); + String host = K8S_NODEPORT_HOST; + if (host.contains(":")) { + host = "[" + host + "]"; + } String hostAndPort = getServiceExtIPAddrtOke(ingressServiceName, traefikNamespace) != null - ? getServiceExtIPAddrtOke(ingressServiceName, traefikNamespace) : K8S_NODEPORT_HOST + ":" + nodePortOfLB; + ? getServiceExtIPAddrtOke(ingressServiceName, traefikNamespace) : host + ":" + nodePortOfLB; - String curlCmd = "curl -v --user " + ADMIN_USERNAME_DEFAULT + ":" + ADMIN_PASSWORD_DEFAULT + String curlCmd = "curl -g -v --user " + ADMIN_USERNAME_DEFAULT + ":" + ADMIN_PASSWORD_DEFAULT + " http://localhost:8012/api/providers/AdminServerConnection -H " + "\"" + "Content-Type:application/json" + "\"" + " --data " diff --git a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItStickySession.java b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItStickySession.java index 6c4dc3b22d5..7bc33630e60 100644 --- a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItStickySession.java +++ b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItStickySession.java @@ -452,7 +452,7 @@ private static String buildCurlCommand(String hostName, String headerOption, String... clusterAddress) { - StringBuffer curlCmd = new StringBuffer("curl --show-error"); + StringBuffer curlCmd = new StringBuffer("curl -g --show-error"); logger.info("Build a curl command with hostname {0} and port {1}", hostName, servicePort); if (clusterAddress.length == 0) { diff --git a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItT3Channel.java b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItT3Channel.java index e7b8b5c63cf..0bbdced12aa 100644 --- a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItT3Channel.java +++ b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItT3Channel.java @@ -319,7 +319,11 @@ private static void verifyMemberHealth(String adminServerPodName, List m "Getting admin server node port failed"); logger.info("Checking the health of servers in cluster"); - String url = "http://" + K8S_NODEPORT_HOST + ":" + serviceNodePort + String host = K8S_NODEPORT_HOST; + if (host.contains(":")) { + host = "[" + host + "]"; + } + String url = "http://" + host + ":" + serviceNodePort + "/clusterview/ClusterViewServlet?user=" + user + "&password=" + password; testUntil( diff --git a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItUsabilityOperatorHelmChart.java b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItUsabilityOperatorHelmChart.java index 9d830d8d7c2..68ff3a734c9 100644 --- a/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItUsabilityOperatorHelmChart.java +++ b/integration-tests/src/test/java/oracle/weblogic/kubernetes/ItUsabilityOperatorHelmChart.java @@ -1262,7 +1262,7 @@ private boolean checkManagedServerConfiguration(String domainNamespace, String d int adminServiceNodePort = getServiceNodePort(domainNamespace, getExternalServicePodName(adminServerPodName), "default"); String hostAndPort = getHostAndPort(adminSvcExtRouteHost, adminServiceNodePort); - StringBuilder checkCluster = new StringBuilder("status=$(curl --user ") + StringBuilder checkCluster = new StringBuilder("status=$(curl -g --user ") .append(ADMIN_USERNAME_DEFAULT) .append(":") .append(ADMIN_PASSWORD_DEFAULT) diff --git a/integration-tests/src/test/java/oracle/weblogic/kubernetes/actions/impl/Domain.java b/integration-tests/src/test/java/oracle/weblogic/kubernetes/actions/impl/Domain.java index d3b822f1ee8..53e8087bb76 100644 --- a/integration-tests/src/test/java/oracle/weblogic/kubernetes/actions/impl/Domain.java +++ b/integration-tests/src/test/java/oracle/weblogic/kubernetes/actions/impl/Domain.java @@ -420,7 +420,7 @@ public static boolean scaleClusterWithRestApi(String domainUid, // build the curl command to scale the cluster String command = new StringBuffer() - .append("curl --noproxy '*' -v -k ") + .append("curl -g --noproxy '*' -v -k ") .append("-H \"Authorization:Bearer ") .append(decodedToken) .append("\" ") @@ -499,7 +499,7 @@ public static ExecResult scaleClusterWithRestApiAndReturnResult(String domainUid // build the curl command to scale the cluster String command = new StringBuffer() - .append("curl --noproxy '*' -v -k ") + .append("curl -g --noproxy '*' -v -k ") .append("-H \"Authorization:Bearer ") .append(decodedToken) .append("\" ") diff --git a/integration-tests/src/test/java/oracle/weblogic/kubernetes/actions/impl/NginxParams.java b/integration-tests/src/test/java/oracle/weblogic/kubernetes/actions/impl/NginxParams.java index 965127274e5..289dc2581ac 100644 --- a/integration-tests/src/test/java/oracle/weblogic/kubernetes/actions/impl/NginxParams.java +++ b/integration-tests/src/test/java/oracle/weblogic/kubernetes/actions/impl/NginxParams.java @@ -4,6 +4,7 @@ package oracle.weblogic.kubernetes.actions.impl; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.Objects; @@ -30,7 +31,10 @@ public class NginxParams { private static final String NGINX_IMAGE = "controller.image.image"; private static final String NGINX_IMAGE_TAG = "controller.image.tag"; private static final String NGINX_IMAGE_DIGEST = "controller.image.digest"; - private static final String IMAGE_PULL_SECRET = "imagePullSecrets[0].name"; + private static final String IMAGE_PULL_SECRET = "imagePullSecrets[0].name"; + private static final String IP_FAMILY_POLICY = "controller.service.ipFamilyPolicy"; + private static final String IP_FAMILIES = "controller.service.ipFamilies"; + // Adding some of the most commonly used params for now private int nodePortsHttp; @@ -43,6 +47,8 @@ public class NginxParams { private String nginxImageTag = NGINX_INGRESS_IMAGE_TAG; private String nginxImageDigest = NGINX_INGRESS_IMAGE_DIGEST; private String imageRepoSecret; + private List ipFamilies; + private String ipFamilyPolicy = "SingleStack"; public NginxParams() { ingressClassName = UniqueName.uniqueName("nginx-"); @@ -94,7 +100,17 @@ public NginxParams nginxImageDigest(String nginxImageDigest) { public NginxParams imageRepoSecret(String imageRepoSecret) { this.imageRepoSecret = imageRepoSecret; return this; - } + } + + public NginxParams ipFamilies(List ipFamilies) { + this.ipFamilies = ipFamilies; + return this; + } + + public NginxParams ipFamilyPolicy(String ipFamilyPolicy) { + this.ipFamilyPolicy = ipFamilyPolicy; + return this; + } public NginxParams helmParams(HelmParams helmParams) { this.helmParams = helmParams; @@ -121,12 +137,12 @@ public Map getValues() { values.put(NGINX_IMAGE_REGISTRY, imageRegistry); values.put(NGINX_IMAGE, nginxImage); values.put(NGINX_IMAGE_TAG, nginxImageTag); - values.put(NGINX_IMAGE_DIGEST, nginxImageDigest); - + values.put(NGINX_IMAGE_DIGEST, nginxImageDigest); if (imageRepoSecret != null) { values.put(IMAGE_PULL_SECRET, imageRepoSecret); } - + values.put(IP_FAMILY_POLICY, ipFamilyPolicy); + values.put(IP_FAMILIES, ipFamilies); values.values().removeIf(Objects::isNull); return values; } diff --git a/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/ApplicationUtils.java b/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/ApplicationUtils.java index 9c0e317009a..6701566e8c0 100644 --- a/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/ApplicationUtils.java +++ b/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/ApplicationUtils.java @@ -1,4 +1,4 @@ -// Copyright (c) 2021, Oracle and/or its affiliates. +// Copyright (c) 2021, 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.utils; @@ -45,7 +45,7 @@ public static boolean checkAppUsingHostHeader(String url, String hostHeader, Boo } else { headerString = new StringBuffer(""); } - curlString.append(" -sk --noproxy '*' ") + curlString.append(" -g -sk --noproxy '*' ") .append(" --silent --show-error ") .append(headerString.toString()) .append(url) @@ -146,7 +146,7 @@ public static boolean checkAppIsActive( ) { LoggingFacade logger = getLogger(); - String curlString = String.format("curl -v --show-error --noproxy '*' " + String curlString = String.format("curl -g -v --show-error --noproxy '*' " + "--user " + username + ":" + password + " " + headers + " -H X-Requested-By:MyClient -H Accept:application/json " + "-H Content-Type:application/json " @@ -434,6 +434,9 @@ public static void verifyAdminConsoleAccessible(String domainNamespace, // and explicitly allows curl to perform “insecure” SSL connections and transfers httpKey = " --insecure https://"; } + if (hostName.contains(":")) { + hostName = "[" + hostName + "]"; + } String consoleUrl = httpKey + hostName + ":" + port + "/console/login/LoginForm.jsp"; boolean checkConsole = assertDoesNotThrow(() -> diff --git a/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/ClusterUtils.java b/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/ClusterUtils.java index 8ae710ddc9f..db8cca699d4 100644 --- a/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/ClusterUtils.java +++ b/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/ClusterUtils.java @@ -260,7 +260,7 @@ public static boolean scaleClusterWithRestApi(String domainUid, // build the curl command to scale the cluster StringBuffer command = new StringBuffer() - .append("curl --noproxy '*' -v -k "); + .append("curl -g --noproxy '*' -v -k "); if (hasAuthHeader) { command.append("-H \"Authorization:Bearer ") .append(decodedToken) diff --git a/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/CommonLBTestUtils.java b/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/CommonLBTestUtils.java index 29b09213c47..cb79032a753 100644 --- a/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/CommonLBTestUtils.java +++ b/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/CommonLBTestUtils.java @@ -432,12 +432,16 @@ private static boolean adminNodePortAccessible(int nodePort) throws IOException { if (WEBLOGIC_SLIM) { getLogger().info("Check REST Console for WebLogic slim image"); - StringBuffer curlCmd = new StringBuffer("status=$(curl --user "); + StringBuffer curlCmd = new StringBuffer("status=$(curl -g --user "); + String host = K8S_NODEPORT_HOST; + if (host.contains(":")) { + host = "[" + host + "]"; + } curlCmd.append(ADMIN_USERNAME_DEFAULT) .append(":") .append(ADMIN_PASSWORD_DEFAULT) .append(" http://") - .append(K8S_NODEPORT_HOST) + .append(host) .append(":") .append(nodePort) .append("/management/tenant-monitoring/servers/ --silent --show-error -o /dev/null -w %{http_code}); ") @@ -455,10 +459,14 @@ private static boolean adminNodePortAccessible(int nodePort) } } else { // generic/dev Image + String host = K8S_NODEPORT_HOST; + if (host.contains(":")) { + host = "[" + host + "]"; + } getLogger().info("Check administration Console for generic/dev image"); String consoleUrl = new StringBuffer() .append("http://") - .append(K8S_NODEPORT_HOST) + .append(host) .append(":") .append(nodePort) .append("/console/login/LoginForm.jsp").toString(); @@ -506,7 +514,7 @@ public static boolean adminLoginPageAccessible(String adminServerPodName, String StringBuffer curlCmd = new StringBuffer(KUBERNETES_CLI + " exec -n " + namespace + " " + adminServerPodName) .append(" -- /bin/bash -c \"") - .append("curl --user ") + .append("curl -g --user ") .append(userName) .append(":") .append(password) @@ -723,11 +731,15 @@ public static void verifyHeadersInAdminServerLog(String podName, String namespac public static void checkIngressReady(boolean isHostRouting, String ingressHost, boolean isTLS, int httpNodeport, int httpsNodeport, String pathString, String... ingressExtIP) { + String host = K8S_NODEPORT_HOST; + if (host.contains(":")) { + host = "[" + host + "]"; + } String hostAndPort; if (isTLS) { - hostAndPort = ingressExtIP.length != 0 ? ingressExtIP[0] : K8S_NODEPORT_HOST + ":" + httpsNodeport; + hostAndPort = ingressExtIP.length != 0 ? ingressExtIP[0] : host + ":" + httpsNodeport; } else { - hostAndPort = ingressExtIP.length != 0 ? ingressExtIP[0] : K8S_NODEPORT_HOST + ":" + httpNodeport; + hostAndPort = ingressExtIP.length != 0 ? ingressExtIP[0] : host + ":" + httpNodeport; } getLogger().info("hostAndPort to check ingress ready is: {0}", hostAndPort); @@ -736,20 +748,20 @@ public static void checkIngressReady(boolean isHostRouting, String ingressHost, String curlCmd; if (isHostRouting) { if (isTLS) { - curlCmd = "curl -k --silent --show-error --noproxy '*' -H 'host: " + ingressHost + curlCmd = "curl -g -k --silent --show-error --noproxy '*' -H 'host: " + ingressHost + "' https://" + hostAndPort + "/weblogic/ready --write-out %{http_code} -o /dev/null"; } else { - curlCmd = "curl --silent --show-error --noproxy '*' -H 'host: " + ingressHost + curlCmd = "curl -g --silent --show-error --noproxy '*' -H 'host: " + ingressHost + "' http://" + hostAndPort + "/weblogic/ready --write-out %{http_code} -o /dev/null"; } } else { if (isTLS) { - curlCmd = "curl -k --silent --show-error --noproxy '*' https://" + hostAndPort + curlCmd = "curl -g -k --silent --show-error --noproxy '*' https://" + hostAndPort + "/" + pathString + "/weblogic/ready --write-out %{http_code} -o /dev/null"; } else { - curlCmd = "curl --silent --show-error --noproxy '*' http://" + hostAndPort + curlCmd = "curl -g --silent --show-error --noproxy '*' http://" + hostAndPort + "/" + pathString + "/weblogic/ready --write-out %{http_code} -o /dev/null"; } } @@ -777,7 +789,11 @@ public static void verifyClusterLoadbalancing(String domainUid, boolean hostRouting, String locationString, String... args) { - String host = (args.length == 0) ? K8S_NODEPORT_HOST : args[0]; + String host = K8S_NODEPORT_HOST; + if (host.contains(":")) { + host = "[" + host + "]"; + } + String hostName = (args.length == 0) ? host : args[0]; verifyClusterLoadbalancing(domainUid, ingressHostName, protocol, @@ -785,7 +801,7 @@ public static void verifyClusterLoadbalancing(String domainUid, replicaCount, hostRouting, locationString, - host); + hostName); } /** @@ -812,7 +828,7 @@ public static void verifyClusterLoadbalancing(String domainUid, getLogger().info("Accessing the clusterview app through load balancer to verify all servers in cluster"); String curlRequest; if (hostRouting) { - curlRequest = OKE_CLUSTER_PRIVATEIP ? String.format("curl --show-error -ks --noproxy '*' " + curlRequest = OKE_CLUSTER_PRIVATEIP ? String.format("curl -g --show-error -ks --noproxy '*' " + "-H 'host: %s' %s://%s/clusterview/ClusterViewServlet" + "\"?user=" + ADMIN_USERNAME_DEFAULT + "&password=" + ADMIN_PASSWORD_DEFAULT + "\"", ingressHostName, protocol, host) @@ -821,7 +837,7 @@ public static void verifyClusterLoadbalancing(String domainUid, + "\"?user=" + ADMIN_USERNAME_DEFAULT + "&password=" + ADMIN_PASSWORD_DEFAULT + "\"", ingressHostName, protocol, host, lbPort); } else { - curlRequest = OKE_CLUSTER_PRIVATEIP ? String.format("curl --show-error -ks --noproxy '*' " + curlRequest = OKE_CLUSTER_PRIVATEIP ? String.format("curl -g --show-error -ks --noproxy '*' " + "%s://%s" + locationString + "/clusterview/ClusterViewServlet" + "\"?user=" + ADMIN_USERNAME_DEFAULT + "&password=" + ADMIN_PASSWORD_DEFAULT + "\"", protocol, host) @@ -868,20 +884,24 @@ public static void verifyClusterLoadbalancing(String domainUid, * @param isHostRouting whether it is host routing * @param ingressHostName ingress host name * @param pathLocation path location in the console url - * @param host external IP address on OKE or k8s node IP address on non-OKE env + * @param hostName external IP address on OKE or k8s node IP address on non-OKE env */ public static void verifyAdminServerAccess(boolean isTLS, int lbNodePort, boolean isHostRouting, String ingressHostName, String pathLocation, - String... host) { + String... hostName) { StringBuffer consoleUrl = new StringBuffer(); String hostAndPort; - if (host != null && host.length > 0) { - hostAndPort = OKE_CLUSTER_PRIVATEIP ? host[0] : host[0] + ":" + lbNodePort; + if (hostName != null && hostName.length > 0) { + hostAndPort = OKE_CLUSTER_PRIVATEIP ? hostName[0] : hostName[0] + ":" + lbNodePort; } else { - hostAndPort = K8S_NODEPORT_HOST + ":" + lbNodePort; + String host = K8S_NODEPORT_HOST; + if (host.contains(":")) { + host = "[" + host + "]"; + } + hostAndPort = host + ":" + lbNodePort; } if (isTLS) { @@ -897,14 +917,14 @@ public static void verifyAdminServerAccess(boolean isTLS, consoleUrl.append("/console/login/LoginForm.jsp"); String curlCmd; if (isHostRouting) { - curlCmd = String.format("curl -ks --show-error --noproxy '*' -H 'host: %s' %s", + curlCmd = String.format("curl -g -ks --show-error --noproxy '*' -H 'host: %s' %s", ingressHostName, consoleUrl.toString()); } else { if (isTLS) { - curlCmd = String.format("curl -ks --show-error --noproxy '*' -H 'WL-Proxy-Client-IP: 1.2.3.4' " + curlCmd = String.format("curl -g -ks --show-error --noproxy '*' -H 'WL-Proxy-Client-IP: 1.2.3.4' " + "-H 'WL-Proxy-SSL: false' %s", consoleUrl.toString()); } else { - curlCmd = String.format("curl -ks --show-error --noproxy '*' %s", consoleUrl.toString()); + curlCmd = String.format("curl -g -ks --show-error --noproxy '*' %s", consoleUrl.toString()); } } diff --git a/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/CommonMiiTestUtils.java b/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/CommonMiiTestUtils.java index cf920fd7722..c0f529d840d 100644 --- a/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/CommonMiiTestUtils.java +++ b/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/CommonMiiTestUtils.java @@ -1043,7 +1043,7 @@ private static ExecResult readRuntimeResource(String adminSvcExtHost, String dom String port = "7001"; curlString = String.format( - KUBERNETES_CLI + " exec -n " + domainNamespace + " " + adminServerPodName + " -- curl -k %s://" + KUBERNETES_CLI + " exec -n " + domainNamespace + " " + adminServerPodName + " -- curl -g -k %s://" + ADMIN_USERNAME_DEFAULT + ":" + ADMIN_PASSWORD_DEFAULT @@ -1053,10 +1053,14 @@ private static ExecResult readRuntimeResource(String adminSvcExtHost, String dom int adminServiceNodePort = getServiceNodePort(domainNamespace, getExternalServicePodName(adminServerPodName), "default"); - String hostAndPort = (OKD) ? adminSvcExtHost : K8S_NODEPORT_HOST + ":" + adminServiceNodePort; + String host = K8S_NODEPORT_HOST; + if (host.contains(":")) { + host = "[" + host + "]"; + } + String hostAndPort = (OKD) ? adminSvcExtHost : host + ":" + adminServiceNodePort; logger.info("hostAndPort = {0} ", hostAndPort); curlString = String.format( - "curl --user " + "curl -g --user " + ADMIN_USERNAME_DEFAULT + ":" + ADMIN_PASSWORD_DEFAULT @@ -1162,17 +1166,21 @@ public static boolean checkWeblogicMBean(String adminSvcExtHost, StringBuffer curlString; if (isSecureMode) { - curlString = new StringBuffer("status=$(curl -k --user weblogic:welcome1 https://"); + curlString = new StringBuffer("status=$(curl -g -k --user weblogic:welcome1 https://"); } else { - curlString = new StringBuffer("status=$(curl --user weblogic:welcome1 http://"); + curlString = new StringBuffer("status=$(curl -g --user weblogic:welcome1 http://"); } - String hostAndPort = (OKD) ? adminSvcExtHost : K8S_NODEPORT_HOST + ":" + adminServiceNodePort; + String host = K8S_NODEPORT_HOST; + if (host.contains(":")) { + host = "[" + host + "]"; + } + String hostAndPort = (OKD) ? adminSvcExtHost : host + ":" + adminServiceNodePort; logger.info("hostAndPort = {0} ", hostAndPort); curlString.append(hostAndPort) .append(resourcePath) - .append(" --silent --show-error ") + .append(" -g --silent --show-error ") .append(" -o /dev/null ") .append(" -w %{http_code});") .append("echo ${status}"); @@ -1211,7 +1219,7 @@ public static boolean checkWeblogicMBeanInAdminPod(String domainNamespace, + ":" + ADMIN_PASSWORD_DEFAULT + "@" + adminServerPodName + ":%s/%s", protocol, port, resourcePath); - curlString = curlString + " --silent --show-error -o /dev/null -w %{http_code}"; + curlString = curlString + " -g --silent --show-error -o /dev/null -w %{http_code}"; logger.info("checkSystemResource: curl command {0}", curlString); return Command .withParams(new CommandParams() diff --git a/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/CommonTestUtils.java b/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/CommonTestUtils.java index 0be39bf32f3..9a3c634a17a 100644 --- a/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/CommonTestUtils.java +++ b/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/CommonTestUtils.java @@ -651,10 +651,14 @@ public static boolean checkSystemResourceConfiguration(String adminSvcExtHost, i String resourcesName, String expectedStatusCode) { final LoggingFacade logger = getLogger(); - String hostAndPort = (OKD) ? adminSvcExtHost : K8S_NODEPORT_HOST + ":" + nodePort; + String host = K8S_NODEPORT_HOST; + if (host.contains(":")) { + host = "[" + host + "]"; + } + String hostAndPort = (OKD) ? adminSvcExtHost : host + ":" + nodePort; logger.info("hostAndPort = {0} ", hostAndPort); - StringBuffer curlString = new StringBuffer("status=$(curl --user "); + StringBuffer curlString = new StringBuffer("status=$(curl -g --user "); curlString.append(ADMIN_USERNAME_DEFAULT + ":" + ADMIN_PASSWORD_DEFAULT) .append(" http://" + hostAndPort) .append("/management/weblogic/latest/domainConfig") @@ -692,7 +696,7 @@ public static boolean checkSystemResourceConfiguration(String adminServerPodName StringBuffer curlString = new StringBuffer(KUBERNETES_CLI + " exec -n " + namespace + " " + adminServerPodName) .append(" -- /bin/bash -c \"") - .append("curl -k --user ") + .append("curl -g -k --user ") .append(ADMIN_USERNAME_DEFAULT + ":" + ADMIN_PASSWORD_DEFAULT) .append(" " + protocol + "://") .append(adminServerPodName + ":" + port) @@ -734,7 +738,7 @@ public static void verifySystemResourceConfiguration(String adminRouteHost, int .append("/") .append(resourcesName) .append("/") - .append(" --silent --show-error ") + .append(" -g --silent --show-error ") .append(" -o /dev/null ") .append(" -w %{http_code});") .append("echo ${status}"); @@ -766,10 +770,14 @@ public static boolean checkSystemResourceConfig(String adminSvcExtHost, int node String resourcesPath, String expectedValue) { final LoggingFacade logger = getLogger(); - String hostAndPort = (OKD) ? adminSvcExtHost : K8S_NODEPORT_HOST + ":" + nodePort; + String host = K8S_NODEPORT_HOST; + if (host.contains(":")) { + host = "[" + host + "]"; + } + String hostAndPort = (OKD) ? adminSvcExtHost : host + ":" + nodePort; logger.info("hostAndPort = {0} ", hostAndPort); - StringBuffer curlString = new StringBuffer("curl --user "); + StringBuffer curlString = new StringBuffer("curl -g --user "); curlString.append(ADMIN_USERNAME_DEFAULT + ":" + ADMIN_PASSWORD_DEFAULT) .append(" http://" + hostAndPort) .append("/management/weblogic/latest/domainConfig") @@ -799,7 +807,7 @@ public static boolean checkSystemResourceConfigViaAdminPod(String adminServerPod StringBuffer curlString = new StringBuffer(KUBERNETES_CLI + " exec -n " + namespace + " " + adminServerPodName) .append(" -- /bin/bash -c \"") - .append("curl --user ") + .append("curl -g --user ") .append(ADMIN_USERNAME_DEFAULT + ":" + ADMIN_PASSWORD_DEFAULT) .append(" http://" + adminServerPodName + ":" + adminListenPort) .append("/management/weblogic/latest/domainConfig") @@ -826,10 +834,14 @@ public static boolean checkSystemResourceDomainConfig(String adminSvcExtHost, in String expectedValue) { final LoggingFacade logger = getLogger(); - String hostAndPort = (OKD) ? adminSvcExtHost : K8S_NODEPORT_HOST + ":" + nodePort; + String host = K8S_NODEPORT_HOST; + if (host.contains(":")) { + host = "[" + host + "]"; + } + String hostAndPort = (OKD) ? adminSvcExtHost : host + ":" + nodePort; logger.info("hostAndPort = {0} ", hostAndPort); - StringBuffer curlString = new StringBuffer("curl --user "); + StringBuffer curlString = new StringBuffer("curl -g --user "); curlString.append(ADMIN_USERNAME_DEFAULT + ":" + ADMIN_PASSWORD_DEFAULT) .append(" http://" + hostAndPort) .append("/management/weblogic/latest/domainConfig/"); @@ -856,7 +868,7 @@ public static boolean checkSystemResourceRuntime(String adminServerPodName, Stri StringBuffer curlString = new StringBuffer(KUBERNETES_CLI + " exec -n " + namespace + " " + adminServerPodName) .append(" -- /bin/bash -c \"") - .append("curl --user ") + .append("curl -g --user ") .append(ADMIN_USERNAME_DEFAULT + ":" + ADMIN_PASSWORD_DEFAULT) .append(" http://" + adminServerPodName + ":" + adminListenPort) .append("/management/weblogic/latest/domainRuntime") @@ -1244,7 +1256,11 @@ public static String getDateAndTimeStamp() { */ public static String getHostAndPort(String hostName, int servicePort) { LoggingFacade logger = getLogger(); - String hostAndPort = ((OKD) ? hostName : K8S_NODEPORT_HOST + ":" + servicePort); + String host = K8S_NODEPORT_HOST; + if (host.contains(":")) { + host = "[" + host + "]"; + } + String hostAndPort = ((OKD) ? hostName : host + ":" + servicePort); logger.info("hostAndPort = {0} ", hostAndPort); return hostAndPort; } @@ -1487,9 +1503,12 @@ public static int testPortForwarding(String domainUid, LoggingFacade logger = getLogger(); String hostAndPort = (hosts.length == 0) ? K8S_NODEPORT_HOST + ":" + istioIngressPort : hosts[0]; - // verify WebLogic console is accessible before port forwarding using ingress port - 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, domainNamespace + ".org"); assertTrue(checkConsole, "Failed to access WebLogic console"); diff --git a/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/DeployUtil.java b/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/DeployUtil.java index 42dc7599e36..b141e862c7b 100644 --- a/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/DeployUtil.java +++ b/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/DeployUtil.java @@ -1,4 +1,4 @@ -// Copyright (c) 2020, 2022, Oracle and/or its affiliates. +// Copyright (c) 2020, 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.utils; @@ -276,6 +276,9 @@ public static ExecResult deployUsingRest(String host, String port, String userName, String password, String targets, Path archivePath, String hostHeader, String appName) { ExecResult result = null; + if (host.contains(":")) { + host = "[" + host + "]"; + } result = deployUsingRest(host + ":" + port, userName, password, targets, archivePath, hostHeader, appName); return result; @@ -311,7 +314,7 @@ public static ExecResult deployUsingRest(String hostAndPort, } else { headerString = new StringBuffer(""); } - StringBuffer curlString = new StringBuffer("status=$(curl --noproxy '*' "); + StringBuffer curlString = new StringBuffer("status=$(curl -g --noproxy '*' "); curlString.append(" --user " + userName + ":" + password); curlString.append(" -w %{http_code} --show-error -o /dev/null ") .append(headerString.toString()) diff --git a/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/IstioUtils.java b/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/IstioUtils.java index b81bcd3be99..afc48763ed2 100644 --- a/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/IstioUtils.java +++ b/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/IstioUtils.java @@ -495,7 +495,11 @@ public static void checkIstioService(int istioIngressPort, String domainNamespac LoggingFacade logger = getLogger(); logger.info("Verifying Istio Service @IngressPort [{0}]", istioIngressPort); 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, domainNamespace + ".org"); assertTrue(checkConsole, "Failed to access WebLogic console"); diff --git a/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/LoadBalancerUtils.java b/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/LoadBalancerUtils.java index f01a91544af..06ef3ee9c35 100644 --- a/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/LoadBalancerUtils.java +++ b/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/LoadBalancerUtils.java @@ -8,6 +8,7 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -172,6 +173,11 @@ public static NginxParams installAndVerifyNginx(String nginxNamespace, .nodePortsHttp(nodeportshttp) .nodePortsHttps(nodeportshttps); } + if (K8S_NODEPORT_HOST.contains(":")) { + nginxParams.ipFamilies(Arrays.asList("IPv6")); + } else { + nginxParams.ipFamilies(Arrays.asList("IPv4")); + } // install NGINX assertThat(installNginx(nginxParams)) @@ -409,8 +415,12 @@ public static List createIngressForDomainAndVerify(String domainUid, // check the ingress is ready to route the app to the server pod if (nodeport != 0) { for (String ingressHost : ingressHostList) { - String curlCmd = "curl --silent --show-error --noproxy '*' -H 'host: " + ingressHost - + "' http://" + K8S_NODEPORT_HOST + ":" + nodeport + String host = K8S_NODEPORT_HOST; + if (host.contains(":")) { + host = "[" + host + "]"; + } + String curlCmd = "curl -g --silent --show-error --noproxy '*' -H 'host: " + ingressHost + + "' http://" + host + ":" + nodeport + "/weblogic/ready --write-out %{http_code} -o /dev/null"; logger.info("Executing curl command {0}", curlCmd); @@ -468,8 +478,12 @@ public static List createTraefikIngressForDomainAndVerify( // check the ingress is ready to route the app to the server pod if (nodeport != 0) { for (String ingressHost : ingressHostList) { - String curlCmd = "curl --silent --show-error --noproxy '*' -H 'host: " + ingressHost - + "' http://" + K8S_NODEPORT_HOST + ":" + nodeport + String host = K8S_NODEPORT_HOST; + if (host.contains(":")) { + host = "[" + host + "]"; + } + String curlCmd = "curl -g --silent --show-error --noproxy '*' -H 'host: " + ingressHost + + "' http://" + host + ":" + nodeport + "/weblogic/ready --write-out %{http_code} -o /dev/null"; logger.info("Executing curl command {0}", curlCmd); diff --git a/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/MonitoringUtils.java b/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/MonitoringUtils.java index 6e21671f1ec..2108f93632b 100644 --- a/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/MonitoringUtils.java +++ b/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/MonitoringUtils.java @@ -242,7 +242,7 @@ public static void checkMetricsViaPrometheus(String searchKey, String expectedVa LoggingFacade logger = getLogger(); // url String curlCmd = - String.format("curl --silent --show-error --noproxy '*' http://%s/api/v1/query?query=%s", + String.format("curl -g --silent --show-error --noproxy '*' http://%s/api/v1/query?query=%s", hostPortPrometheus, searchKey); logger.info("Executing Curl cmd {0}", curlCmd); @@ -1119,12 +1119,16 @@ public static void verifyMonExpAppAccessThroughNginx(String nginxHost, int repli } // check that NGINX can access the sample apps from all managed servers in the domain + String host = K8S_NODEPORT_HOST; + if (host.contains(":")) { + host = "[" + host + "]"; + } String curlCmd = - String.format("curl --silent --show-error --noproxy '*' -H 'host: %s' http://%s:%s@%s:%s/wls-exporter/metrics", + String.format("curl -g --silent --show-error --noproxy '*' -H 'host: %s' http://%s:%s@%s:%s/wls-exporter/metrics", nginxHost, ADMIN_USERNAME_DEFAULT, ADMIN_PASSWORD_DEFAULT, - K8S_NODEPORT_HOST, + host, nodeport); testUntil(withLongRetryPolicy, callTestWebAppAndCheckForServerNameInResponse(curlCmd, managedServerNames, 50), @@ -1148,7 +1152,7 @@ public static void verifyMonExpAppAccess(int replicaCount, String hostPort) { // check the access to monitoring exporter apps from all managed servers in the domain String curlCmd = - String.format("curl --silent --show-error --noproxy '*' http://%s:%s@%s/wls-exporter/metrics", + String.format("curl -g --silent --show-error --noproxy '*' http://%s:%s@%s/wls-exporter/metrics", ADMIN_USERNAME_DEFAULT, ADMIN_PASSWORD_DEFAULT, hostPort); diff --git a/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/SecretUtils.java b/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/SecretUtils.java index c415b19e932..1c52b40f365 100644 --- a/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/SecretUtils.java +++ b/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/SecretUtils.java @@ -1,4 +1,4 @@ -// Copyright (c) 2021, 2022, Oracle and/or its affiliates. +// Copyright (c) 2021, 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.utils; @@ -183,7 +183,7 @@ public static boolean createExternalRestIdentitySecret(String namespace, String StringBuffer command = new StringBuffer() .append(GEN_EXTERNAL_REST_IDENTITY_FILE); if (K8S_NODEPORT_HOST != null && !K8S_NODEPORT_HOST.equals("")) { - if (Character.isDigit(K8S_NODEPORT_HOST.charAt(0))) { + if (K8S_NODEPORT_HOST.contains(":") || Character.isDigit(K8S_NODEPORT_HOST.charAt(0))) { command.append(" -a \"IP:"); } else { command.append(" -a \"DNS:"); diff --git a/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/SessionMigrationUtil.java b/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/SessionMigrationUtil.java index 238812c5fdb..8306dbd51bd 100644 --- a/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/SessionMigrationUtil.java +++ b/integration-tests/src/test/java/oracle/weblogic/kubernetes/utils/SessionMigrationUtil.java @@ -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.utils; @@ -205,7 +205,7 @@ private static String buildCurlCommand(String curlUrlPath, // --max-time - Maximum time in seconds that you allow the whole operation to take int waittime = 10; String curlCommand = new StringBuilder() - .append("curl --show-error ") + .append("curl -g --show-error ") .append(" --noproxy '*'") .append(" --connect-timeout ").append(waittime).append(" --max-time ").append(waittime) .append(" http://") diff --git a/integration-tests/src/test/resources/apps/clusterview/src/java/oracle/weblogic/kubernetes/applications/clusterview/ClusterViewServlet.java b/integration-tests/src/test/resources/apps/clusterview/src/java/oracle/weblogic/kubernetes/applications/clusterview/ClusterViewServlet.java index 5a58d239d8e..af14df175a1 100644 --- a/integration-tests/src/test/resources/apps/clusterview/src/java/oracle/weblogic/kubernetes/applications/clusterview/ClusterViewServlet.java +++ b/integration-tests/src/test/resources/apps/clusterview/src/java/oracle/weblogic/kubernetes/applications/clusterview/ClusterViewServlet.java @@ -1,4 +1,4 @@ -// Copyright (c) 2020, 2021, Oracle and/or its affiliates. +// Copyright (c) 2020, 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.applications.clusterview; @@ -278,9 +278,11 @@ private List getServerUrls() { ServerLifeCycleRuntimeMBean[] serverLifeCycleRuntimes = domainRuntime.getServerLifeCycleRuntimes(); for (ServerLifeCycleRuntimeMBean serverLifeCycleRuntime : serverLifeCycleRuntimes) { //check state and get the url only if its running, also make sure the url is not null - if (null != serverLifeCycleRuntime.getIPv4URL("t3") && serverLifeCycleRuntime.getState().equals("RUNNING")) { - serverUrls.add(serverLifeCycleRuntime.getIPv4URL("t3")); - System.out.println("getIPv4URL(t3):" + serverLifeCycleRuntime.getIPv4URL("t3")); + String t3Url = + host.contains(":") ? serverLifeCycleRuntime.getIPv6URL("t3") : serverLifeCycleRuntime.getIPv4URL("t3"); + if (t3Url != null && serverLifeCycleRuntime.getState().equals("RUNNING")) { + serverUrls.add(t3Url); + System.out.println("getIPv[4|6]URL(t3):" + t3Url); } }