diff --git a/operator/src/main/resources/scripts/introspectDomain.py b/operator/src/main/resources/scripts/introspectDomain.py index 9c74f3245ec..8b96c3c7672 100644 --- a/operator/src/main/resources/scripts/introspectDomain.py +++ b/operator/src/main/resources/scripts/introspectDomain.py @@ -380,6 +380,10 @@ def generate(self): def getDynamicServersOrNone(self,cluster): try: ret = cluster.getDynamicServers() + # Dynamic Servers must be configured with a ServerTemplate + if ret is not None: + if ret.getServerTemplate() is None: + ret = None except: trace("Ignoring getDynamicServers() exception, this is expected.") ret = None diff --git a/src/integration-tests/introspector/README b/src/integration-tests/introspector/README index 7f0c85ca0cc..c650a263888 100755 --- a/src/integration-tests/introspector/README +++ b/src/integration-tests/introspector/README @@ -21,9 +21,21 @@ Usage: (2) Optionally specify values for input env vars (see introspectTest.sh for the list). (3) For a non Model In Image domain type. Run introspectTest.sh + For a Model In Image domain type. export DOMAIN_SOURCE_TYPE=FromModel Run introspectTest.sh + + To check for ISTIO + export ISTIO_ENABELD=true - this only test for Non Model in Image + + To check for introspection of configured clusters with WebLogic 14.1.1.0 image. + NOTE: Test for introspection of configured clusters only for Non Model in Image + and for verifying OWLS 85530. + + export WEBLOGIC_IMAGE_TAG=14.1.1.0 + introspectTest.sh + ------------------- Internal Test Flow: ------------------- @@ -85,3 +97,14 @@ Internal Test Flow: wl-pod.yamlt /operator/src/main/resources/scripts/startServer.sh /operator/src/main/resources/scripts/start-server.py + +() Various test verifications (WebLogic version, configuration overrides, etc) are executed. + +() For domain types other than Model in Image, a verification test for JIRA OWLS-85530 is executed: + + 1. a static configured cluster is created using WLST in online mode. + 2. a minor cleanup of the test environment is performed in preparation for a rerun of the + introspection job. The minor cleanup function leaves the existing + domain-home/pv/pvc/secret/etc, deletes wl pods, deletes the introspect job, then + redeploys the custom overrides. + 3. reruns the introspect job \ No newline at end of file diff --git a/src/integration-tests/introspector/createStaticCluster.py b/src/integration-tests/introspector/createStaticCluster.py new file mode 100644 index 00000000000..f7657498038 --- /dev/null +++ b/src/integration-tests/introspector/createStaticCluster.py @@ -0,0 +1,62 @@ +# Copyright (c) 2018, 2020, Oracle Corporation and/or its affiliates. +# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. + +# +# purpose: +# +# invoke on-line WLST to create a configured static cluster and two managed +# servers that reference it. +# +# NOTE: The static cluster must be configured using on-line WLST instead of +# off-line WLST in order to reproduce OWLS 85530. On-line WLST produces the +# following cluster configuration: +# +# +# c1 +# unicast +# +# 0 +# +# +# +# assumes the admin user/pass was encoded to a userConfig/userKey by the +# introspector these files have been mounted to /weblogic-operator/introspector +# +# usage: +# wlst.sh createStaticCluster.py +# +# sample usage: +# wlst.sh createStaticCluster.py t3://domain1-admin-server:7001 c1 +# + +import sys + +url = sys.argv[1] +cluster_name = sys.argv[2] + +connect(userConfigFile='/weblogic-operator/introspector/userConfigNodeManager.secure',userKeyFile='/tmp/userKeyNodeManager.secure.bin',url=url) + +edit() +startEdit() + +cl=cmo.createCluster(cluster_name) + +# Create managed servers +for index in range(0, 2): + cd('/') + + msIndex = index+1 + name = '%s%s' % ('ms', msIndex) + + create(name, 'Server') + cd('/Servers/%s/' % name ) + print('managed server name is %s' % name); + set('ListenPort', 8001) + set('ListenAddress', '') + set('Cluster', cl) + +save() +activate() + +print 'ok' +exit(exitcode=0) diff --git a/src/integration-tests/introspector/introspectTest.sh b/src/integration-tests/introspector/introspectTest.sh index ce947b675da..3f7fd6b8325 100755 --- a/src/integration-tests/introspector/introspectTest.sh +++ b/src/integration-tests/introspector/introspectTest.sh @@ -39,6 +39,13 @@ # To check for ISTIO # export ISTIO_ENABELD=true - this only test for Non Model in Image # +# To check for introspection of configured clusters with WebLogic 14.1.1.0 image. +# NOTE: Test for introspection of configured clusters only for Non Model in Image +# and for verifying OWLS 85530. +# +# export WEBLOGIC_IMAGE_TAG=14.1.1.0 +# introspectTest.sh +# ############################################################################# # # Initialize basic globals @@ -1017,6 +1024,45 @@ function checkNodeManagerJavaOptions() { fi } +############################################################################# +# +# Create static cluster using on-line WLST. +# NOTE: The static cluster must be configured using on-line WLST instead of +# off-line WLST in order to reproduce OWLS 85530. This creates a static +# cluster entry of the form: +# +# +# c1 +# +# 0 +# +# +# + +function createStaticCluster() { + + local cluster_name=${1?} + local pod_name=${2?} + local admin_url=${3?} + local script_file=createStaticCluster.py + local out_file=$test_home/createStaticCluster.out + + local script_cmd="wlst.sh /shared/${script_file} ${admin_url} ${cluster_name}" + + trace "Info: Creating static cluster '$cluster_name' via '$script_cmd' on pod '$pod_name'." + + kubectl -n ${NAMESPACE} cp ${SCRIPTPATH}/${script_file} ${pod_name}:/shared/${script_file} || exit 1 + + tracen "Info: Waiting for createStaticCluster script to complete" + printdots_start + kubectl exec -it -n ${NAMESPACE} ${pod_name} ${script_cmd} > ${out_file} 2>&1 + status=$? + printdots_end + if [ $status -ne 0 ]; then + trace "Error: The '$script_cmd' failed, see '$out_file'." + exit 1 + fi +} ############################################################################# # @@ -1102,4 +1148,15 @@ checkManagedServer1MemArg # Verify node manager java options checkNodeManagerJavaOptions +if [ ${DOMAIN_SOURCE_TYPE} != "FromModel" ] ; then + # Create static cluster using WLST on-line mode. + # NOTE: The static cluster must be configured using on-line WLST instead of + # off-line WLST in order to reproduce OWLS 85530. + createStaticCluster 'c1' ${DOMAIN_UID}-${ADMIN_NAME?} t3://${DOMAIN_UID}-${ADMIN_NAME}:${ADMIN_PORT} + + # Re-run introspector to introspect the static cluster + cleanupMinor + deployIntrospectJobPod +fi + trace "Info: Success!"