From 09b82d89b4eb5271ffd585733db2cebf8f846153 Mon Sep 17 00:00:00 2001 From: Lenny Phan Date: Mon, 26 Oct 2020 17:38:53 +0000 Subject: [PATCH 1/6] getDynamicServersOrNone doesn't throw exception with 14.1.1.0 --- operator/src/main/resources/scripts/introspectDomain.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/operator/src/main/resources/scripts/introspectDomain.py b/operator/src/main/resources/scripts/introspectDomain.py index 9c74f3245ec..ac2357c341f 100644 --- a/operator/src/main/resources/scripts/introspectDomain.py +++ b/operator/src/main/resources/scripts/introspectDomain.py @@ -380,6 +380,8 @@ def generate(self): def getDynamicServersOrNone(self,cluster): try: ret = cluster.getDynamicServers() + if ret.getDynamicClusterSize() == 0: + ret = None except: trace("Ignoring getDynamicServers() exception, this is expected.") ret = None From 2fbcd68c070b8e771719fc9a72c7ae0437cafb90 Mon Sep 17 00:00:00 2001 From: Lenny Phan Date: Tue, 27 Oct 2020 02:47:30 +0000 Subject: [PATCH 2/6] check for ServerTemplate for Dynamic Servers --- operator/src/main/resources/scripts/introspectDomain.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/operator/src/main/resources/scripts/introspectDomain.py b/operator/src/main/resources/scripts/introspectDomain.py index ac2357c341f..46ab871ca40 100644 --- a/operator/src/main/resources/scripts/introspectDomain.py +++ b/operator/src/main/resources/scripts/introspectDomain.py @@ -380,7 +380,8 @@ def generate(self): def getDynamicServersOrNone(self,cluster): try: ret = cluster.getDynamicServers() - if ret.getDynamicClusterSize() == 0: + # Dynamic Servers must be configured with a ServerTemplate + if ret.getServerTemplate() is None: ret = None except: trace("Ignoring getDynamicServers() exception, this is expected.") From 2776b272f4a87a7aa37177c120474f9f49162fe1 Mon Sep 17 00:00:00 2001 From: Lenny Phan Date: Tue, 27 Oct 2020 14:24:33 +0000 Subject: [PATCH 3/6] Check if DynamicServers mbean exist --- operator/src/main/resources/scripts/introspectDomain.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/operator/src/main/resources/scripts/introspectDomain.py b/operator/src/main/resources/scripts/introspectDomain.py index 46ab871ca40..8b96c3c7672 100644 --- a/operator/src/main/resources/scripts/introspectDomain.py +++ b/operator/src/main/resources/scripts/introspectDomain.py @@ -381,8 +381,9 @@ def getDynamicServersOrNone(self,cluster): try: ret = cluster.getDynamicServers() # Dynamic Servers must be configured with a ServerTemplate - if ret.getServerTemplate() is None: - ret = None + if ret is not None: + if ret.getServerTemplate() is None: + ret = None except: trace("Ignoring getDynamicServers() exception, this is expected.") ret = None From d4e541af068cbdfca34dd305d8b156fdf44813bc Mon Sep 17 00:00:00 2001 From: Lenny Phan Date: Wed, 28 Oct 2020 16:37:43 +0000 Subject: [PATCH 4/6] Add test to introspect configured cluster created by online WLST --- .../introspector/createStaticCluster.py | 50 +++++++++++++++++++ .../introspector/introspectTest.sh | 46 +++++++++++++++++ 2 files changed, 96 insertions(+) create mode 100644 src/integration-tests/introspector/createStaticCluster.py diff --git a/src/integration-tests/introspector/createStaticCluster.py b/src/integration-tests/introspector/createStaticCluster.py new file mode 100644 index 00000000000..8cd0d2eddf4 --- /dev/null +++ b/src/integration-tests/introspector/createStaticCluster.py @@ -0,0 +1,50 @@ +# 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. +# +# 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..e74e3f394ce 100755 --- a/src/integration-tests/introspector/introspectTest.sh +++ b/src/integration-tests/introspector/introspectTest.sh @@ -1017,6 +1017,43 @@ function checkNodeManagerJavaOptions() { fi } +############################################################################# +# +# Create static cluster using on-line WLST. 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 +1139,13 @@ checkManagedServer1MemArg # Verify node manager java options checkNodeManagerJavaOptions +if [ ${DOMAIN_SOURCE_TYPE} != "FromModel" ] ; then + # Create static cluster using WLST on-line mode + 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!" From ca403ad56ec194a3d5f3a1b8bf2042b12d297af1 Mon Sep 17 00:00:00 2001 From: Lenny Phan Date: Wed, 28 Oct 2020 16:55:51 +0000 Subject: [PATCH 5/6] Document configured cluster introspection test --- src/integration-tests/introspector/introspectTest.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/integration-tests/introspector/introspectTest.sh b/src/integration-tests/introspector/introspectTest.sh index e74e3f394ce..a49fff443c3 100755 --- a/src/integration-tests/introspector/introspectTest.sh +++ b/src/integration-tests/introspector/introspectTest.sh @@ -39,6 +39,12 @@ # 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. +# +# export WEBLOGIC_IMAGE_TAG=14.1.1.0 +# introspectTest.sh +# ############################################################################# # # Initialize basic globals From 0af280f3625176cfc03a21869ec6ecec594317c6 Mon Sep 17 00:00:00 2001 From: Lenny Phan Date: Wed, 28 Oct 2020 21:19:38 +0000 Subject: [PATCH 6/6] documentation updates to README and referencing JIRA OWLS-85530 --- src/integration-tests/introspector/README | 23 +++++++++++++++++++ .../introspector/createStaticCluster.py | 12 ++++++++++ .../introspector/introspectTest.sh | 13 +++++++---- 3 files changed, 44 insertions(+), 4 deletions(-) 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 index 8cd0d2eddf4..f7657498038 100644 --- a/src/integration-tests/introspector/createStaticCluster.py +++ b/src/integration-tests/introspector/createStaticCluster.py @@ -7,6 +7,18 @@ # 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 # diff --git a/src/integration-tests/introspector/introspectTest.sh b/src/integration-tests/introspector/introspectTest.sh index a49fff443c3..3f7fd6b8325 100755 --- a/src/integration-tests/introspector/introspectTest.sh +++ b/src/integration-tests/introspector/introspectTest.sh @@ -40,7 +40,8 @@ # 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. +# 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 @@ -1025,8 +1026,10 @@ function checkNodeManagerJavaOptions() { ############################################################################# # -# Create static cluster using on-line WLST. This creates a static cluster entry -# of the form: +# 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 @@ -1146,7 +1149,9 @@ checkManagedServer1MemArg checkNodeManagerJavaOptions if [ ${DOMAIN_SOURCE_TYPE} != "FromModel" ] ; then - # Create static cluster using WLST on-line mode + # 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