Skip to content

Commit 3442600

Browse files
committed
make the log-home-on-pv optional
1 parent ff07d32 commit 3442600

File tree

5 files changed

+31
-8
lines changed

5 files changed

+31
-8
lines changed

kubernetes/samples/scripts/common/domain-template.yaml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@ spec:
3030
name: %WEBLOGIC_CREDENTIALS_SECRET_NAME%
3131
# Whether to include the server out file into the pod's stdout, default is true
3232
includeServerOutInPodLog: %INCLUDE_SERVER_OUT_IN_POD_LOG%
33+
# Whether to enable log home
34+
%LOG_HOME_ON_PV_PREFIX%logHomeEnabled: %LOG_HOME_ENABLED%
3335
# The in-pod name of the directory to store the domain, node manager, server logs, and server .out
3436
# files in.
3537
# If not specified or empty, domain log file, server logs, server out, and node manager log files
3638
# will be stored in the default logHome location of /shared/logs/<domainUID>/.
37-
logHome: %LOG_HOME%
39+
%LOG_HOME_ON_PV_PREFIX%logHome: %LOG_HOME%
3840
# serverStartPolicy legal values are "NEVER", "IF_NEEDED", or "ADMIN_ONLY"
3941
# This determines which WebLogic Servers the Operator will start up when it discovers this Domain
4042
# - "NEVER" will not start any server in the domain
@@ -48,13 +50,13 @@ spec:
4850
value: "%JAVA_OPTIONS%"
4951
- name: USER_MEM_ARGS
5052
value: "-Xms64m -Xmx256m "
51-
volumes:
52-
- name: weblogic-domain-storage-volume
53-
persistentVolumeClaim:
54-
claimName: %DOMAIN_PVC_NAME%
55-
volumeMounts:
56-
- mountPath: %DOMAIN_ROOT_DIR%
57-
name: weblogic-domain-storage-volume
53+
%LOG_HOME_ON_PV_PREFIX%volumes:
54+
%LOG_HOME_ON_PV_PREFIX%- name: weblogic-domain-storage-volume
55+
%LOG_HOME_ON_PV_PREFIX% persistentVolumeClaim:
56+
%LOG_HOME_ON_PV_PREFIX% claimName: %DOMAIN_PVC_NAME%
57+
%LOG_HOME_ON_PV_PREFIX%volumeMounts:
58+
%LOG_HOME_ON_PV_PREFIX%- mountPath: %DOMAIN_ROOT_DIR%
59+
%LOG_HOME_ON_PV_PREFIX% name: weblogic-domain-storage-volume
5860
# adminServer is used to configure the desired behavior for starting the administration server.
5961
adminServer:
6062
# serverStartState legal values are "RUNNING" or "ADMIN"

kubernetes/samples/scripts/common/utility.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,17 @@ function generateDomainYaml {
265265
fail "The value of domainHomeInImage must be true or false: ${domainHomeInImage}"
266266
fi
267267

268+
if [ "${domainHomeInImage}" == "true" ]; then
269+
if [ "${logHomeOnPV}" == "true" ]; then
270+
logHomeOnPVPrefix="${enabledPrefix}"
271+
else
272+
logHomeOnPVPrefix="${disabledPrefix}"
273+
fi
274+
else
275+
logHomeOnPVPrefix="${enabledPrefix}"
276+
logHomeOnPV=true
277+
fi
278+
268279
echo Generating ${dcrOutput}
269280

270281
cp ${dcrInput} ${dcrOutput}
@@ -277,6 +288,8 @@ function generateDomainYaml {
277288
sed -i -e "s:%WEBLOGIC_IMAGE_PULL_SECRET_NAME%:${imagePullSecretName}:g" ${dcrOutput}
278289
sed -i -e "s:%WEBLOGIC_CREDENTIALS_SECRET_NAME%:${weblogicCredentialsSecretName}:g" ${dcrOutput}
279290
sed -i -e "s:%INCLUDE_SERVER_OUT_IN_POD_LOG%:${includeServerOutInPodLog}:g" ${dcrOutput}
291+
sed -i -e "s:%LOG_HOME_ON_PV_PREFIX%:${logHomeOnPVPrefix}:g" ${dcrOutput}
292+
sed -i -e "s:%LOG_HOME_ENABLED%:${logHomeOnPV}:g" ${dcrOutput}
280293
sed -i -e "s:%LOG_HOME%:${logHome}:g" ${dcrOutput}
281294
sed -i -e "s:%SERVER_START_POLICY%:${serverStartPolicy}:g" ${dcrOutput}
282295
sed -i -e "s:%JAVA_OPTIONS%:${javaOptions}:g" ${dcrOutput}

kubernetes/samples/scripts/create-weblogic-domain/domain-home-in-image/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ The following parameters can be provided in the inputs file.
9595
| `includeServerOutInPodLog` | Boolean indicating whether to include server .out to the pod's stdout. | `true` |
9696
| `initialManagedServerReplicas` | Number of Managed Servers to initially start for the domain. | `2` |
9797
| `javaOptions` | Java options for starting the Administration and Managed Servers. A Java option can have references to one or more of the following pre-defined variables to obtain WebLogic domain information: `$(DOMAIN_NAME)`, `$(DOMAIN_HOME)`, `$(ADMIN_NAME)`, `$(ADMIN_PORT)`, and `$(SERVER_NAME)`. | `-Dweblogic.StdoutDebugEnabled=false` |
98+
| `logHomeOnPV` | Specifies whether the log home is stored on the persistent volume. | `false` |
9899
| `logHome` | The in-pod name of the directory to store the domain, node manager, server logs, and server .out files in. If not specified, the value is derived from the `domainUID` as `/shared/logs/<domainUID>`. | `/shared/logs/domain1` |
99100
| `managedServerNameBase` | Base string used to generate Managed Server names. | `managed-server` |
100101
| `managedServerPort` | Port number for each Managed Server. | `8001` |

kubernetes/samples/scripts/create-weblogic-domain/domain-home-in-image/create-domain-inputs.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ weblogicCredentialsSecretName: domain1-weblogic-credentials
6464
# The default is true.
6565
includeServerOutInPodLog: true
6666

67+
# Specifies whether the log home is stored on the persistent volume.
68+
# The default is false.
69+
logHomeOnPV: false
70+
6771
# The in-pod name of the directory to store the domain, node manager, server logs, and server .out
6872
# files in.
6973
# If not specified, the value is derived from the domainUID as /shared/logs/<domainUID>

kubernetes/samples/scripts/create-weblogic-domain/domain-home-in-image/create-domain.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,9 @@ function initialize {
150150

151151
validateCommonInputs
152152

153+
validateBooleanInputParamsSpecified logHomeOnPV
154+
failIfValidationErrors
155+
153156
initOutputDir
154157

155158
if [ "${cloneIt}" = true ]; then

0 commit comments

Comments
 (0)