@@ -336,6 +336,7 @@ function deployTestScriptConfigMap() {
336
336
cp ${SOURCEPATH} /operator/src/main/resources/scripts/traceUtils* ${test_home} /test-scripts || exit 1
337
337
cp ${SCRIPTPATH} /createDomain.sh ${test_home} /test-scripts || exit 1
338
338
cp ${SCRIPTPATH} /createTestRoot.sh ${test_home} /test-scripts || exit 1
339
+ cp ${SCRIPTPATH} /introspectDomainProxy.sh ${test_home} /test-scripts || exit 1
339
340
340
341
if [ " $CREATE_DOMAIN " = " true" ]; then
341
342
rm -f ${test_home} /scripts/createDomain.py
@@ -454,6 +455,7 @@ function deployCreateDomainJob() {
454
455
# - this emulates what the operator pod would do prior to start wl-pods
455
456
#
456
457
458
+ # Alternatively, run deployIntrospectJobPod() instead.
457
459
function deployIntrospectJob() {
458
460
local introspect_output_cm_name=${DOMAIN_UID} -weblogic-domain-introspect-cm
459
461
@@ -484,6 +486,105 @@ function deployIntrospectJob() {
484
486
485
487
}
486
488
489
+ # Here we emulate the introspect job by directly starting an introspect pod and monitoring it.
490
+ # deployIntrospectJob() does about the same thing, but starts a pod via a job
491
+ # (Running a pod directly is helpful for debugging.)
492
+
493
+ function deployIntrospectJobPod() {
494
+ local introspect_output_cm_name=${DOMAIN_UID} -weblogic-domain-introspect-cm
495
+ local target_yaml=${test_home} /wl-introspect-pod.yaml
496
+ local pod_name=${DOMAIN_UID} --introspect-domain-pod
497
+ local job_name=$pod_name
498
+
499
+ trace " Info: Run introspection job, parse its output to files, and put files in configmap '$introspect_output_cm_name '."
500
+
501
+ # delete anything left over from a previous invocation of this function
502
+
503
+ kubectl -n $NAMESPACE delete cm $introspect_output_cm_name \
504
+ --ignore-not-found \
505
+ 2>&1 | tracePipe " Info: kubectl output: "
506
+
507
+ if [ -f " ${target_yaml} " ]; then
508
+ kubectl -n $NAMESPACE delete -f ${target_yaml} \
509
+ --ignore-not-found \
510
+ 2>&1 | tracePipe " Info: kubectl output: "
511
+ rm -f ${target_yaml}
512
+ fi
513
+
514
+ trace " Info: Deploying job pod '$pod_name ' and waiting for it to be ready."
515
+
516
+ (
517
+ export SERVER_NAME=introspect
518
+ export JOB_NAME=${DOMAIN_UID} --introspect-domain-pod
519
+ export JOB_SCRIPT=/test-scripts/introspectDomainProxy.sh
520
+ export SERVICE_NAME=` toDNS1123Legal ${DOMAIN_UID} -${server_name} `
521
+ export AS_SERVICE_NAME=` toDNS1123Legal ${DOMAIN_UID} -${ADMIN_NAME} `
522
+ if [ " ${SERVER_NAME} " = " ${ADMIN_NAME} " ]; then
523
+ export LOCAL_SERVER_DEFAULT_PORT=$ADMIN_PORT
524
+ else
525
+ export LOCAL_SERVER_DEFAULT_PORT=$MANAGED_SERVER_PORT
526
+ fi
527
+ ${SCRIPTPATH} /util_subst.sh -g wl-introspect-pod.yamlt ${target_yaml} || exit 1
528
+ ) || exit 1
529
+
530
+ kubectl create -f ${target_yaml} \
531
+ 2>&1 | tracePipe " Info: kubectl output: " || exit 1
532
+
533
+ # Wait for pod to come up successfully
534
+
535
+ # TBD make the following a helper fn since this is the second place
536
+ # we wait for a pod to start, and the code is exactly the same...
537
+ local status=" 0/1"
538
+ local startsecs=$SECONDS
539
+ local maxsecs=180
540
+ tracen " Info: Waiting up to $maxsecs seconds for pod '$pod_name ' readiness"
541
+ while [ " ${status} " != " 1/1" ] ; do
542
+ if [ $(( SECONDS - startsecs)) -gt $maxsecs ]; then
543
+ echo
544
+ trace " Error: pod $pod_name failed to start within $maxsecs seconds. kubectl describe:"
545
+ kubectl -n $NAMESPACE describe pod $pod_name
546
+ trace " Error: pod $pod_name failed to start within $maxsecs seconds. kubectl log:"
547
+ kubectl -n $NAMESPACE logs $pod_name
548
+ exit 1
549
+ fi
550
+ echo -n " ."
551
+ sleep 1
552
+ status=` kubectl -n $NAMESPACE get pods 2>&1 | egrep $pod_name | awk ' {print $2}' `
553
+ done
554
+ echo " ($(( SECONDS - startsecs)) seconds)"
555
+
556
+ local startSecs=$SECONDS
557
+ local maxsecs=30
558
+ local exitString=" "
559
+ tracen " Info: Waiting up to $maxsecs seconds for pod '$pod_name ' to run the introspectDomain.py script."
560
+ printdots_start
561
+ while [ $(( SECONDS - startSecs)) -lt $maxsecs ] && [ " $exitString " = " " ]; do
562
+ exitString=" ` kubectl -n $NAMESPACE logs $pod_name 2>&1 | grep INTROSPECT_DOMAIN_EXIT` "
563
+ sleep 1
564
+ done
565
+ printdots_end
566
+ if [ " $exitString " = " " ]; then
567
+ trace " Error: Introspector timed out, see 'kubectl -n $NAMESPACE logs $pod_name '."
568
+ exit 1
569
+ fi
570
+ if [ ! " $exitString " = " INTROSPECT_DOMAIN_EXIT=0" ]; then
571
+ trace " Error: Introspector pod script failed, see 'kubectl -n $NAMESPACE logs $pod_name '."
572
+ exit 1
573
+ fi
574
+
575
+ # parse job pod's output files
576
+
577
+ kubectl -n $NAMESPACE logs $pod_name > ${test_home} /job-${DOMAIN_UID} -introspect-domain-pod-job.out
578
+
579
+ ${SCRIPTPATH} /util_fsplit.sh \
580
+ ${test_home} /job-${DOMAIN_UID} -introspect-domain-pod-job.out \
581
+ ${test_home} /jobfiles || exit 1
582
+
583
+ # put the outputfile in a cm
584
+
585
+ createConfigMapFromDir $introspect_output_cm_name ${test_home} /jobfiles
586
+ }
587
+
487
588
# ############################################################################
488
589
#
489
590
# Launch pod and wait up to 180 seconds for it to succeed, also launch
@@ -664,7 +765,8 @@ if [ ! "$RERUN_INTROSPECT_ONLY" = "true" ]; then
664
765
createTestRootPVDir
665
766
deployWebLogic_PV_PVC_and_Secret
666
767
deployCreateDomainJob
667
- deployIntrospectJob
768
+ # deployIntrospectJob
769
+ deployIntrospectJobPod
668
770
deployPod ${ADMIN_NAME?}
669
771
deploySinglePodService ${ADMIN_NAME?} ${ADMIN_PORT?} 30701
670
772
deployPod ${MANAGED_SERVER_NAME_BASE?} 1
0 commit comments