Skip to content

OWLS 85530: OPERATOR INTROSPECTOR THROWS VALIDATION ERRORS FOR STATIC CLUSTER #2014

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Oct 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions operator/src/main/resources/scripts/introspectDomain.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 23 additions & 0 deletions src/integration-tests/introspector/README
Original file line number Diff line number Diff line change
Expand Up @@ -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:
-------------------
Expand Down Expand Up @@ -85,3 +97,14 @@ Internal Test Flow:
wl-pod.yamlt
<operator-src>/operator/src/main/resources/scripts/startServer.sh
<operator-src>/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
62 changes: 62 additions & 0 deletions src/integration-tests/introspector/createStaticCluster.py
Original file line number Diff line number Diff line change
@@ -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:
#
# <cluster>
# <name>c1</name>
# <cluster-messaging-mode>unicast</cluster-messaging-mode>
# <dynamic-servers>
# <maximum-dynamic-server-count>0</maximum-dynamic-server-count>
# </dynamic-servers>
# </cluster>
#
# 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 <url> <cluster_name>
#
# 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)
57 changes: 57 additions & 0 deletions src/integration-tests/introspector/introspectTest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
#
# <cluster>
# <name>c1</name>
# <dynamic-servers>
# <maximum-dynamic-server-count>0</maximum-dynamic-server-count>
# </dynamic-servers>
# </cluster>
#

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
}

#############################################################################
#
Expand Down Expand Up @@ -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!"