@@ -490,23 +490,7 @@ private void createJdbcResource() throws Exception {
490
490
* @throws Exception when pods restart fail
491
491
*/
492
492
private void recreateConfigMapandRestart (String oldSecret , String newSecret ) throws Exception {
493
- // stop all running wls pods
494
- int clusterReplicas =
495
- TestUtils .getClusterReplicas (DOMAINUID , domain .getClusterName (), domain .getDomainNs ());
496
-
497
- // recreate the configmap with new overrride files
498
- String cmd =
499
- "kubectl create configmap "
500
- + DOMAINUID
501
- + "-sitconfigcm --from-file="
502
- + configOverrideDir
503
- + " -o yaml --dry-run | kubectl replace -f -" ;
504
- TestUtils .exec (cmd , true );
505
-
506
- cmd = "kubectl describe cm -n " + domain .getDomainNs () + " customsitconfigdomain-sitconfigcm" ;
507
- TestUtils .exec (cmd , true );
508
-
509
- // now modify the domain.yaml if the secret name is changed
493
+ // modify the domain.yaml if the secret name is changed
510
494
if (!oldSecret .equals (newSecret )) {
511
495
String content =
512
496
new String (Files .readAllBytes (Paths .get (domainYaml )), StandardCharsets .UTF_8 );
@@ -515,31 +499,43 @@ private void recreateConfigMapandRestart(String oldSecret, String newSecret) thr
515
499
Paths .get (domainYaml ),
516
500
content .getBytes (StandardCharsets .UTF_8 ),
517
501
StandardOpenOption .TRUNCATE_EXISTING );
518
- logger .log (Level .INFO , content );
519
502
520
503
// delete the old secret and add new secret to domain.yaml
521
504
TestUtils .exec ("kubectl delete secret " + domain .getDomainUid () + "-" + oldSecret , true );
522
- cmd =
505
+ String cmd =
523
506
"kubectl -n "
524
507
+ domain .getDomainNs ()
525
508
+ " create secret generic "
526
509
+ domain .getDomainUid ()
527
510
+ "-"
528
511
+ newSecret
529
512
+ " --from-literal=hostname="
530
- + fqdn
513
+ + TestUtils . getHostName ()
531
514
+ " --from-literal=dbusername=root"
532
515
+ " --from-literal=dbpassword=root123" ;
533
516
TestUtils .exec (cmd , true );
534
- // apply the new domain.yaml
535
517
TestUtils .exec ("kubectl apply -f " + domainYaml , true );
536
518
}
519
+
520
+ int clusterReplicas =
521
+ TestUtils .getClusterReplicas (DOMAINUID , domain .getClusterName (), domain .getDomainNs ());
522
+
537
523
// restart the pods so that introspector can run and replace files with new secret if changed
538
524
// and with new config override files
539
525
String patchStr = "'{\" spec\" :{\" serverStartPolicy\" :\" NEVER\" }}'" ;
540
526
TestUtils .kubectlpatch (DOMAINUID , domain .getDomainNs (), patchStr );
541
527
domain .verifyServerPodsDeleted (clusterReplicas );
542
- TestUtils .exec ("kubectl get all --all-namespaces" , true );
528
+
529
+ String cmd =
530
+ "kubectl create configmap "
531
+ + DOMAINUID
532
+ + "-sitconfigcm --from-file="
533
+ + configOverrideDir
534
+ + " -o yaml --dry-run | kubectl replace -f -" ;
535
+ TestUtils .exec (cmd , true );
536
+ cmd = "kubectl describe cm -n " + domain .getDomainNs () + " customsitconfigdomain-sitconfigcm" ;
537
+ TestUtils .exec (cmd , true );
538
+
543
539
patchStr = "'{\" spec\" :{\" serverStartPolicy\" :\" IF_NEEDED\" }}'" ;
544
540
TestUtils .kubectlpatch (DOMAINUID , domain .getDomainNs (), patchStr );
545
541
domain .verifyDomainCreated ();
0 commit comments