Skip to content

Commit 184acaa

Browse files
authored
OWLS 85530: OPERATOR INTROSPECTOR THROWS VALIDATION ERRORS FOR STATIC CLUSTER (#2014)
* getDynamicServersOrNone doesn't throw exception with 14.1.1.0 * check for ServerTemplate for Dynamic Servers * Check if DynamicServers mbean exist * Add test to introspect configured cluster created by online WLST * Document configured cluster introspection test * documentation updates to README and referencing JIRA OWLS-85530
1 parent f940ac6 commit 184acaa

File tree

4 files changed

+146
-0
lines changed

4 files changed

+146
-0
lines changed

operator/src/main/resources/scripts/introspectDomain.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,10 @@ def generate(self):
380380
def getDynamicServersOrNone(self,cluster):
381381
try:
382382
ret = cluster.getDynamicServers()
383+
# Dynamic Servers must be configured with a ServerTemplate
384+
if ret is not None:
385+
if ret.getServerTemplate() is None:
386+
ret = None
383387
except:
384388
trace("Ignoring getDynamicServers() exception, this is expected.")
385389
ret = None

src/integration-tests/introspector/README

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,21 @@ Usage:
2121
(2) Optionally specify values for input env vars (see introspectTest.sh for the list).
2222
(3) For a non Model In Image domain type.
2323
Run introspectTest.sh
24+
2425
For a Model In Image domain type.
2526
export DOMAIN_SOURCE_TYPE=FromModel
2627
Run introspectTest.sh
28+
29+
To check for ISTIO
30+
export ISTIO_ENABELD=true - this only test for Non Model in Image
31+
32+
To check for introspection of configured clusters with WebLogic 14.1.1.0 image.
33+
NOTE: Test for introspection of configured clusters only for Non Model in Image
34+
and for verifying OWLS 85530.
35+
36+
export WEBLOGIC_IMAGE_TAG=14.1.1.0
37+
introspectTest.sh
38+
2739
-------------------
2840
Internal Test Flow:
2941
-------------------
@@ -85,3 +97,14 @@ Internal Test Flow:
8597
wl-pod.yamlt
8698
<operator-src>/operator/src/main/resources/scripts/startServer.sh
8799
<operator-src>/operator/src/main/resources/scripts/start-server.py
100+
101+
() Various test verifications (WebLogic version, configuration overrides, etc) are executed.
102+
103+
() For domain types other than Model in Image, a verification test for JIRA OWLS-85530 is executed:
104+
105+
1. a static configured cluster is created using WLST in online mode.
106+
2. a minor cleanup of the test environment is performed in preparation for a rerun of the
107+
introspection job. The minor cleanup function leaves the existing
108+
domain-home/pv/pvc/secret/etc, deletes wl pods, deletes the introspect job, then
109+
redeploys the custom overrides.
110+
3. reruns the introspect job
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Copyright (c) 2018, 2020, Oracle Corporation and/or its affiliates.
2+
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
3+
4+
#
5+
# purpose:
6+
#
7+
# invoke on-line WLST to create a configured static cluster and two managed
8+
# servers that reference it.
9+
#
10+
# NOTE: The static cluster must be configured using on-line WLST instead of
11+
# off-line WLST in order to reproduce OWLS 85530. On-line WLST produces the
12+
# following cluster configuration:
13+
#
14+
# <cluster>
15+
# <name>c1</name>
16+
# <cluster-messaging-mode>unicast</cluster-messaging-mode>
17+
# <dynamic-servers>
18+
# <maximum-dynamic-server-count>0</maximum-dynamic-server-count>
19+
# </dynamic-servers>
20+
# </cluster>
21+
#
22+
# assumes the admin user/pass was encoded to a userConfig/userKey by the
23+
# introspector these files have been mounted to /weblogic-operator/introspector
24+
#
25+
# usage:
26+
# wlst.sh createStaticCluster.py <url> <cluster_name>
27+
#
28+
# sample usage:
29+
# wlst.sh createStaticCluster.py t3://domain1-admin-server:7001 c1
30+
#
31+
32+
import sys
33+
34+
url = sys.argv[1]
35+
cluster_name = sys.argv[2]
36+
37+
connect(userConfigFile='/weblogic-operator/introspector/userConfigNodeManager.secure',userKeyFile='/tmp/userKeyNodeManager.secure.bin',url=url)
38+
39+
edit()
40+
startEdit()
41+
42+
cl=cmo.createCluster(cluster_name)
43+
44+
# Create managed servers
45+
for index in range(0, 2):
46+
cd('/')
47+
48+
msIndex = index+1
49+
name = '%s%s' % ('ms', msIndex)
50+
51+
create(name, 'Server')
52+
cd('/Servers/%s/' % name )
53+
print('managed server name is %s' % name);
54+
set('ListenPort', 8001)
55+
set('ListenAddress', '')
56+
set('Cluster', cl)
57+
58+
save()
59+
activate()
60+
61+
print 'ok'
62+
exit(exitcode=0)

src/integration-tests/introspector/introspectTest.sh

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@
3939
# To check for ISTIO
4040
# export ISTIO_ENABELD=true - this only test for Non Model in Image
4141
#
42+
# To check for introspection of configured clusters with WebLogic 14.1.1.0 image.
43+
# NOTE: Test for introspection of configured clusters only for Non Model in Image
44+
# and for verifying OWLS 85530.
45+
#
46+
# export WEBLOGIC_IMAGE_TAG=14.1.1.0
47+
# introspectTest.sh
48+
#
4249
#############################################################################
4350
#
4451
# Initialize basic globals
@@ -1017,6 +1024,45 @@ function checkNodeManagerJavaOptions() {
10171024
fi
10181025
}
10191026

1027+
#############################################################################
1028+
#
1029+
# Create static cluster using on-line WLST.
1030+
# NOTE: The static cluster must be configured using on-line WLST instead of
1031+
# off-line WLST in order to reproduce OWLS 85530. This creates a static
1032+
# cluster entry of the form:
1033+
#
1034+
# <cluster>
1035+
# <name>c1</name>
1036+
# <dynamic-servers>
1037+
# <maximum-dynamic-server-count>0</maximum-dynamic-server-count>
1038+
# </dynamic-servers>
1039+
# </cluster>
1040+
#
1041+
1042+
function createStaticCluster() {
1043+
1044+
local cluster_name=${1?}
1045+
local pod_name=${2?}
1046+
local admin_url=${3?}
1047+
local script_file=createStaticCluster.py
1048+
local out_file=$test_home/createStaticCluster.out
1049+
1050+
local script_cmd="wlst.sh /shared/${script_file} ${admin_url} ${cluster_name}"
1051+
1052+
trace "Info: Creating static cluster '$cluster_name' via '$script_cmd' on pod '$pod_name'."
1053+
1054+
kubectl -n ${NAMESPACE} cp ${SCRIPTPATH}/${script_file} ${pod_name}:/shared/${script_file} || exit 1
1055+
1056+
tracen "Info: Waiting for createStaticCluster script to complete"
1057+
printdots_start
1058+
kubectl exec -it -n ${NAMESPACE} ${pod_name} ${script_cmd} > ${out_file} 2>&1
1059+
status=$?
1060+
printdots_end
1061+
if [ $status -ne 0 ]; then
1062+
trace "Error: The '$script_cmd' failed, see '$out_file'."
1063+
exit 1
1064+
fi
1065+
}
10201066

10211067
#############################################################################
10221068
#
@@ -1102,4 +1148,15 @@ checkManagedServer1MemArg
11021148
# Verify node manager java options
11031149
checkNodeManagerJavaOptions
11041150

1151+
if [ ${DOMAIN_SOURCE_TYPE} != "FromModel" ] ; then
1152+
# Create static cluster using WLST on-line mode.
1153+
# NOTE: The static cluster must be configured using on-line WLST instead of
1154+
# off-line WLST in order to reproduce OWLS 85530.
1155+
createStaticCluster 'c1' ${DOMAIN_UID}-${ADMIN_NAME?} t3://${DOMAIN_UID}-${ADMIN_NAME}:${ADMIN_PORT}
1156+
1157+
# Re-run introspector to introspect the static cluster
1158+
cleanupMinor
1159+
deployIntrospectJobPod
1160+
fi
1161+
11051162
trace "Info: Success!"

0 commit comments

Comments
 (0)