Skip to content

Remove t3 channel in IT tests and add it to separate IT class. #2036

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 25 commits into from
Nov 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
902e4ee
Modifying the tests to use default channel for wlst deployment
sankarpn Nov 4, 2020
0010edf
add debug statements
sankarpn Nov 4, 2020
110e22c
Merge branch 'develop' into t3channelfix
sankarpn Nov 5, 2020
3930956
use pod host name instead of external host and nodePort
sankarpn Nov 5, 2020
b7b1fac
use admin server internal pod name and service port
sankarpn Nov 6, 2020
2df3f13
Merge branch 'develop' of https://github.com/oracle/weblogic-kubernet…
sankarpn Nov 6, 2020
61cc5df
remove debug statements
sankarpn Nov 6, 2020
23665d0
add t3channel test in ItDedicatedMode.java
sankarpn Nov 6, 2020
f37b6a5
use adminserverpod and default service port
sankarpn Nov 6, 2020
76fafdc
pass the file name
sankarpn Nov 6, 2020
8793fc8
fix getting service port
sankarpn Nov 6, 2020
060d8ef
add t3channel
sankarpn Nov 6, 2020
c30adcb
Merge branch 'develop' of https://github.com/oracle/weblogic-kubernet…
sankarpn Nov 9, 2020
7ef7353
fix getting servicve node port
sankarpn Nov 9, 2020
3268e9a
correct typo
sankarpn Nov 9, 2020
aff6675
move the t3 channel test to separate it class
sankarpn Nov 9, 2020
742da59
install operator
sankarpn Nov 9, 2020
16fe424
exclude ItT3Channel from parallel runs
sankarpn Nov 10, 2020
2b99fdf
merge develop branch
sankarpn Nov 10, 2020
f7a8084
exclude t3channel test in parallel runs
sankarpn Nov 10, 2020
a496aa1
rollback changes to kindtest.sh
sankarpn Nov 10, 2020
00bb855
fix
sankarpn Nov 10, 2020
da0172e
Merge branch 'develop' into t3channelfix
sankarpn Nov 10, 2020
03a80bf
exclude t3channel test in parallel run
sankarpn Nov 10, 2020
34e3095
fix typo
sankarpn Nov 10, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
import static oracle.weblogic.kubernetes.actions.TestActions.deleteSecret;
import static oracle.weblogic.kubernetes.actions.TestActions.getNextIntrospectVersion;
import static oracle.weblogic.kubernetes.actions.TestActions.getServiceNodePort;
import static oracle.weblogic.kubernetes.actions.TestActions.getServicePort;
import static oracle.weblogic.kubernetes.actions.TestActions.listServices;
import static oracle.weblogic.kubernetes.actions.TestActions.shutdownDomain;
import static oracle.weblogic.kubernetes.actions.TestActions.startDomain;
Expand Down Expand Up @@ -867,10 +868,7 @@ private void createDomain() {
.adminService(new AdminService()
.addChannelsItem(new Channel()
.channelName("default")
.nodePort(0))
.addChannelsItem(new Channel()
.channelName("T3Channel")
.nodePort(t3ChannelPort))))
.nodePort(0))))
.addClustersItem(new Cluster() //cluster
.clusterName(clusterName)
.replicas(replicaCount)
Expand Down Expand Up @@ -902,15 +900,16 @@ private void createDomain() {

//deploy application clusterview.war to domain
private void deployApplication(String targets) {
logger.info("Getting node port for T3 channel");
int t3channelNodePort = assertDoesNotThrow(()
-> getServiceNodePort(domainNamespace, getExternalServicePodName(adminServerPodName), "t3channel"),
"Getting admin server t3channel node port failed");
assertNotEquals(-1, t3ChannelPort, "admin server t3channelport is not valid");
logger.info("Getting port for default channel");
int defaultChannelPort = assertDoesNotThrow(()
-> getServicePort(domainNamespace, getExternalServicePodName(adminServerPodName), "default"),
"Getting admin server default port failed");
logger.info("default channel port: {0}", defaultChannelPort);
assertNotEquals(-1, defaultChannelPort, "admin server defaultChannelPort is not valid");

//deploy application
logger.info("Deploying webapp {0} to domain", clusterViewAppPath);
deployUsingWlst(K8S_NODEPORT_HOST, Integer.toString(t3channelNodePort),
deployUsingWlst(adminServerPodName, Integer.toString(defaultChannelPort),
ADMIN_USERNAME_DEFAULT, ADMIN_PASSWORD_DEFAULT, targets, clusterViewAppPath,
domainNamespace);
}
Expand Down Expand Up @@ -955,13 +954,20 @@ private void restartDomain() {
private void createJdbcDataSource(String dsName, String user, String password, int mySQLNodePort) {

try {
logger.info("Getting port for default channel");
int defaultChannelPort = assertDoesNotThrow(()
-> getServicePort(domainNamespace, getExternalServicePodName(adminServerPodName), "default"),
"Getting admin server default port failed");
logger.info("default channel port: {0}", defaultChannelPort);
assertNotEquals(-1, defaultChannelPort, "admin server defaultChannelPort is not valid");

String jdbcDsUrl = "jdbc:mysql://" + K8S_NODEPORT_HOST + ":" + mySQLNodePort;

// create a temporary WebLogic domain property file
File domainPropertiesFile = File.createTempFile("domain", "properties");
Properties p = new Properties();
p.setProperty("admin_host", K8S_NODEPORT_HOST);
p.setProperty("admin_port", Integer.toString(t3ChannelPort));
p.setProperty("admin_host", adminServerPodName);
p.setProperty("admin_port", Integer.toString(defaultChannelPort));
p.setProperty("admin_username", ADMIN_USERNAME_DEFAULT);
p.setProperty("admin_password", ADMIN_PASSWORD_DEFAULT);
p.setProperty("dsName", dsName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,17 @@
import static org.junit.jupiter.api.Assertions.assertTrue;

/**
* The use case described in this class verifies that an external RMI client
* can access the WebLogic cluster JNDI tree using the LoadBalancer tunneling
* The use case described in this class verifies that an external RMI client
* can access the WebLogic cluster JNDI tree using the LoadBalancer tunneling
* approach as described in following WebLogic Kubernetes operator faq page
* https://oracle.github.io/weblogic-kubernetes-operator/faq/external-clients/
* Load balancer tunneling is the preferred approach for giving external
* clients and servers access to a Kubernetes hosted WebLogic cluster.
* In a WebLogic domain, configure a custom channel for the T3 protocol that
* enables HTTP tunneling, and specifies an external address and port that
* correspond to the address and port remote clients will use to access the
* load balancer. Set up a load balancer that redirects HTTP(s) traffic to
* the custom channel. Configure a WebLogic dynamic cluster domain using
* https://oracle.github.io/weblogic-kubernetes-operator/faq/external-clients/
* Load balancer tunneling is the preferred approach for giving external
* clients and servers access to a Kubernetes hosted WebLogic cluster.
* In a WebLogic domain, configure a custom channel for the T3 protocol that
* enables HTTP tunneling, and specifies an external address and port that
* correspond to the address and port remote clients will use to access the
* load balancer. Set up a load balancer that redirects HTTP(s) traffic to
* the custom channel. Configure a WebLogic dynamic cluster domain using
* Model In Image. Add a cluster targeted JMS distributed destination.
*/

Expand Down Expand Up @@ -149,24 +149,24 @@ public static void initAll(@Namespaces(3) List<String> namespaces) {
// create secret for admin credentials
logger.info("Create secret for admin credentials");
String adminSecretName = "weblogic-credentials";
createSecretWithUsernamePassword(adminSecretName, domainNamespace,
createSecretWithUsernamePassword(adminSecretName, domainNamespace,
ADMIN_USERNAME_DEFAULT, ADMIN_PASSWORD_DEFAULT);

// create encryption secret
logger.info("Create encryption secret");
String encryptionSecretName = "encryptionsecret";
createSecretWithUsernamePassword(encryptionSecretName, domainNamespace,
createSecretWithUsernamePassword(encryptionSecretName, domainNamespace,
"weblogicenc", "weblogicenc");

// Prepare the config map sparse model file from the template by replacing
// Public Address of the custom channel with K8S_NODEPORT_HOST
// Prepare the config map sparse model file from the template by replacing
// Public Address of the custom channel with K8S_NODEPORT_HOST
Map<String, String> configTemplateMap = new HashMap();
configTemplateMap.put("INGRESS_HOST", K8S_NODEPORT_HOST);

Path srcFile = Paths.get(RESOURCE_DIR,
Path srcFile = Paths.get(RESOURCE_DIR,
"wdt-models", "tunneling.model.template.yaml");
Path targetFile = assertDoesNotThrow(
() -> generateFileFromTemplate(srcFile.toString(),
() -> generateFileFromTemplate(srcFile.toString(),
TUNNELING_MODEL_FILE, configTemplateMap));
logger.info("Generated tunneling ConfigMap model file {0}", targetFile);

Expand Down Expand Up @@ -216,9 +216,9 @@ public void beforeEach() {
}

/**
* The external JMS client sends 300 messages to a Uniform Distributed
* Queue using load balancer HTTP url which maps to custom channel on
* cluster member server on WebLogic cluster. The test also make sure that
* The external JMS client sends 300 messages to a Uniform Distributed
* Queue using load balancer HTTP url which maps to custom channel on
* cluster member server on WebLogic cluster. The test also make sure that
* each member destination gets an equal number of messages.
*/
@Order(1)
Expand All @@ -229,17 +229,17 @@ public void testExternalRmiAccessThruHttpTunneling() {
// Build the standalone JMS Client to send and receive messages
buildClient();

// Prepare the voyager ingress file from the template file by replacing
// domain namespace, domain UID, cluster service name and tls secret
// Prepare the voyager ingress file from the template file by replacing
// domain namespace, domain UID, cluster service name and tls secret
Map<String, String> templateMap = new HashMap();
templateMap.put("DOMAIN_NS", domainNamespace);
templateMap.put("DOMAIN_UID", domainUid);
templateMap.put("CLUSTER", clusterName);

Path srcVoyagerHttpFile = Paths.get(RESOURCE_DIR,
Path srcVoyagerHttpFile = Paths.get(RESOURCE_DIR,
"tunneling", "voyager.tunneling.template.yaml");
Path targetVoyagerHttpFile = assertDoesNotThrow(
() -> generateFileFromTemplate(srcVoyagerHttpFile.toString(),
() -> generateFileFromTemplate(srcVoyagerHttpFile.toString(),
"voyager.tunneling.yaml", templateMap));
logger.info("Generated Voyager Http Tunneling file {0}", targetVoyagerHttpFile);

Expand All @@ -255,7 +255,7 @@ public void testExternalRmiAccessThruHttpTunneling() {

// Get the ingress service nodeport corresponding to non-tls service
int httpTunnelingPort =
getServiceNodePort(domainNamespace, "voyager-voyager-tunneling");
getServiceNodePort(domainNamespace, "voyager-voyager-tunneling", "tcp-80");
assertTrue(httpTunnelingPort != -1,
"Could not get the HttpTunnelingPort service node port");
logger.info("HttpTunnelingPort for Voyager {0}", httpTunnelingPort);
Expand Down Expand Up @@ -283,9 +283,9 @@ public void testExternalRmiAccessThruHttpTunneling() {
}

/**
* The external JMS client sends 300 messages to a Uniform Distributed
* Queue using load balancer HTTPS url which maps to custom channel on
* cluster member server on WebLogic cluster. The test also make sure that
* The external JMS client sends 300 messages to a Uniform Distributed
* Queue using load balancer HTTPS url which maps to custom channel on
* cluster member server on WebLogic cluster. The test also make sure that
* each destination member gets an equal number of messages.
*/
@Order(2)
Expand All @@ -296,8 +296,8 @@ public void testExternalRmiAccessThruHttpsTunneling() {
// Build the standalone JMS Client to send and receive messages
buildClient();

// Prepare the voyager ingress file from the template file by replacing
// domain namespace, domain UID, cluster service name and tls secret
// Prepare the voyager ingress file from the template file by replacing
// domain namespace, domain UID, cluster service name and tls secret
Map<String, String> templateMap = new HashMap();
templateMap.put("DOMAIN_NS", domainNamespace);
templateMap.put("DOMAIN_UID", domainUid);
Expand All @@ -320,7 +320,7 @@ public void testExternalRmiAccessThruHttpsTunneling() {
// running the standalone client.
importKeytoTrustStore();

// Deploy the voyager ingress controller with tls enabled service with SSL
// Deploy the voyager ingress controller with tls enabled service with SSL
// terminating at Ingress.
StringBuffer deployTlsIngress = new StringBuffer("kubectl apply -f ");
deployTlsIngress.append(Paths.get(RESULTS_ROOT, "voyager.tls.tunneling.yaml"));
Expand All @@ -332,7 +332,7 @@ public void testExternalRmiAccessThruHttpsTunneling() {

// Get the ingress service nodeport corresponding to tls service
int httpsTunnelingPort =
getServiceNodePort(domainNamespace, "voyager-voyager-tls-tunneling");
getServiceNodePort(domainNamespace, "voyager-voyager-tls-tunneling", "tcp-443");
assertTrue(httpsTunnelingPort != -1,
"Could not get the HttpsTunnelingPort service node port");
logger.info("HttpsTunnelingPort for Voyager {0}", httpsTunnelingPort);
Expand Down Expand Up @@ -365,15 +365,15 @@ public void testExternalRmiAccessThruHttpsTunneling() {
}

// Download the wlthint3client.jar from Adminserver pod to local filesystem.
// Use wlthint3client.jar in classpath to build and run the standalone
// JMS client that sends messages to a Uniform Distributed Queue using
// Use wlthint3client.jar in classpath to build and run the standalone
// JMS client that sends messages to a Uniform Distributed Queue using
// load balancer http(s) url which maps to custom channel on cluster member
// server on WebLogic cluster.
private void buildClient() {

assertDoesNotThrow(() -> copyFileFromPod(domainNamespace,
assertDoesNotThrow(() -> copyFileFromPod(domainNamespace,
adminServerPodName, "weblogic-server",
"/u01/oracle/wlserver/server/lib/wlthint3client.jar",
"/u01/oracle/wlserver/server/lib/wlthint3client.jar",
Paths.get(RESULTS_ROOT, "wlthint3client.jar")));
StringBuffer javacCmd = new StringBuffer("javac -cp ");
javacCmd.append(Paths.get(RESULTS_ROOT, "wlthint3client.jar "));
Expand Down Expand Up @@ -426,17 +426,17 @@ private static void createCertKeyFiles(String cn) {
Map<String, String> sanConfigTemplateMap = new HashMap();
sanConfigTemplateMap.put("INGRESS_HOST", K8S_NODEPORT_HOST);

Path srcFile = Paths.get(RESOURCE_DIR,
Path srcFile = Paths.get(RESOURCE_DIR,
"tunneling", "san.config.template.txt");
Path targetFile = assertDoesNotThrow(
() -> generateFileFromTemplate(srcFile.toString(),
() -> generateFileFromTemplate(srcFile.toString(),
"san.config.txt", sanConfigTemplateMap));
logger.info("Generated SAN config file {0}", targetFile);

tlsKeyFile = Paths.get(RESULTS_ROOT, domainNamespace + "-tls.key");
tlsCertFile = Paths.get(RESULTS_ROOT, domainNamespace + "-tls.cert");
String opcmd = "openssl req -x509 -nodes -days 365 -newkey rsa:2048 "
+ "-keyout " + tlsKeyFile + " -out " + tlsCertFile
+ "-keyout " + tlsKeyFile + " -out " + tlsCertFile
+ " -subj \"/CN=" + cn + "\" -extensions san"
+ " -config " + Paths.get(RESULTS_ROOT, "san.config.txt");
assertTrue(
Expand All @@ -449,7 +449,7 @@ private static void createCertKeyFiles(String cn) {
.command(opcmd2)).execute(), "openssl list command fails");
}

// Import the certificate into a JKS TrustStore to be used while running
// Import the certificate into a JKS TrustStore to be used while running
// external JMS client to send message to WebLogic.
private void importKeytoTrustStore() {

Expand All @@ -461,7 +461,7 @@ private void importKeytoTrustStore() {
new Command().withParams(new CommandParams()
.command(keycmd)).execute(), "keytool import command fails");

String keycmd2 = "keytool -list -keystore " + jksTrustFile
String keycmd2 = "keytool -list -keystore " + jksTrustFile
+ " -storepass password -noprompt";
assertTrue(
new Command().withParams(new CommandParams()
Expand All @@ -470,7 +470,7 @@ private void importKeytoTrustStore() {

// Create kubernetes secret from the ssl key and certificate
private void createSecretWithTLSCertKey(String tlsSecretName) {
String kcmd = "kubectl create secret tls " + tlsSecretName + " --key "
String kcmd = "kubectl create secret tls " + tlsSecretName + " --key "
+ tlsKeyFile + " --cert " + tlsCertFile + " -n " + domainNamespace;
assertTrue(
new Command().withParams(new CommandParams()
Expand All @@ -479,7 +479,7 @@ private void createSecretWithTLSCertKey(String tlsSecretName) {

private static void createDomainResource(
String domainUid, String domNamespace, String adminSecretName,
String repoSecretName, String encryptionSecretName,
String repoSecretName, String encryptionSecretName,
int replicaCount, String configmapName) {
// create the domain CR
Domain domain = new Domain()
Expand Down
Loading