Skip to content

Commit 6230be4

Browse files
authored
Merge branch 'develop' into rmarano
2 parents 8d1ece1 + 8d6bdc1 commit 6230be4

File tree

15 files changed

+291
-3760
lines changed

15 files changed

+291
-3760
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: 11 additions & 9 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"

kubernetes/samples/scripts/common/utility.sh

Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,210 @@ 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+
if [ "${exposeAdminT3Channel}" = true ]; then
245+
exposeAdminT3ChannelPrefix="${enabledPrefix}"
246+
else
247+
exposeAdminT3ChannelPrefix="${disabledPrefix}"
248+
fi
249+
250+
if [ "${exposeAdminNodePort}" = true ]; then
251+
exposeAdminNodePortPrefix="${enabledPrefix}"
252+
else
253+
exposeAdminNodePortPrefix="${disabledPrefix}"
254+
fi
255+
256+
# For some parameters, use the default value if not defined.
257+
if [ -z "${domainPVMountPath}" ]; then
258+
domainPVMountPath="/shared"
259+
fi
260+
261+
if [ -z "${logHome}" ]; then
262+
logHome="${domainPVMountPath}/logs/${domainUID}"
263+
fi
264+
265+
if [ -z "${persistentVolumeClaimName}" ]; then
266+
persistentVolumeClaimName="${domainUID}-weblogic-sample-pvc"
267+
fi
268+
269+
if [ -z "${weblogicCredentialsSecretName}" ]; then
270+
weblogicCredentialsSecretName="${domainUID}-weblogic-credentials"
271+
fi
272+
273+
if [ "${domainHomeInImage}" == "true" ]; then
274+
domainPropertiesOutput="${domainOutputDir}/domain.properties"
275+
domainHome="/u01/oracle/user_projects/domains/${domainName}"
276+
277+
# Generate the properties file that will be used when creating the weblogic domain
278+
echo Generating ${domainPropertiesOutput}
279+
280+
cp ${domainPropertiesInput} ${domainPropertiesOutput}
281+
sed -i -e "s:%DOMAIN_NAME%:${domainName}:g" ${domainPropertiesOutput}
282+
sed -i -e "s:%ADMIN_PORT%:${adminPort}:g" ${domainPropertiesOutput}
283+
sed -i -e "s:%ADMIN_SERVER_NAME%:${adminServerName}:g" ${domainPropertiesOutput}
284+
sed -i -e "s:%MANAGED_SERVER_PORT%:${managedServerPort}:g" ${domainPropertiesOutput}
285+
sed -i -e "s:%MANAGED_SERVER_NAME_BASE%:${managedServerNameBase}:g" ${domainPropertiesOutput}
286+
sed -i -e "s:%CONFIGURED_MANAGED_SERVER_COUNT%:${configuredManagedServerCount}:g" ${domainPropertiesOutput}
287+
sed -i -e "s:%CLUSTER_NAME%:${clusterName}:g" ${domainPropertiesOutput}
288+
sed -i -e "s:%PRODUCTION_MODE_ENABLED%:${productionModeEnabled}:g" ${domainPropertiesOutput}
289+
sed -i -e "s:%CLUSTER_TYPE%:${clusterType}:g" ${domainPropertiesOutput}
290+
sed -i -e "s:%JAVA_OPTIONS%:${javaOptions}:g" ${domainPropertiesOutput}
291+
sed -i -e "s:%T3_CHANNEL_PORT%:${t3ChannelPort}:g" ${domainPropertiesOutput}
292+
sed -i -e "s:%T3_PUBLIC_ADDRESS%:${t3PublicAddress}:g" ${domainPropertiesOutput}
293+
294+
else
295+
296+
createJobOutput="${domainOutputDir}/create-domain-job.yaml"
297+
deleteJobOutput="${domainOutputDir}/delete-domain-job.yaml"
298+
299+
if [ -z "${domainHome}" ]; then
300+
domainHome="${domainPVMountPath}/domains/${domainUID}"
301+
fi
302+
303+
# Use the default value if not defined.
304+
if [ -z "${createDomainScriptsMountPath}" ]; then
305+
createDomainScriptsMountPath="/u01/weblogic"
306+
fi
307+
308+
if [ -z "${createDomainScriptName}" ]; then
309+
createDomainScriptName="create-domain-job.sh"
310+
fi
311+
312+
# Must escape the ':' value in image for sed to properly parse and replace
313+
image=$(echo ${image} | sed -e "s/\:/\\\:/g")
314+
315+
# Generate the yaml to create the kubernetes job that will create the weblogic domain
316+
echo Generating ${createJobOutput}
317+
318+
cp ${createJobInput} ${createJobOutput}
319+
sed -i -e "s:%NAMESPACE%:$namespace:g" ${createJobOutput}
320+
sed -i -e "s:%WEBLOGIC_CREDENTIALS_SECRET_NAME%:${weblogicCredentialsSecretName}:g" ${createJobOutput}
321+
sed -i -e "s:%WEBLOGIC_IMAGE%:${image}:g" ${createJobOutput}
322+
sed -i -e "s:%WEBLOGIC_IMAGE_PULL_POLICY%:${imagePullPolicy}:g" ${createJobOutput}
323+
sed -i -e "s:%WEBLOGIC_IMAGE_PULL_SECRET_NAME%:${imagePullSecretName}:g" ${createJobOutput}
324+
sed -i -e "s:%WEBLOGIC_IMAGE_PULL_SECRET_PREFIX%:${imagePullSecretPrefix}:g" ${createJobOutput}
325+
sed -i -e "s:%DOMAIN_UID%:${domainUID}:g" ${createJobOutput}
326+
sed -i -e "s:%DOMAIN_NAME%:${domainName}:g" ${createJobOutput}
327+
sed -i -e "s:%DOMAIN_HOME%:${domainHome}:g" ${createJobOutput}
328+
sed -i -e "s:%PRODUCTION_MODE_ENABLED%:${productionModeEnabled}:g" ${createJobOutput}
329+
sed -i -e "s:%ADMIN_SERVER_NAME%:${adminServerName}:g" ${createJobOutput}
330+
sed -i -e "s:%ADMIN_SERVER_NAME_SVC%:${adminServerNameSVC}:g" ${createJobOutput}
331+
sed -i -e "s:%ADMIN_PORT%:${adminPort}:g" ${createJobOutput}
332+
sed -i -e "s:%CONFIGURED_MANAGED_SERVER_COUNT%:${configuredManagedServerCount}:g" ${createJobOutput}
333+
sed -i -e "s:%MANAGED_SERVER_NAME_BASE%:${managedServerNameBase}:g" ${createJobOutput}
334+
sed -i -e "s:%MANAGED_SERVER_NAME_BASE_SVC%:${managedServerNameBaseSVC}:g" ${createJobOutput}
335+
sed -i -e "s:%MANAGED_SERVER_PORT%:${managedServerPort}:g" ${createJobOutput}
336+
sed -i -e "s:%T3_CHANNEL_PORT%:${t3ChannelPort}:g" ${createJobOutput}
337+
sed -i -e "s:%T3_PUBLIC_ADDRESS%:${t3PublicAddress}:g" ${createJobOutput}
338+
sed -i -e "s:%CLUSTER_NAME%:${clusterName}:g" ${createJobOutput}
339+
sed -i -e "s:%CLUSTER_TYPE%:${clusterType}:g" ${createJobOutput}
340+
sed -i -e "s:%DOMAIN_PVC_NAME%:${persistentVolumeClaimName}:g" ${createJobOutput}
341+
sed -i -e "s:%DOMAIN_ROOT_DIR%:${domainPVMountPath}:g" ${createJobOutput}
342+
sed -i -e "s:%CREATE_DOMAIN_SCRIPT_DIR%:${createDomainScriptsMountPath}:g" ${createJobOutput}
343+
sed -i -e "s:%CREATE_DOMAIN_SCRIPT%:${createDomainScriptName}:g" ${createJobOutput}
344+
345+
# Generate the yaml to create the kubernetes job that will delete the weblogic domain_home folder
346+
echo Generating ${deleteJobOutput}
347+
348+
cp ${deleteJobInput} ${deleteJobOutput}
349+
sed -i -e "s:%NAMESPACE%:$namespace:g" ${deleteJobOutput}
350+
sed -i -e "s:%WEBLOGIC_IMAGE%:${image}:g" ${deleteJobOutput}
351+
sed -i -e "s:%WEBLOGIC_IMAGE_PULL_POLICY%:${imagePullPolicy}:g" ${deleteJobOutput}
352+
sed -i -e "s:%WEBLOGIC_CREDENTIALS_SECRET_NAME%:${weblogicCredentialsSecretName}:g" ${deleteJobOutput}
353+
sed -i -e "s:%WEBLOGIC_IMAGE_PULL_SECRET_NAME%:${imagePullSecretName}:g" ${deleteJobOutput}
354+
sed -i -e "s:%WEBLOGIC_IMAGE_PULL_SECRET_PREFIX%:${imagePullSecretPrefix}:g" ${deleteJobOutput}
355+
sed -i -e "s:%DOMAIN_UID%:${domainUID}:g" ${deleteJobOutput}
356+
sed -i -e "s:%DOMAIN_NAME%:${domainName}:g" ${deleteJobOutput}
357+
sed -i -e "s:%DOMAIN_HOME%:${domainHome}:g" ${deleteJobOutput}
358+
sed -i -e "s:%DOMAIN_PVC_NAME%:${persistentVolumeClaimName}:g" ${deleteJobOutput}
359+
sed -i -e "s:%DOMAIN_ROOT_DIR%:${domainPVMountPath}:g" ${deleteJobOutput}
360+
fi
361+
362+
if [ "${domainHomeInImage}" == "true" ]; then
363+
if [ "${logHomeOnPV}" == "true" ]; then
364+
logHomeOnPVPrefix="${enabledPrefix}"
365+
else
366+
logHomeOnPVPrefix="${disabledPrefix}"
367+
fi
368+
else
369+
logHomeOnPVPrefix="${enabledPrefix}"
370+
logHomeOnPV=true
371+
fi
372+
373+
# Generate the yaml file for creating the domain resource
374+
echo Generating ${dcrOutput}
375+
376+
cp ${dcrInput} ${dcrOutput}
377+
sed -i -e "s:%DOMAIN_UID%:${domainUID}:g" ${dcrOutput}
378+
sed -i -e "s:%NAMESPACE%:$namespace:g" ${dcrOutput}
379+
sed -i -e "s:%DOMAIN_HOME%:${domainHome}:g" ${dcrOutput}
380+
sed -i -e "s:%DOMAIN_HOME_IN_IMAGE%:${domainHomeInImage}:g" ${dcrOutput}
381+
sed -i -e "s:%WEBLOGIC_IMAGE_PULL_POLICY%:${imagePullPolicy}:g" ${dcrOutput}
382+
sed -i -e "s:%WEBLOGIC_IMAGE_PULL_SECRET_PREFIX%:${imagePullSecretPrefix}:g" ${dcrOutput}
383+
sed -i -e "s:%WEBLOGIC_IMAGE_PULL_SECRET_NAME%:${imagePullSecretName}:g" ${dcrOutput}
384+
sed -i -e "s:%WEBLOGIC_CREDENTIALS_SECRET_NAME%:${weblogicCredentialsSecretName}:g" ${dcrOutput}
385+
sed -i -e "s:%INCLUDE_SERVER_OUT_IN_POD_LOG%:${includeServerOutInPodLog}:g" ${dcrOutput}
386+
sed -i -e "s:%LOG_HOME_ON_PV_PREFIX%:${logHomeOnPVPrefix}:g" ${dcrOutput}
387+
sed -i -e "s:%LOG_HOME_ENABLED%:${logHomeOnPV}:g" ${dcrOutput}
388+
sed -i -e "s:%LOG_HOME%:${logHome}:g" ${dcrOutput}
389+
sed -i -e "s:%SERVER_START_POLICY%:${serverStartPolicy}:g" ${dcrOutput}
390+
sed -i -e "s:%JAVA_OPTIONS%:${javaOptions}:g" ${dcrOutput}
391+
sed -i -e "s:%DOMAIN_PVC_NAME%:${persistentVolumeClaimName}:g" ${dcrOutput}
392+
sed -i -e "s:%DOMAIN_ROOT_DIR%:${domainPVMountPath}:g" ${dcrOutput}
393+
sed -i -e "s:%EXPOSE_ADMIN_PORT_PREFIX%:${exposeAdminNodePortPrefix}:g" ${dcrOutput}
394+
sed -i -e "s:%ADMIN_NODE_PORT%:${adminNodePort}:g" ${dcrOutput}
395+
sed -i -e "s:%EXPOSE_T3_CHANNEL_PREFIX%:${exposeAdminT3ChannelPrefix}:g" ${dcrOutput}
396+
sed -i -e "s:%CLUSTER_NAME%:${clusterName}:g" ${dcrOutput}
397+
sed -i -e "s:%INITIAL_MANAGED_SERVER_REPLICAS%:${initialManagedServerReplicas}:g" ${dcrOutput}
398+
399+
if [ "${domainHomeInImage}" == "true" ]; then
400+
if [ -z $domainHomeImageBuildPath ]; then
401+
domainHomeImageBuildPath="./docker-images/OracleWebLogic/samples/12213-domain-home-in-image-wdt"
402+
fi
403+
imageName="`basename ${domainHomeImageBuildPath} | sed 's/^[0-9]*-//'`"
404+
405+
# now we know which image to use, update the domain yaml file
406+
if [ -z $image ]; then
407+
sed -i -e "s|%WEBLOGIC_IMAGE%|${imageName}|g" ${dcrOutput}
408+
else
409+
sed -i -e "s:%WEBLOGIC_IMAGE%:${image}:g" ${dcrOutput}
410+
fi
411+
else
412+
sed -i -e "s:%WEBLOGIC_IMAGE%:${image}:g" ${dcrOutput}
413+
fi
414+
415+
# Remove any "...yaml-e" files left over from running sed
416+
rm -f ${domainOutputDir}/*.yaml-e
417+
}
418+
215419
#
216420
# Function to create the domain recource
217421
#
@@ -231,8 +435,19 @@ function createDomainResource {
231435

232436
#
233437
# Function to create a domain
438+
# $1 - boolean value indicating the location of the domain home
439+
# true means domain home in image
440+
# false means domain home on PV
234441
#
235442
function createDomain {
443+
if [ "$#" != 1 ]; then
444+
fail "The function must be called with domainHomeInImage parameter."
445+
fi
446+
447+
domainHomeInImage="${1}"
448+
if [ "true" != "${domainHomeInImage}" ] && [ "false" != "${domainHomeInImage}" ]; then
449+
fail "The value of domainHomeInImage must be true or false: ${domainHomeInImage}"
450+
fi
236451

237452
# Setup the environment for running this script and perform initial validation checks
238453
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)