Skip to content

Commit fa3ed4d

Browse files
Merge branch 'develop' of https://github.com/oracle/weblogic-kubernetes-operator into coherence_test
2 parents 973f7dd + 7ec5d1a commit fa3ed4d

File tree

8 files changed

+589
-69
lines changed

8 files changed

+589
-69
lines changed

docs-source/content/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
### Oracle WebLogic Server Kubernetes Operator
22

3-
Oracle is finding ways for organizations using WebLogic Server to run important workloads, to move those workloads into the cloud. By certifying on industry standards, such as Docker and Kubernetes, WebLogic now runs in a cloud neutral infrastructure. In addition, we've provided an open-source Oracle WebLogic Server Kubernetes Operator (the “operator”) which has several key features to assist you with deploying and managing WebLogic domains in a Kubernetes environment. You can:
3+
Oracle is finding ways for organizations using WebLogic Server to run important workloads, to move those workloads into the cloud. By certifying on industry standards, such as Docker and Kubernetes, WebLogic now runs in a cloud neutral infrastructure. In addition, we've provided an open source Oracle WebLogic Server Kubernetes Operator (the “operator”) which has several key features to assist you with deploying and managing WebLogic domains in a Kubernetes environment. You can:
44

55
* Create WebLogic domains in a Kubernetes persistent volume. This persistent volume can reside in an NFS file system or other Kubernetes volume types.
66
* Create a WebLogic domain in a Docker image.
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
---
2+
title: "Coherence Requirements"
3+
date: 2019-08-12T12:41:38-04:00
4+
draft: false
5+
---
6+
7+
If you are running Coherence on Kubernetes, either inside a WebLogic domain
8+
or standalone, then there are some additional requirements to make sure
9+
that Coherence can form clusters.
10+
11+
Note that some Fusion Middleware products, like SOA Suite, use Coherence
12+
and so these requirements apply to them.
13+
14+
#### Unicast and Well Known Address
15+
When the first Coherence process starts, it will form a cluster. The next
16+
Coherence process to start (i.e. in a different pod) will use UDP to try
17+
to contact the senior member.
18+
19+
If you create a WebLogic domain which contains a Coherence cluster
20+
using the samples provided in this project, then that cluster will
21+
be configured correctly so that it is able to form;
22+
you do not need to do any additional manual configuration.
23+
24+
If you are running Coherence standalone (outside a
25+
WebLogic domain) you should configure Coherence to use unicast and
26+
provide a "well known address (WKA)" so that all members can find the senior
27+
member. Most Kubernetes overlay network providers do not
28+
support multicast.
29+
30+
This is done by specifying the Coherence well known addresses in a variable named
31+
`coherence.wka` as shown in the example below:
32+
33+
```
34+
-Dcoherence.wka=my-cluster-service
35+
```
36+
37+
In this example `my-cluster-service` should be the name of the Kubernetes
38+
service that is pointing to all of the members of that Coherence cluster.
39+
40+
Please refer to the [Coherence operator documentation](https://oracle.github.io/coherence-operator/)
41+
for more information about running Coherence in Kubernetes outside of
42+
a WebLogic domain.
43+
44+
#### Operating system library requirements
45+
46+
In order for Coherence clusters to form correctly, the `conntrack` library
47+
must be installed. Most Kubernetes distributions will do this for you.
48+
If you have issues with clusters not forming, you should check that
49+
`conntrack` is installed using this command (or equivalent):
50+
51+
```
52+
$ rpm -qa | grep conntrack
53+
libnetfilter_conntrack-1.0.6-1.el7_3.x86_64
54+
conntrack-tools-1.4.4-4.el7.x86_64
55+
```
56+
57+
You should see output similar to that shown above. If you do not, then you
58+
should install `conntrack` using your operating system tools.
59+
60+
#### Firewall (iptables) requirements
61+
62+
Some Kubernetes distributions create `iptables` rules that block some
63+
types of traffic that Coherence requires to form clusters. If you are
64+
not able to form clusters, you can check for this issue using the
65+
following command:
66+
67+
```
68+
# iptables -t nat -v -L POST_public_allow -n
69+
Chain POST_public_allow (1 references)
70+
pkts bytes target prot opt in out source destination
71+
164K 11M MASQUERADE all -- * !lo 0.0.0.0/0 0.0.0.0/0
72+
0 0 MASQUERADE all -- * !lo 0.0.0.0/0 0.0.0.0/0
73+
```
74+
75+
If you see output similar to the example above, i.e. if you see any entries
76+
in this chain, then you need to remove them. You can remove the entries
77+
using this command:
78+
79+
```
80+
# iptables -t nat -v -D POST_public_allow 1
81+
```
82+
83+
Note that you will need to run that command for each line. So in the example
84+
above, you would need to run it twice.
85+
86+
After you are done, you can run the previous command again and verify that
87+
the output is now an empty list.
88+
89+
After making this change, restart your domain(s) and the Coherence cluster
90+
should now form correctly.
91+
92+
93+

docs-source/content/userguide/managing-domains/fmw-infra/_index.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ pre = "<b> </b>"
1515
* [Create a Kubernetes secret with the RCU credentials](#create-a-kubernetes-secret-with-the-rcu-credentials)
1616
* [Creating an FMW Infrastructure domain](#creating-an-fmw-infrastructure-domain)
1717
* [Patching the FMW Infrastructure image](#patching-the-fmw-infrastructure-image)
18+
* [Additional considerations for Coherence](#additional-considerations-for-coherence)
1819

1920

2021
Starting with release 2.2.0, the operator supports FMW Infrastructure domains.
@@ -432,3 +433,9 @@ for more information.
432433

433434
An example of a non-ZDP compliant patch is one that includes a schema change
434435
that can not be applied dynamically.
436+
437+
#### Additional considerations for Coherence
438+
439+
If you are running a domain which contains Coherence, please refer to
440+
[Coherence requirements]({{< relref "/faq/coherence-requirements.md" >}})
441+
for more information.

integration-tests/src/test/java/oracle/kubernetes/operator/ItSitConfig.java

Lines changed: 62 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import java.nio.file.StandardOpenOption;
1515
import java.util.Map;
1616
import java.util.logging.Level;
17-
1817
import oracle.kubernetes.operator.utils.Domain;
1918
import oracle.kubernetes.operator.utils.ExecResult;
2019
import oracle.kubernetes.operator.utils.Operator;
@@ -82,7 +81,14 @@ public static void staticPrepare() throws Exception {
8281
fqdn = TestUtils.getHostName();
8382
JDBC_URL = "jdbc:mysql://" + fqdn + ":" + MYSQL_DB_PORT + "/";
8483
// copy the configuration override files to replacing the JDBC_URL token
85-
copySitConfigFiles();
84+
String[] files = {
85+
"config.xml",
86+
"jdbc-JdbcTestDataSource-0.xml",
87+
"diagnostics-WLDF-MODULE-0.xml",
88+
"jms-ClusterJmsSystemResource.xml",
89+
"version.txt"
90+
};
91+
copySitConfigFiles(files, "test-secrets");
8692
// create weblogic domain with configOverrides
8793
domain = createSitConfigDomain();
8894
Assert.assertNotNull(domain);
@@ -132,7 +138,6 @@ public static void staticUnPrepare() throws Exception {
132138
* @throws Exception - if it cannot create the domain
133139
*/
134140
private static Domain createSitConfigDomain() throws Exception {
135-
String createDomainScript = TEST_RES_DIR + "/domain-home-on-pv/create-domain.py";
136141
// load input yaml to map and add configOverrides
137142
Map<String, Object> domainMap = TestUtils.loadYaml(DOMAINONPV_WLST_YAML);
138143
domainMap.put("configOverrides", "sitconfigcm");
@@ -168,22 +173,17 @@ private static void destroySitConfigDomain() throws Exception {
168173
*
169174
* @throws IOException when copying files from source location to staging area fails
170175
*/
171-
private static void copySitConfigFiles() throws IOException {
176+
private static void copySitConfigFiles(String files[], String secretName) throws IOException {
172177
String srcDir = TEST_RES_DIR + "/sitconfig/configoverrides";
173178
String dstDir = configOverrideDir;
174-
String[] files = {
175-
"config.xml",
176-
"jdbc-JdbcTestDataSource-0.xml",
177-
"diagnostics-WLDF-MODULE-0.xml",
178-
"jms-ClusterJmsSystemResource.xml",
179-
"version.txt"
180-
};
179+
180+
Charset charset = StandardCharsets.UTF_8;
181181
for (String file : files) {
182182
Path path = Paths.get(srcDir, file);
183183
logger.log(Level.INFO, "Copying {0}", path.toString());
184-
Charset charset = StandardCharsets.UTF_8;
185184
String content = new String(Files.readAllBytes(path), charset);
186185
content = content.replaceAll("JDBC_URL", JDBC_URL);
186+
content = content.replaceAll("test-secrets", secretName);
187187
if (getWeblogicImageTag().contains(PS3_TAG)) {
188188
content = content.replaceAll(JDBC_DRIVER_NEW, JDBC_DRIVER_OLD);
189189
}
@@ -387,7 +387,7 @@ public void testConfigOverrideAfterDomainStartup() throws Exception {
387387
Paths.get(srcDir, "config_1.xml"),
388388
Paths.get(dstDir, "config.xml"),
389389
StandardCopyOption.REPLACE_EXISTING);
390-
recreateCrdWithNewConfigMap();
390+
recreateConfigMapandRestart("test-secrets", "test-secrets");
391391
transferTests();
392392
ExecResult result =
393393
TestUtils.exec(
@@ -423,7 +423,7 @@ public void testOverrideJdbcResourceAfterDomainStart() throws Exception {
423423
Paths.get(srcDir, "jdbc-JdbcTestDataSource-1.xml"),
424424
Paths.get(dstDir, "jdbc-JdbcTestDataSource-1.xml"),
425425
StandardCopyOption.REPLACE_EXISTING);
426-
recreateCrdWithNewConfigMap();
426+
recreateConfigMapandRestart("test-secrets", "test-secrets");
427427
transferTests();
428428
ExecResult result =
429429
TestUtils.exec(
@@ -452,45 +452,29 @@ public void testOverrideJdbcResourceWithNewSecret() throws Exception {
452452
logTestBegin(testMethod);
453453
// recreate the map with new situational config files
454454
String[] files = {"config.xml", "jdbc-JdbcTestDataSource-0.xml"};
455-
String secretName = "test-secrets-new";
456-
for (String file : files) {
457-
Path path = Paths.get(sitconfigTmpDir, "configoverridefiles", file);
458-
String content = new String(Files.readAllBytes(path), StandardCharsets.UTF_8);
459-
content = content.replaceAll("test-secrets", secretName);
460-
if (getWeblogicImageTag().contains(PS3_TAG)) {
461-
content = content.replaceAll(JDBC_DRIVER_NEW, JDBC_DRIVER_OLD);
462-
}
463-
Files.write(
464-
Paths.get(sitconfigTmpDir, "configoverridefiles", file),
465-
content.getBytes(StandardCharsets.UTF_8),
466-
StandardOpenOption.TRUNCATE_EXISTING);
455+
String newSecret = "test-secrets-new";
456+
try {
457+
copySitConfigFiles(files, newSecret);
458+
recreateConfigMapandRestart("test-secrets", newSecret);
459+
transferTests();
460+
ExecResult result =
461+
TestUtils.exec(
462+
KUBE_EXEC_CMD
463+
+ " 'sh runSitConfigTests.sh "
464+
+ fqdn
465+
+ " "
466+
+ T3CHANNELPORT
467+
+ " weblogic welcome1 "
468+
+ testMethod
469+
+ " "
470+
+ JDBC_URL
471+
+ "'");
472+
assertResult(result);
473+
logger.log(Level.INFO, "SUCCESS - {0}", testMethod);
474+
} finally {
475+
copySitConfigFiles(files, "test-secrets");
476+
recreateConfigMapandRestart("test-secrets-new", "test-secrets");
467477
}
468-
String content = new String(Files.readAllBytes(Paths.get(domainYaml)), StandardCharsets.UTF_8);
469-
content = content.replaceAll("test-secrets", secretName);
470-
Files.write(
471-
Paths.get(domainYaml),
472-
content.getBytes(StandardCharsets.UTF_8),
473-
StandardOpenOption.TRUNCATE_EXISTING);
474-
475-
TestUtils.exec("kubectl delete secret " + domain.getDomainUid() + "-test-secrets", true);
476-
createNewSecret(secretName);
477-
TestUtils.exec("kubectl apply -f " + domainYaml, true);
478-
recreateCrdWithNewConfigMap();
479-
transferTests();
480-
ExecResult result =
481-
TestUtils.exec(
482-
KUBE_EXEC_CMD
483-
+ " 'sh runSitConfigTests.sh "
484-
+ fqdn
485-
+ " "
486-
+ T3CHANNELPORT
487-
+ " weblogic welcome1 "
488-
+ testMethod
489-
+ " "
490-
+ JDBC_URL
491-
+ "'");
492-
assertResult(result);
493-
logger.log(Level.INFO, "SUCCESS - {0}", testMethod);
494478
}
495479

496480
/**
@@ -522,7 +506,32 @@ private void createJdbcResource() throws Exception {
522506
*
523507
* @throws Exception when pods restart fail
524508
*/
525-
private void recreateCrdWithNewConfigMap() throws Exception {
509+
private void recreateConfigMapandRestart(String oldSecret, String newSecret) throws Exception {
510+
if (!oldSecret.equals(newSecret)) {
511+
String content =
512+
new String(Files.readAllBytes(Paths.get(domainYaml)), StandardCharsets.UTF_8);
513+
content = content.replaceAll(oldSecret, newSecret);
514+
Files.write(
515+
Paths.get(domainYaml),
516+
content.getBytes(StandardCharsets.UTF_8),
517+
StandardOpenOption.TRUNCATE_EXISTING);
518+
519+
TestUtils.exec("kubectl delete secret " + domain.getDomainUid() + "-" + oldSecret, true);
520+
String cmd =
521+
"kubectl -n "
522+
+ domain.getDomainNs()
523+
+ " create secret generic "
524+
+ domain.getDomainUid()
525+
+ "-"
526+
+ newSecret
527+
+ " --from-literal=hostname="
528+
+ TestUtils.getHostName()
529+
+ " --from-literal=dbusername=root"
530+
+ " --from-literal=dbpassword=root123";
531+
TestUtils.exec(cmd, true);
532+
TestUtils.exec("kubectl apply -f " + domainYaml, true);
533+
}
534+
526535
int clusterReplicas =
527536
TestUtils.getClusterReplicas(DOMAINUID, domain.getClusterName(), domain.getDomainNs());
528537

@@ -543,21 +552,6 @@ private void recreateCrdWithNewConfigMap() throws Exception {
543552
domain.verifyDomainCreated();
544553
}
545554

546-
private void createNewSecret(String secretName) throws Exception {
547-
String cmd =
548-
"kubectl -n "
549-
+ domain.getDomainNs()
550-
+ " create secret generic "
551-
+ domain.getDomainUid()
552-
+ "-"
553-
+ secretName
554-
+ " --from-literal=hostname="
555-
+ TestUtils.getHostName()
556-
+ " --from-literal=dbusername=root"
557-
+ " --from-literal=dbpassword=root123";
558-
TestUtils.exec(cmd, true);
559-
}
560-
561555
/**
562556
* Transfer the tests to run in WLS pods.
563557
*

integration-tests/src/test/resources/setupenv.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ function create_image_pull_secret_wl {
5454
echo "secret $IMAGE_PULL_SECRET_WEBLOGIC was not created successfully"
5555
exit 1
5656
fi
57+
58+
# below docker pull is needed to for domain home in image tests the base image should be in local repo
59+
docker login -u $OCR_USERNAME -p $OCR_PASSWORD ${OCR_SERVER}
60+
docker pull $IMAGE_NAME_WEBLOGIC:$IMAGE_TAG_WEBLOGIC
5761
fi
5862
set -x
5963
}

0 commit comments

Comments
 (0)