Skip to content

Commit 7666624

Browse files
authored
Merge pull request #744 from oracle/domain-home-fix
WIP: Issue #721 fix. When domain resource 'domainHome' is not set and 'domainHomeInImage' is 'true' look for a single WebLogic domain under '/u01/oracle/user_projects/domains', and use this as this location as the DOMAIN_HOME.
2 parents 224a808 + c89c5a8 commit 7666624

File tree

14 files changed

+113
-31
lines changed

14 files changed

+113
-31
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ The fastest way to experience the operator is to follow the [Quick start guide](
3232

3333
| Issue | Description |
3434
| --- | --- |
35-
| [#721](https://github.com/oracle/weblogic-kubernetes-operator/issues/721) | Incorrect default `domainHome` when `domainHomeInImage` is true. |
3635
| [#722](https://github.com/oracle/weblogic-kubernetes-operator/issues/722) | Server services not recreated when labels/annotations changed. |
3736
| [#726](https://github.com/oracle/weblogic-kubernetes-operator/issues/726) | Clusters only support default channel. |
3837

docs/domains/Domain.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@
224224
"type": "string"
225225
},
226226
"domainHome": {
227-
"description": "The folder for the Weblogic Domain. (Not required)Defaults to /shared/domains/domains/domainUID if domainHomeInImage is falseDefaults to /shared/domains/domain if domainHomeInImage is true",
227+
"description": "The folder for the Weblogic Domain. (Not required)Defaults to /shared/domains/domains/domainUID if domainHomeInImage is falseDefaults to /u01/oracle/user_projects/domains/ if domainHomeInImage is true",
228228
"type": "string"
229229
},
230230
"logHomeEnabled": {

docs/domains/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1144,7 +1144,7 @@
11441144
"type": "string"
11451145
},
11461146
"domainHome": {
1147-
"description": "The folder for the Weblogic Domain. (Not required)Defaults to /shared/domains/domains/domainUID if domainHomeInImage is falseDefaults to /shared/domains/domain if domainHomeInImage is true",
1147+
"description": "The folder for the Weblogic Domain. (Not required)Defaults to /shared/domains/domains/domainUID if domainHomeInImage is falseDefaults to /u01/oracle/user_projects/domains/ if domainHomeInImage is true",
11481148
"type": "string"
11491149
},
11501150
"logHomeEnabled": {

model/src/main/java/oracle/kubernetes/weblogic/domain/v2/Domain.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2017, 2018, Oracle Corporation and/or its affiliates. All rights reserved.
1+
// Copyright 2017, 2019, Oracle Corporation and/or its affiliates. All rights reserved.
22
// Licensed under the Universal Permissive License v 1.0 as shown at
33
// http://oss.oracle.com/licenses/upl.
44

@@ -321,13 +321,13 @@ public boolean isDomainHomeInImage() {
321321
/**
322322
* Returns the domain home
323323
*
324-
* <p>Defaults to either /shared/domain/ or /shared/domains/domainUID
324+
* <p>Defaults to either /u01/oracle/user_projects/domains or /shared/domains/domainUID
325325
*
326326
* @return domain home
327327
*/
328328
public String getDomainHome() {
329329
if (spec.getDomainHome() != null) return spec.getDomainHome();
330-
if (spec.isDomainHomeInImage()) return "/shared/domain";
330+
if (spec.isDomainHomeInImage()) return "/u01/oracle/user_projects/domains";
331331
return "/shared/domains/" + getDomainUID();
332332
}
333333

model/src/main/java/oracle/kubernetes/weblogic/domain/v2/DomainSpec.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2017, 2018, Oracle Corporation and/or its affiliates. All rights reserved.
1+
// Copyright 2017, 2019, Oracle Corporation and/or its affiliates. All rights reserved.
22
// Licensed under the Universal Permissive License v 1.0 as shown at
33
// http://oss.oracle.com/licenses/upl.
44

@@ -41,7 +41,7 @@ public class DomainSpec extends BaseConfiguration {
4141
@Description(
4242
"The folder for the Weblogic Domain. (Not required)"
4343
+ "Defaults to /shared/domains/domains/domainUID if domainHomeInImage is false"
44-
+ "Defaults to /shared/domains/domain if domainHomeInImage is true")
44+
+ "Defaults to /u01/oracle/user_projects/domains/ if domainHomeInImage is true")
4545
private String domainHome;
4646

4747
/**

model/src/test/java/oracle/kubernetes/weblogic/domain/v2/DomainV2Test.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2018, Oracle Corporation and/or its affiliates. All rights reserved.
1+
// Copyright 2018, 2019, Oracle Corporation and/or its affiliates. All rights reserved.
22
// Licensed under the Universal Permissive License v 1.0 as shown at
33
// http://oss.oracle.com/licenses/upl.
44

@@ -1207,7 +1207,7 @@ public void domainHomeTest_standardHome2() {
12071207
public void domainHomeTest_standardHome3() {
12081208
configureDomain(domain).withDomainHomeInImage(true);
12091209

1210-
assertThat(domain.getDomainHome(), equalTo("/shared/domain"));
1210+
assertThat(domain.getDomainHome(), equalTo("/u01/oracle/user_projects/domains"));
12111211
}
12121212

12131213
@Test

operator/src/main/resources/scripts/introspectDomain.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
# Copyright 2018, Oracle Corporation and/or its affiliates. All rights reserved.
2+
# Copyright 2018, 2019, Oracle Corporation and/or its affiliates. All rights reserved.
33
# Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
44

55
#
@@ -74,6 +74,10 @@ for dir_var in DOMAIN_HOME JAVA_HOME WL_HOME MW_HOME; do
7474
[ ! -d "${!dir_var}" ] && trace "Error: missing ${dir_var} directory '${!dir_var}'." && exit 1
7575
done
7676

77+
# check DOMAIN_HOME for a config/config.xml, reset DOMAIN_HOME if needed
78+
79+
exportEffectiveDomainHome || exit 1
80+
7781
# start node manager
7882

7983
trace "Starting node manager"
Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,37 @@
11
#!/bin/bash
22

3-
# Copyright 2017, 2018, Oracle Corporation and/or its affiliates. All rights reserved.
3+
# Copyright 2017, 2019, Oracle Corporation and/or its affiliates. All rights reserved.
44
# Licensed under the Universal Permissive License v 1.0 as shown at
55
# http://oss.oracle.com/licenses/upl.
66

77
# Kubernetes periodically calls this liveness probe script to determine whether
88
# the pod should be restarted. The script checks a WebLogic Server state file which
99
# is updated by the node manager.
1010

11+
# if the livenessProbeSuccessOverride file is available, treat failures as success:
12+
RETVAL=$(test -f /weblogic-operator/debug/livenessProbeSuccessOverride ; echo $?)
13+
14+
SCRIPTPATH="$( cd "$(dirname "$0")" > /dev/null 2>&1 ; pwd -P )"
15+
source ${SCRIPTPATH}/traceUtils.sh
16+
[ $? -ne 0 ] && echo "Error: missing file ${SCRIPTPATH}/traceUtils.sh" && exit $RETVAL
17+
18+
# check DOMAIN_HOME for a config/config.xml, reset DOMAIN_HOME if needed:
19+
exportEffectiveDomainHome || exit $RETVAL
20+
1121
DN=${DOMAIN_NAME?}
1222
SN=${SERVER_NAME?}
1323
DH=${DOMAIN_HOME?}
1424

1525
STATEFILE=${DH}/servers/${SN}/data/nodemanager/${SN}.state
1626

17-
# if the livenessProbeSuccessOverride file is available, treat failures as success
18-
#
19-
RETVAL=$(test -f /weblogic-operator/debug/livenessProbeSuccessOverride ; echo $?)
20-
2127
if [ "${MOCK_WLS}" != 'true' ]; then
2228
if [ `jps -l | grep -c " weblogic.NodeManager"` -eq 0 ]; then
23-
echo "Error: WebLogic NodeManager process not found."
29+
trace "Error: WebLogic NodeManager process not found."
2430
exit $RETVAL
2531
fi
2632
fi
2733
if [ -f ${STATEFILE} ] && [ `grep -c "FAILED_NOT_RESTARTABLE" ${STATEFILE}` -eq 1 ]; then
28-
echo "Error: WebLogic Server state is FAILED_NOT_RESTARTABLE."
34+
trace "Error: WebLogic Server state is FAILED_NOT_RESTARTABLE."
2935
exit $RETVAL
3036
fi
3137
exit 0

operator/src/main/resources/scripts/readState.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,32 @@
11
#!/bin/bash
22

3-
# Copyright 2017, 2018, Oracle Corporation and/or its affiliates. All rights reserved.
3+
# Copyright 2017, 2019, Oracle Corporation and/or its affiliates. All rights reserved.
44
# Licensed under the Universal Permissive License v 1.0 as shown at
55
# http://oss.oracle.com/licenses/upl.
66

77
# Reads the current state of a server. The script checks a WebLogic Server state
88
# file which is updated by the node manager.
99

10+
SCRIPTPATH="$( cd "$(dirname "$0")" > /dev/null 2>&1 ; pwd -P )"
11+
source ${SCRIPTPATH}/traceUtils.sh
12+
[ $? -ne 0 ] && echo "Error: missing file ${SCRIPTPATH}/traceUtils.sh" && exit 1
13+
14+
# check DOMAIN_HOME for a config/config.xml, reset DOMAIN_HOME if needed:
15+
exportEffectiveDomainHome || exit 1
16+
1017
DN=${DOMAIN_NAME?}
1118
SN=${SERVER_NAME?}
1219
DH=${DOMAIN_HOME?}
1320

1421
STATEFILE=/${DH}/servers/${SN}/data/nodemanager/${SN}.state
1522

1623
if [ `jps -l | grep -c " weblogic.NodeManager"` -eq 0 ]; then
17-
echo "Error: WebLogic NodeManager process not found."
24+
trace "Error: WebLogic NodeManager process not found."
1825
exit 1
1926
fi
2027

2128
if [ ! -f ${STATEFILE} ]; then
22-
echo "Error: WebLogic Server state file not found."
29+
trace "Error: WebLogic Server state file not found."
2330
exit 2
2431
fi
2532

operator/src/main/resources/scripts/startServer.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
# Copyright 2017, 2018, Oracle Corporation and/or its affiliates. All rights reserved.
3+
# Copyright 2017, 2019, Oracle Corporation and/or its affiliates. All rights reserved.
44
# Licensed under the Universal Permissive License v 1.0 as shown at
55
# http://oss.oracle.com/licenses/upl.
66

@@ -174,6 +174,11 @@ trace "SERVER_OUT_IN_POD_LOG=${SERVER_OUT_IN_POD_LOG}"
174174
trace "USER_MEM_ARGS=${USER_MEM_ARGS}"
175175
trace "JAVA_OPTIONS=${JAVA_OPTIONS}"
176176

177+
#
178+
# check DOMAIN_HOME for a config/config.xml, reset DOMAIN_HOME if needed:
179+
#
180+
exportEffectiveDomainHome || exitOrLoop
181+
177182
#
178183
# Check if introspector actually ran. This should never fail since
179184
# the operator shouldn't try run a wl pod if the introspector failed.

0 commit comments

Comments
 (0)