Skip to content

Commit da3480b

Browse files
committed
Merge remote-tracking branch 'origin/develop' into crd-2.1
2 parents 112307a + 3fad371 commit da3480b

File tree

30 files changed

+1501
-3020
lines changed

30 files changed

+1501
-3020
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ Only pull requests from committers that can be verified as having signed the OCA
147147

148148
Please be aware that pull requests that seek to introduce a new dependency will be subject to additional review. In general, contributors should avoid dependencies with incompatible licenses, and should try to use recent versions of dependencies. Standard security vulnerability checklists will be consulted before accepting a new dependency. Dependencies on closed-source code, including WebLogic Server, will most likely be rejected.
149149

150-
## Use Helm Chart from Github chart repository
150+
## Use Helm Chart from GitHub chart repository
151151

152152
Add this repo to Helm installation:
153153

@@ -157,7 +157,7 @@ $ helm repo add weblogic-operator https://oracle.github.io/weblogic-kubernetes-o
157157

158158
Verify repository was added correctly:
159159

160-
````
160+
```
161161
$ helm repo list
162162
NAME URL
163163
weblogic-operator https://oracle.github.io/weblogic-kubernetes-operator/charts

integration-tests/README.md

Lines changed: 58 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Wercker runs only Quick test use cases, Jenkins runs both Quick and Full test us
1616

1717
Java integration tests cover the below use cases:
1818

19-
Quick test use cases
19+
Quick test Configuration & Use Cases -
2020

2121
| | |
2222
| --- | --- |
@@ -42,25 +42,28 @@ Also the below use cases are covered for Quick test:
4242
9. Verify the liveness probe by killing managed server 1 process 3 times to kick pod auto-restart.
4343
10. Shutdown the domain by changing domain `serverStartPolicy` to `NEVER`.
4444

45-
Full test use cases
45+
46+
Full test Configuration & Use Cases - Runs Quick test Configuration & Use cases and the below
4647

4748
| | |
4849
| --- | --- |
49-
| Operator Configuration | operator2 deployed in `weblogic-operator2` namespace and manages domains `test2` namespace. |
50-
| Domain Configuration | Domain on PV using WDT; domain with `serverStartPolicy` `ADMIN_ONLY`; domain with auto and custom situational configuration; two domains managed by two operators; domain with recycle `weblogicDomainStorageReclaimPolicy`; domain with default sample values. |
50+
| Operator Configuration | operator2 deployed in weblogic-operator2 namespace and manages domains test2 namespace |
51+
| Domain Configuration | Domain on PV using WDT <p> Domain home in image using WLST <p> Domain home in image using WDT <p> Domain with serverStartPolicy ADMIN_ONLY <p> Domain with auto and custom situational configuration <p> Two domains managed by two operators <p> Domain with Recycle weblogicDomainStorageReclaimPolicy <p> Domain with default sample values |
5152

5253

5354
Basic Use Cases described above are verified in all the domain configurations. Also the below use cases are covered:
5455

5556
| Domain | Use Case |
5657
| --- | --- |
5758
| Domain on PV using WDT | WLDF scaling |
58-
| Domain with ADMIN_ONLY | Making sure only admin server is started and managed servers are not started. Shutdown domain by deleting domain CRD. Create domain on existing PV dir, pv is already populated by a shutdown domain. |
59-
| Domain with situational config | Create domain with listen address not set for admin server and t3 channel/NAP and incorrect file for admin server log location. Introspector should override these with sit-config automatically. Also, with some junk value for t3 channel public address and using custom situational config override replace with valid public address using secret. Also, on Jenkins this domain uses NFS instead of HOSTPATH PV storage. |
60-
| Two domains managed by two operators | Verify scaling and restart of one domain doesn't impact another domain. Delete domain resources using delete script from samples. |
61-
| Domain with Recycle policy | Create domain with pvReclaimPolicy="Recycle" Verify that the PV is deleted once the domain and PVC are deleted. |
62-
| Domain with default sample values | Create domain using mostly default values for inputs. |
63-
59+
| Domain with ADMIN_ONLY | making sure only admin server is started and managed servers are not started. Shutdown domain by deleting domain CRD. Create domain on existing PV dir, pv is already populated by a shutdown domain. |
60+
| Domain with situational config | create domain with listen address not set for admin server and t3 channel/NAP and incorrect file for admin server log location. Introspector should override these with sit-config automatically. Also, with some junk value for t3 channel public address and using custom situational config override replace with valid public address using secret. Also, on Jenkins this domain uses NFS instead of HOSTPATH PV storage |
61+
| Two domains managed by two operators | verify scaling and restart of one domain doesn't impact another domain. Delete domain resources using delete script from samples. |
62+
| Domain with Recycle policy | create domain with pvReclaimPolicy="Recycle" Verify that the PV is deleted once the domain and PVC are deleted |
63+
| Domain with default sample values | create domain using mostly default values for inputs |
64+
| Domain home in image using WLST | cluster scaling |
65+
| Domain home in image using WDT | cluster scaling |
66+
6467

6568
# Directory Configuration and Structure
6669

@@ -166,10 +169,21 @@ Certain properties like weblogicDomainStoragePath, image, externalOperatorCert a
166169

167170
# How does it work
168171

169-
When the tests are run manually with mvn command on hosted Linux, WebLogic image store/oracle/weblogic:12.2.1.3 is pulled from docker hub or uses local image if one exists. Server jre images are pulled from a local repository wlsldi-v2.docker.oraclecorp.com. Operator image is built with the git branch from where the mvn command is executed.
170-
All the tests that start with IT*.java are run. The test builds the operator, runs a series of tests and archives the results into tar.gz files upon completion.
171-
172-
Integration test classes:
172+
When the tests are run with mvn command,
173+
- cleanup the test tmp files, PV dir and k8s artifacts created for the test if any
174+
- creates the required secrets to pull the WL image from docker hub
175+
- Operator image is built with the git branch from where the mvn command is executed.
176+
- creates Operator and verifies operator is running
177+
- creates Domain crd using samples
178+
- verifies the domain is started and servers are ready, services are created
179+
- executes the basic and advanced use cases
180+
- shutdown the domain
181+
- archive logs and results
182+
- cleanup the tmp files, PV dir and k8s artifacts created for the test
183+
184+
All the tests that start with IT*.java in integration-tests/src/test/java are run.
185+
186+
**Integration test classes:**
173187

174188
When the integration test class ITOperator is executed, staticPrepare() method is called once before any of the test methods in the class and staticUnPrepare() method once at the end.
175189

@@ -179,27 +193,43 @@ staticUnPrepare() - releases the cluster lease on wercker env.
179193

180194
test methods - testDomainOnPVUsingWLST, testDomainOnPVUsingWDT, testTwoDomainsManagedByTwoOperators, testCreateDomainWithStartPolicyAdminOnly, testCreateDomainPVReclaimPolicyRecycle, testCreateDomainWithDefaultValuesInSampleInputs, testAutoAndCustomSitConfigOverrides, testOperatorRESTIdentityBackwardCompatibility, testOperatorRESTUsingCertificateChain
181195

182-
Utility classes:
196+
**Utility classes:**
183197

184-
Operator - contains methods to create/destroy operator, verify operator created, scale using rest api, etc
185-
Domain - contains methods to create/destroy domain, verify domain created,deploy webapp, load balancing, etc
186-
PersistentVolume - to create PV
187-
LoadBalancer - to create load balancer
188-
Secret - to create secret
198+
Operator - constructor takes yaml file with operator properties and generates operator valus yaml with required properties and certs, creates service account, namespace and calls helm install using the generated values yaml file. Also contains methods to delete operator release, verify operator created and ready, scale using rest api, verify a given domain via rest, verify external rest service, etc <p>
199+
Domain - constructor takes Map with domain, LB, PV properties and creates domain crd, LB operator/ingress and PV artifacts using the sample scripts provided in the project. Also contains helper methods to destroy domain by deleting domain crd, verify domain created and servers are ready, deploy webapp, verify load balancing of http requests, etc <p>
200+
PersistentVolume - runs k8s job to create PV directory and creates PV and PVC using sample scripts <p>
201+
LoadBalancer - creates load balancer, currently TREFIK and VOYAGER are supported <p>
202+
Secret - creates a k8s secret <p>
203+
TestUtils - mostly runs kubectl commands. Contains utility methods to check if a pod is created, ready, deleted, service created, get pod restart cnt, get cluster replica, delete PVC, check PV released, create rbac policy, create wldf module, etc. <p>
204+
ExecCommand - Class for executing shell commands from java <p>
205+
ExecResult - Class that holds the results of using java to exec a command (i.e. exit value, stdout and stderr) <p>
206+
K8sTestUtils - uses k8s java client api, this is used only for delete domain use cases for now. <p>
189207

190208
# How to run the Java integration tests
191209

192210
* Maven and latest Git should be in PATH
193211
* export JAVA_HOME
194-
195-
Command to run the tests:
212+
* export WEBLOGIC_IMAGE_NAME and WEBLOGIC_IMAGE_TAG if different from store/oracle/weblogic and 12.2.1.3
213+
* Setup docker access to WebLogic 12c Images
214+
215+
Method 1
216+
- Setup a personal account on hub.docker.com
217+
- Then sign in to hub.docker.com and signup for access to WebLogic 12c Images via https://hub.docker.com/_/oracle-weblogic-server-12c
218+
- Then export the following before running the tests:
219+
```
220+
export DOCKER_USERNAME=<docker_username>
221+
export DOCKER_PASSWORD=<docker_password>
222+
export DOCKER_EMAIL=<docker_email>
223+
```
224+
225+
Method 2
226+
- Make sure the weblogic image i.e. store/oracle/weblogic:12.2.1.3 already exists locally in a docker repository the k8s cluster can access
227+
- Make sure the weblogic image has patch p29135930 (required for the WebLogic Kubernetes Operator).
228+
- If not, see [https://github.com/oracle/docker-images/tree/master/OracleWebLogic/samples/12213-patch-wls-for-k8s].
229+
230+
231+
* Command to run the tests:
196232
```
197-
export DOCKER_USERNAME=<docker_username>
198-
export DOCKER_PASSWORD=<docker_password>
199-
export DOCKER_EMAIL=<docker_email>
200-
or
201-
make sure the weblogic image i.e. store/oracle/weblogic:12.2.1.3 already exists locally
202-
203233
mvn clean verify -P java-integration-tests 2>&1 | tee log.txt
204234
```
205235

integration-tests/pom.xml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,12 @@
7474
<dependency>
7575
<groupId>javax.jms</groupId>
7676
<artifactId>javax.jms-api</artifactId>
77-
<version>2.0</version>
77+
<version>2.0.1</version>
78+
</dependency>
79+
<dependency>
80+
<groupId>javax.xml.bind</groupId>
81+
<artifactId>jaxb-api</artifactId>
82+
<version>2.3.1</version>
7883
</dependency>
7984
</dependencies>
8085

@@ -149,7 +154,7 @@
149154
<plugin>
150155
<groupId>org.apache.maven.plugins</groupId>
151156
<artifactId>maven-failsafe-plugin</artifactId>
152-
<version>2.20.1</version>
157+
<version>2.22.1</version>
153158
<configuration> <!-- run tests in parallel -->
154159
<encoding>UTF-8</encoding>
155160
<argLine>${failsafeArgLine}</argLine>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ public void testOperatorRESTUsingCertificateChain() throws Exception {
521521
*
522522
* @throws Exception
523523
*/
524-
// @Test
524+
@Test
525525
public void testDomainInImageUsingWLST() throws Exception {
526526
Assume.assumeFalse(QUICKTEST);
527527
String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName();
@@ -553,7 +553,7 @@ public void testDomainInImageUsingWLST() throws Exception {
553553
*
554554
* @throws Exception
555555
*/
556-
// @Test
556+
@Test
557557
public void testDomainInImageUsingWDT() throws Exception {
558558
Assume.assumeFalse(QUICKTEST);
559559
String testMethodName = new Object() {}.getClass().getEnclosingMethod().getName();

integration-tests/src/test/java/oracle/kubernetes/operator/utils/Domain.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public class Domain {
5757
private int loadBalancerWebPort = 30305;
5858
private String userProjectsDir = "";
5959
private String projectRoot = "";
60-
private boolean ingressPerDomain = false;
60+
private boolean ingressPerDomain = true;
6161

6262
private String createDomainScript = "";
6363
private String inputTemplateFile = "";

integration-tests/src/test/java/oracle/kubernetes/operator/utils/K8sTestUtils.java

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,10 +89,10 @@ public void verifyPods(String namespace, String labelSelectors, int expected) th
8989
V1PodList v1PodList =
9090
coreV1Api.listNamespacedPod(
9191
namespace,
92+
Boolean.FALSE,
9293
Boolean.FALSE.toString(),
9394
null,
9495
null,
95-
Boolean.FALSE,
9696
labelSelectors,
9797
null,
9898
null,
@@ -202,9 +202,7 @@ public void verifyIngresses(
202202
// TODO verify {domainUID}-cluster-1
203203
assertEquals(
204204
"Number of labeled ingress", labeledIngressList.getItems().size(), expectedLabeled);
205-
labeledIngressList
206-
.getItems()
207-
.stream()
205+
labeledIngressList.getItems().stream()
208206
.forEach(li -> li.getMetadata().getNamespace().equals(domainNs));
209207
V1beta1IngressList traefikIngressList =
210208
extensionsV1beta1Api.listIngressForAllNamespaces(
@@ -218,9 +216,7 @@ public void verifyIngresses(
218216
null,
219217
Boolean.FALSE);
220218
assertEquals("Number of Traefik ingress", traefikIngressList.getItems().size(), 1);
221-
traefikIngressList
222-
.getItems()
223-
.stream()
219+
traefikIngressList.getItems().stream()
224220
.forEach(ti -> ti.getMetadata().getNamespace().equals(domainNs));
225221
}
226222

@@ -303,10 +299,10 @@ public void verifySecrets(String secretName, int expected) throws Exception {
303299
public void verifyPvs(String labelSelectors, int expected) throws Exception {
304300
V1PersistentVolumeList v1PersistentVolumeList =
305301
coreV1Api.listPersistentVolume(
302+
Boolean.TRUE,
306303
Boolean.FALSE.toString(),
307304
null,
308305
null,
309-
Boolean.TRUE,
310306
labelSelectors,
311307
null,
312308
null,
@@ -318,10 +314,10 @@ public void verifyPvs(String labelSelectors, int expected) throws Exception {
318314
public void verifyNoClusterRoles(String domain1Ls) throws Exception {
319315
V1ClusterRoleList v1ClusterRoleList =
320316
rbacAuthorizationV1Api.listClusterRole(
317+
Boolean.TRUE,
321318
Boolean.FALSE.toString(),
322319
null,
323320
null,
324-
Boolean.TRUE,
325321
domain1Ls,
326322
null,
327323
null,
@@ -333,10 +329,10 @@ public void verifyNoClusterRoles(String domain1Ls) throws Exception {
333329
public void verifyNoClusterRoleBindings(String labelSelectors) throws Exception {
334330
V1ClusterRoleBindingList v1ClusterRoleBindingList =
335331
rbacAuthorizationV1Api.listClusterRoleBinding(
332+
Boolean.TRUE,
336333
Boolean.FALSE.toString(),
337334
null,
338335
null,
339-
Boolean.TRUE,
340336
labelSelectors,
341337
null,
342338
null,

integration-tests/src/test/java/oracle/kubernetes/operator/utils/Operator.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,9 @@ private void generateInputYaml() throws Exception {
314314
sb.append(generatedInputYamlFile);
315315
logger.info("Invoking " + sb.toString());
316316
ExecCommand.exec(sb.toString());
317+
318+
/* String content = new String(Files.readAllBytes(Paths.get(generatedInputYamlFile)));
319+
logger.info("Content of weblogic-operator-values.yaml \n" + content); */
317320
}
318321

319322
private void runCommandInLoop(String command) throws Exception {
Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
# Copyright 2018, Oracle Corporation and/or its affiliates. All rights reserved.
22
# Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
33

4+
import time as systime
5+
46
connect(sys.argv[1],sys.argv[2],sys.argv[3])
5-
deploy(sys.argv[4],sys.argv[5],sys.argv[6],upload='false',remote='false')
7+
deploy(sys.argv[4],sys.argv[5],sys.argv[6],upload='false',remote='false')
8+
#systime.sleep(15)
9+
10+
#cd ('AppDeployments')
11+
#myapps=cmo.getAppDeployments()
12+
13+
#for appName in myapps:
14+
# domainConfig()
15+
# cd ('/AppDeployments/'+appName.getName()+'/Targets')
16+
# mytargets = ls(returnMap='true')
17+
# domainRuntime()
18+
# cd('AppRuntimeStateRuntime')
19+
# cd('AppRuntimeStateRuntime')
20+
# for targetinst in mytargets:
21+
# curstate4=cmo.getCurrentState(appName.getName(),targetinst)
22+
# print '-----------', curstate4, '-----------', appName.getName()

integration-tests/src/test/resources/domaininimagewdt.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ initialManagedServerReplicas: 2
88
exposeAdminT3Channel: true
99
exposeAdminNodePort: true
1010
domainHomeImageBuildPath: ./docker-images/OracleWebLogic/samples/12213-domain-home-in-image-wdt
11-
domainHomeImageBase: "store/oracle/weblogic:12.2.1.3"
11+
domainHomeImageBase: "store/oracle/weblogic:12.2.1.3"
12+
logHomeOnPV: true

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ function pull_tag_images {
8787
echo "secret $IMAGE_PULL_SECRET_WEBLOGIC was not created successfully"
8888
exit 1
8989
fi
90+
# below docker pull is needed to get wlthint3client.jar from image to put in the classpath
9091
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
9192
docker pull $IMAGE_NAME_WEBLOGIC:$IMAGE_TAG_WEBLOGIC
9293
fi

0 commit comments

Comments
 (0)