Skip to content

Commit 8c6b9c5

Browse files
committed
Merge remote-tracking branch 'origin/develop' into final-2.0-schema
2 parents f024c72 + 2d7d721 commit 8c6b9c5

File tree

20 files changed

+450
-3870
lines changed

20 files changed

+450
-3870
lines changed

integration-tests/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Quick test use cases.
2424
4. verify admin t3 channel port by exec into the admin pod and deploying webapp using the channel port for WLST
2525
5. verify web app load balancing by accessing the webapp using loadBalancerWebPort
2626
6. verify domain life cycle(destroy and create) should not any impact on Operator managing the domain and web app load balancing and admin external service
27-
7. cluster scale up/down using Operator REST endpoint, webapp load balancing should adjust accordingly. (run.sh does scaling by editing the replicas in domain-custom-resource.yaml.)
27+
7. cluster scale up/down using Operator REST endpoint, webapp load balancing should adjust accordingly.
2828
8. Operator life cycle(destroy and create) should not impact the running domain
2929
9. verify liveness probe by killing managed server 1 process 3 times to kick pod auto-restart
3030
10. shutdown the domain by changing domain serverStartPolicy to NEVER

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

Lines changed: 1 addition & 2 deletions
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

@@ -27,7 +27,6 @@ function state_dump {
2727

2828
mkdir -p ${DUMP_DIR}
2929

30-
# Test output is captured to ${TESTOUT} when run.sh is run stand-alone
3130
# if [ -f ${TESTOUT:-NoSuchFile.out} ]; then
3231
# echo Copying ${TESTOUT} to ${DUMP_DIR}/test_suite.out
3332
# cp ${TESTOUT} ${DUMP_DIR}/test_suite.out
Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ spec:
1616
# The WebLogic Domain Home
1717
domainHome: %DOMAIN_HOME%
1818
# If the domain home is in the image
19-
domainHomeInImage: false
19+
domainHomeInImage: %DOMAIN_HOME_IN_IMAGE%
2020
# The Operator currently does not support other images
2121
image: "%WEBLOGIC_IMAGE%"
2222
# imagePullPolicy defaults to "Always" if image version is :latest
@@ -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"
@@ -63,11 +65,11 @@ spec:
6365
serverStartState: "RUNNING"
6466
%EXPOSE_ANY_CHANNEL_PREFIX%adminService:
6567
%EXPOSE_ANY_CHANNEL_PREFIX% channels:
66-
# The Admin Server's NodePort
67-
%EXPOSE_ADMIN_PORT_PREFIX%- channelName: default
68-
%EXPOSE_ADMIN_PORT_PREFIX% nodePort: %ADMIN_NODE_PORT%
69-
# Uncomment to export the T3Channel as a service
70-
%EXPOSE_T3_CHANNEL_PREFIX%- channelName: T3Channel
68+
# The Admin Server's NodePort
69+
%EXPOSE_ADMIN_PORT_PREFIX% - channelName: default
70+
%EXPOSE_ADMIN_PORT_PREFIX% nodePort: %ADMIN_NODE_PORT%
71+
# Uncomment to export the T3Channel as a service
72+
%EXPOSE_T3_CHANNEL_PREFIX% - channelName: T3Channel
7173
# clusters is used to configure the desired behavior for starting member servers of a cluster.
7274
# If you use this entry, then the rules will be applied to ALL servers that are members of the named clusters.
7375
clusters:

kubernetes/samples/scripts/common/utility.sh

Lines changed: 219 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,214 @@ function getKubernetesClusterIP {
212212
K8S_IP="${array[1]}"
213213
}
214214

215+
#
216+
# Function to generate the properties and yaml files for creating a domain
217+
#
218+
function createFiles {
219+
220+
# Make sure the output directory has a copy of the inputs file.
221+
# The user can either pre-create the output directory, put the inputs
222+
# file there, and create the domain from it, or the user can put the
223+
# inputs file some place else and let this script create the output directory
224+
# (if needed) and copy the inputs file there.
225+
copyInputsFileToOutputDirectory ${valuesInputFile} "${domainOutputDir}/create-domain-inputs.yaml"
226+
227+
if [ "${domainHomeInImage}" == "true" ]; then
228+
if [ -z "${domainHomeImageBase}" ]; then
229+
fail "Please specify domainHomeImageBase in your input YAML"
230+
fi
231+
else
232+
if [ -z "${image}" ]; then
233+
fail "Please specify image in your input YAML"
234+
fi
235+
fi
236+
237+
dcrOutput="${domainOutputDir}/domain.yaml"
238+
239+
domainName=${domainUID}
240+
241+
enabledPrefix="" # uncomment the feature
242+
disabledPrefix="# " # comment out the feature
243+
244+
exposeAnyChannelPrefix="${disabledPrefix}"
245+
if [ "${exposeAdminT3Channel}" = true ]; then
246+
exposeAdminT3ChannelPrefix="${enabledPrefix}"
247+
exposeAnyChannelPrefix="${enabledPrefix}"
248+
else
249+
exposeAdminT3ChannelPrefix="${disabledPrefix}"
250+
fi
251+
252+
if [ "${exposeAdminNodePort}" = true ]; then
253+
exposeAdminNodePortPrefix="${enabledPrefix}"
254+
exposeAnyChannelPrefix="${enabledPrefix}"
255+
else
256+
exposeAdminNodePortPrefix="${disabledPrefix}"
257+
fi
258+
259+
# For some parameters, use the default value if not defined.
260+
if [ -z "${domainPVMountPath}" ]; then
261+
domainPVMountPath="/shared"
262+
fi
263+
264+
if [ -z "${logHome}" ]; then
265+
logHome="${domainPVMountPath}/logs/${domainUID}"
266+
fi
267+
268+
if [ -z "${persistentVolumeClaimName}" ]; then
269+
persistentVolumeClaimName="${domainUID}-weblogic-sample-pvc"
270+
fi
271+
272+
if [ -z "${weblogicCredentialsSecretName}" ]; then
273+
weblogicCredentialsSecretName="${domainUID}-weblogic-credentials"
274+
fi
275+
276+
if [ "${domainHomeInImage}" == "true" ]; then
277+
domainPropertiesOutput="${domainOutputDir}/domain.properties"
278+
domainHome="/u01/oracle/user_projects/domains/${domainName}"
279+
280+
# Generate the properties file that will be used when creating the weblogic domain
281+
echo Generating ${domainPropertiesOutput}
282+
283+
cp ${domainPropertiesInput} ${domainPropertiesOutput}
284+
sed -i -e "s:%DOMAIN_NAME%:${domainName}:g" ${domainPropertiesOutput}
285+
sed -i -e "s:%ADMIN_PORT%:${adminPort}:g" ${domainPropertiesOutput}
286+
sed -i -e "s:%ADMIN_SERVER_NAME%:${adminServerName}:g" ${domainPropertiesOutput}
287+
sed -i -e "s:%MANAGED_SERVER_PORT%:${managedServerPort}:g" ${domainPropertiesOutput}
288+
sed -i -e "s:%MANAGED_SERVER_NAME_BASE%:${managedServerNameBase}:g" ${domainPropertiesOutput}
289+
sed -i -e "s:%CONFIGURED_MANAGED_SERVER_COUNT%:${configuredManagedServerCount}:g" ${domainPropertiesOutput}
290+
sed -i -e "s:%CLUSTER_NAME%:${clusterName}:g" ${domainPropertiesOutput}
291+
sed -i -e "s:%PRODUCTION_MODE_ENABLED%:${productionModeEnabled}:g" ${domainPropertiesOutput}
292+
sed -i -e "s:%CLUSTER_TYPE%:${clusterType}:g" ${domainPropertiesOutput}
293+
sed -i -e "s:%JAVA_OPTIONS%:${javaOptions}:g" ${domainPropertiesOutput}
294+
sed -i -e "s:%T3_CHANNEL_PORT%:${t3ChannelPort}:g" ${domainPropertiesOutput}
295+
sed -i -e "s:%T3_PUBLIC_ADDRESS%:${t3PublicAddress}:g" ${domainPropertiesOutput}
296+
297+
else
298+
299+
createJobOutput="${domainOutputDir}/create-domain-job.yaml"
300+
deleteJobOutput="${domainOutputDir}/delete-domain-job.yaml"
301+
302+
if [ -z "${domainHome}" ]; then
303+
domainHome="${domainPVMountPath}/domains/${domainUID}"
304+
fi
305+
306+
# Use the default value if not defined.
307+
if [ -z "${createDomainScriptsMountPath}" ]; then
308+
createDomainScriptsMountPath="/u01/weblogic"
309+
fi
310+
311+
if [ -z "${createDomainScriptName}" ]; then
312+
createDomainScriptName="create-domain-job.sh"
313+
fi
314+
315+
# Must escape the ':' value in image for sed to properly parse and replace
316+
image=$(echo ${image} | sed -e "s/\:/\\\:/g")
317+
318+
# Generate the yaml to create the kubernetes job that will create the weblogic domain
319+
echo Generating ${createJobOutput}
320+
321+
cp ${createJobInput} ${createJobOutput}
322+
sed -i -e "s:%NAMESPACE%:$namespace:g" ${createJobOutput}
323+
sed -i -e "s:%WEBLOGIC_CREDENTIALS_SECRET_NAME%:${weblogicCredentialsSecretName}:g" ${createJobOutput}
324+
sed -i -e "s:%WEBLOGIC_IMAGE%:${image}:g" ${createJobOutput}
325+
sed -i -e "s:%WEBLOGIC_IMAGE_PULL_POLICY%:${imagePullPolicy}:g" ${createJobOutput}
326+
sed -i -e "s:%WEBLOGIC_IMAGE_PULL_SECRET_NAME%:${imagePullSecretName}:g" ${createJobOutput}
327+
sed -i -e "s:%WEBLOGIC_IMAGE_PULL_SECRET_PREFIX%:${imagePullSecretPrefix}:g" ${createJobOutput}
328+
sed -i -e "s:%DOMAIN_UID%:${domainUID}:g" ${createJobOutput}
329+
sed -i -e "s:%DOMAIN_NAME%:${domainName}:g" ${createJobOutput}
330+
sed -i -e "s:%DOMAIN_HOME%:${domainHome}:g" ${createJobOutput}
331+
sed -i -e "s:%PRODUCTION_MODE_ENABLED%:${productionModeEnabled}:g" ${createJobOutput}
332+
sed -i -e "s:%ADMIN_SERVER_NAME%:${adminServerName}:g" ${createJobOutput}
333+
sed -i -e "s:%ADMIN_SERVER_NAME_SVC%:${adminServerNameSVC}:g" ${createJobOutput}
334+
sed -i -e "s:%ADMIN_PORT%:${adminPort}:g" ${createJobOutput}
335+
sed -i -e "s:%CONFIGURED_MANAGED_SERVER_COUNT%:${configuredManagedServerCount}:g" ${createJobOutput}
336+
sed -i -e "s:%MANAGED_SERVER_NAME_BASE%:${managedServerNameBase}:g" ${createJobOutput}
337+
sed -i -e "s:%MANAGED_SERVER_NAME_BASE_SVC%:${managedServerNameBaseSVC}:g" ${createJobOutput}
338+
sed -i -e "s:%MANAGED_SERVER_PORT%:${managedServerPort}:g" ${createJobOutput}
339+
sed -i -e "s:%T3_CHANNEL_PORT%:${t3ChannelPort}:g" ${createJobOutput}
340+
sed -i -e "s:%T3_PUBLIC_ADDRESS%:${t3PublicAddress}:g" ${createJobOutput}
341+
sed -i -e "s:%CLUSTER_NAME%:${clusterName}:g" ${createJobOutput}
342+
sed -i -e "s:%CLUSTER_TYPE%:${clusterType}:g" ${createJobOutput}
343+
sed -i -e "s:%DOMAIN_PVC_NAME%:${persistentVolumeClaimName}:g" ${createJobOutput}
344+
sed -i -e "s:%DOMAIN_ROOT_DIR%:${domainPVMountPath}:g" ${createJobOutput}
345+
sed -i -e "s:%CREATE_DOMAIN_SCRIPT_DIR%:${createDomainScriptsMountPath}:g" ${createJobOutput}
346+
sed -i -e "s:%CREATE_DOMAIN_SCRIPT%:${createDomainScriptName}:g" ${createJobOutput}
347+
348+
# Generate the yaml to create the kubernetes job that will delete the weblogic domain_home folder
349+
echo Generating ${deleteJobOutput}
350+
351+
cp ${deleteJobInput} ${deleteJobOutput}
352+
sed -i -e "s:%NAMESPACE%:$namespace:g" ${deleteJobOutput}
353+
sed -i -e "s:%WEBLOGIC_IMAGE%:${image}:g" ${deleteJobOutput}
354+
sed -i -e "s:%WEBLOGIC_IMAGE_PULL_POLICY%:${imagePullPolicy}:g" ${deleteJobOutput}
355+
sed -i -e "s:%WEBLOGIC_CREDENTIALS_SECRET_NAME%:${weblogicCredentialsSecretName}:g" ${deleteJobOutput}
356+
sed -i -e "s:%WEBLOGIC_IMAGE_PULL_SECRET_NAME%:${imagePullSecretName}:g" ${deleteJobOutput}
357+
sed -i -e "s:%WEBLOGIC_IMAGE_PULL_SECRET_PREFIX%:${imagePullSecretPrefix}:g" ${deleteJobOutput}
358+
sed -i -e "s:%DOMAIN_UID%:${domainUID}:g" ${deleteJobOutput}
359+
sed -i -e "s:%DOMAIN_NAME%:${domainName}:g" ${deleteJobOutput}
360+
sed -i -e "s:%DOMAIN_HOME%:${domainHome}:g" ${deleteJobOutput}
361+
sed -i -e "s:%DOMAIN_PVC_NAME%:${persistentVolumeClaimName}:g" ${deleteJobOutput}
362+
sed -i -e "s:%DOMAIN_ROOT_DIR%:${domainPVMountPath}:g" ${deleteJobOutput}
363+
fi
364+
365+
if [ "${domainHomeInImage}" == "true" ]; then
366+
if [ "${logHomeOnPV}" == "true" ]; then
367+
logHomeOnPVPrefix="${enabledPrefix}"
368+
else
369+
logHomeOnPVPrefix="${disabledPrefix}"
370+
fi
371+
else
372+
logHomeOnPVPrefix="${enabledPrefix}"
373+
logHomeOnPV=true
374+
fi
375+
376+
# Generate the yaml file for creating the domain resource
377+
echo Generating ${dcrOutput}
378+
379+
cp ${dcrInput} ${dcrOutput}
380+
sed -i -e "s:%DOMAIN_UID%:${domainUID}:g" ${dcrOutput}
381+
sed -i -e "s:%NAMESPACE%:$namespace:g" ${dcrOutput}
382+
sed -i -e "s:%DOMAIN_HOME%:${domainHome}:g" ${dcrOutput}
383+
sed -i -e "s:%DOMAIN_HOME_IN_IMAGE%:${domainHomeInImage}:g" ${dcrOutput}
384+
sed -i -e "s:%WEBLOGIC_IMAGE_PULL_POLICY%:${imagePullPolicy}:g" ${dcrOutput}
385+
sed -i -e "s:%WEBLOGIC_IMAGE_PULL_SECRET_PREFIX%:${imagePullSecretPrefix}:g" ${dcrOutput}
386+
sed -i -e "s:%WEBLOGIC_IMAGE_PULL_SECRET_NAME%:${imagePullSecretName}:g" ${dcrOutput}
387+
sed -i -e "s:%WEBLOGIC_CREDENTIALS_SECRET_NAME%:${weblogicCredentialsSecretName}:g" ${dcrOutput}
388+
sed -i -e "s:%INCLUDE_SERVER_OUT_IN_POD_LOG%:${includeServerOutInPodLog}:g" ${dcrOutput}
389+
sed -i -e "s:%LOG_HOME_ON_PV_PREFIX%:${logHomeOnPVPrefix}:g" ${dcrOutput}
390+
sed -i -e "s:%LOG_HOME_ENABLED%:${logHomeOnPV}:g" ${dcrOutput}
391+
sed -i -e "s:%LOG_HOME%:${logHome}:g" ${dcrOutput}
392+
sed -i -e "s:%SERVER_START_POLICY%:${serverStartPolicy}:g" ${dcrOutput}
393+
sed -i -e "s:%JAVA_OPTIONS%:${javaOptions}:g" ${dcrOutput}
394+
sed -i -e "s:%DOMAIN_PVC_NAME%:${persistentVolumeClaimName}:g" ${dcrOutput}
395+
sed -i -e "s:%DOMAIN_ROOT_DIR%:${domainPVMountPath}:g" ${dcrOutput}
396+
sed -i -e "s:%EXPOSE_ANY_CHANNEL_PREFIX%:${exposeAnyChannelPrefix}:g" ${dcrOutput}
397+
sed -i -e "s:%EXPOSE_ADMIN_PORT_PREFIX%:${exposeAdminNodePortPrefix}:g" ${dcrOutput}
398+
sed -i -e "s:%ADMIN_NODE_PORT%:${adminNodePort}:g" ${dcrOutput}
399+
sed -i -e "s:%EXPOSE_T3_CHANNEL_PREFIX%:${exposeAdminT3ChannelPrefix}:g" ${dcrOutput}
400+
sed -i -e "s:%CLUSTER_NAME%:${clusterName}:g" ${dcrOutput}
401+
sed -i -e "s:%INITIAL_MANAGED_SERVER_REPLICAS%:${initialManagedServerReplicas}:g" ${dcrOutput}
402+
403+
if [ "${domainHomeInImage}" == "true" ]; then
404+
if [ -z $domainHomeImageBuildPath ]; then
405+
domainHomeImageBuildPath="./docker-images/OracleWebLogic/samples/12213-domain-home-in-image-wdt"
406+
fi
407+
imageName="`basename ${domainHomeImageBuildPath} | sed 's/^[0-9]*-//'`"
408+
409+
# now we know which image to use, update the domain yaml file
410+
if [ -z $image ]; then
411+
sed -i -e "s|%WEBLOGIC_IMAGE%|${imageName}|g" ${dcrOutput}
412+
else
413+
sed -i -e "s:%WEBLOGIC_IMAGE%:${image}:g" ${dcrOutput}
414+
fi
415+
else
416+
sed -i -e "s:%WEBLOGIC_IMAGE%:${image}:g" ${dcrOutput}
417+
fi
418+
419+
# Remove any "...yaml-e" files left over from running sed
420+
rm -f ${domainOutputDir}/*.yaml-e
421+
}
422+
215423
#
216424
# Function to create the domain recource
217425
#
@@ -231,8 +439,19 @@ function createDomainResource {
231439

232440
#
233441
# Function to create a domain
442+
# $1 - boolean value indicating the location of the domain home
443+
# true means domain home in image
444+
# false means domain home on PV
234445
#
235446
function createDomain {
447+
if [ "$#" != 1 ]; then
448+
fail "The function must be called with domainHomeInImage parameter."
449+
fi
450+
451+
domainHomeInImage="${1}"
452+
if [ "true" != "${domainHomeInImage}" ] && [ "false" != "${domainHomeInImage}" ]; then
453+
fail "The value of domainHomeInImage must be true or false: ${domainHomeInImage}"
454+
fi
236455

237456
# Setup the environment for running this script and perform initial validation checks
238457
initialize

kubernetes/samples/scripts/common/validate.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,3 +395,15 @@ function validateCommonInputs {
395395
failIfValidationErrors
396396
}
397397

398+
#
399+
# Function to validate the domain's persistent volume claim has been created
400+
#
401+
function validateDomainPVC {
402+
# Check if the persistent volume claim is already available
403+
checkPvcExists ${persistentVolumeClaimName} ${namespace}
404+
if [ "${PVC_EXISTS}" = "false" ]; then
405+
validationError "The domain persistent volume claim ${persistentVolumeClaimName} does not exist in namespace ${namespace}"
406+
fi
407+
failIfValidationErrors
408+
}
409+

0 commit comments

Comments
 (0)