Skip to content

Commit 6046991

Browse files
committed
Merge branch 'upgrade14120-fixes-rel42' into 'release/4.2'
Upgrade14120 fixes rel42 See merge request weblogic-cloud/weblogic-kubernetes-operator!4801
2 parents 50114ce + 344f245 commit 6046991

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

operator/src/main/resources/scripts/modelInImage.sh

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -399,13 +399,12 @@ createWLDomain() {
399399
if [ -f ${PRIMORDIAL_DOMAIN_ZIPPED} ] ; then
400400
checkSecureModeForUpgrade
401401
fi
402-
403402
if [ ${WDT_ARTIFACTS_CHANGED} -ne 0 ] || [ ${jdk_changed} -eq 1 ] \
404403
|| [ ${SECRETS_AND_ENV_CHANGED} -ne 0 ] || [ ${DISABLE_SM_FOR_12214_NONSM_UPG} -eq 1 ] ; then
405-
406404
trace "Need to create domain ${WDT_DOMAIN_TYPE}"
407405
createModelDomain
408-
if [ "${MERGED_MODEL_ENVVARS_SAME}" == "false" ] ; then
406+
if [ "${MERGED_MODEL_ENVVARS_SAME}" == "false" ] || [ ${DISABLE_SM_FOR_12214_NONSM_UPG} -eq 1 ] ; then
407+
# Make sure it will run the introspectDomain.py
409408
DOMAIN_CREATED=1
410409
fi
411410
else
@@ -500,7 +499,8 @@ createModelDomain() {
500499
trace "Entering createModelDomain"
501500
createPrimordialDomain
502501

503-
if [ "${MERGED_MODEL_ENVVARS_SAME}" == "false" ] ; then
502+
# If model changes or upgrade image scenario, run update domain.
503+
if [ "${MERGED_MODEL_ENVVARS_SAME}" == "false" ] || [ $DISABLE_SM_FOR_12214_NONSM_UPG -eq 1 ] ; then
504504
# if there is a new primordial domain created then use newly created primordial domain otherwise
505505
# if the primordial domain already in the configmap, restore it
506506
#
@@ -780,9 +780,6 @@ createPrimordialDomain() {
780780

781781
trace "No primordial domain or need to create again because of changes require domain recreation"
782782

783-
#if } -eq 1 ] && [ -f ${PRIMORDIAL_DOMAIN_ZIPPED} ]; then
784-
785-
786783
wdtCreatePrimordialDomain
787784
create_primordial_tgz=1
788785
MII_USE_ONLINE_UPDATE=false
@@ -846,6 +843,7 @@ checkSecureModeForUpgrade() {
846843
if [ -f /tmp/mii_domain_upgrade.txt ] && [ $(grep -i False /tmp/mii_domain_upgrade.txt | wc -l ) -gt 0 ] ; then
847844
if [ -f /tmp/mii_domain_before14120.txt ] && [ $(grep -i True /tmp/mii_domain_before14120.txt | wc -l ) -gt 0 ] ; then
848845
# Set this so that the upgrade image only scenario 12.2.1.4 to 14.1.2 will recreate the domain
846+
trace "Domain version is earlier than 14.1.2, upgrade only image to 14.1.2 detected"
849847
DISABLE_SM_FOR_12214_NONSM_UPG=1
850848
fi
851849
fi

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,9 @@ def filter_model(model):
183183
try:
184184

185185
if model is not None:
186+
187+
upgradeServerIfNeeded(model)
188+
186189
if getOfflineWlstEnv() is None:
187190
initOfflineWlstEnv(model)
188191

@@ -216,7 +219,6 @@ def filter_model(model):
216219
if 'ServerTemplate' in topology:
217220
customizeServerTemplates(model)
218221

219-
upgradeServerIfNeeded(model)
220222
except:
221223
exc_type, exc_obj, exc_tb = sys.exc_info()
222224
ee_string = traceback.format_exception(exc_type, exc_obj, exc_tb)
@@ -413,14 +415,18 @@ def upgradeServerIfNeeded(model):
413415
# if domainInfo already set to secure or in dev mode then do not set it, prod mode will not be secure
414416
# regardless of others
415417
# if the model disabled `ProductionModeEnabled` specifically now, do nothing
416-
418+
prod_mode = False
417419
if 'domainInfo' in model and 'ServerStartMode' in model['domainInfo']:
418-
return
420+
mode = model['domainInfo']['ServerStartMode']
421+
if mode == 'secure' or mode == 'dev':
422+
return
423+
else:
424+
prod_mode = True
419425

420426
if 'topology' in model:
421427

422428
topology = model['topology']
423-
if 'ProductionModeEnabled' not in topology:
429+
if not prod_mode and 'ProductionModeEnabled' not in topology:
424430
return
425431

426432
if 'ProductionModeEnabled' in topology:

0 commit comments

Comments
 (0)