@@ -197,7 +197,7 @@ private static void copySitConfigFiles(String files[], String secretName) throws
197
197
} else {
198
198
Files .write (path , content .getBytes (charset ));
199
199
}
200
- display (dstDir );
200
+ // display(dstDir);
201
201
}
202
202
}
203
203
@@ -490,6 +490,13 @@ 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
+ String patchStr = "'{\" spec\" :{\" serverStartPolicy\" :\" NEVER\" }}'" ;
497
+ TestUtils .kubectlpatch (DOMAINUID , domain .getDomainNs (), patchStr );
498
+ domain .verifyServerPodsDeleted (clusterReplicas );
499
+
493
500
if (!oldSecret .equals (newSecret )) {
494
501
String content =
495
502
new String (Files .readAllBytes (Paths .get (domainYaml )), StandardCharsets .UTF_8 );
@@ -499,6 +506,7 @@ private void recreateConfigMapandRestart(String oldSecret, String newSecret) thr
499
506
content .getBytes (StandardCharsets .UTF_8 ),
500
507
StandardOpenOption .TRUNCATE_EXISTING );
501
508
509
+ // delete the old secret and add new secret to domain.yaml
502
510
TestUtils .exec ("kubectl delete secret " + domain .getDomainUid () + "-" + oldSecret , true );
503
511
String cmd =
504
512
"kubectl -n "
@@ -512,16 +520,9 @@ private void recreateConfigMapandRestart(String oldSecret, String newSecret) thr
512
520
+ " --from-literal=dbusername=root"
513
521
+ " --from-literal=dbpassword=root123" ;
514
522
TestUtils .exec (cmd , true );
515
- TestUtils .exec ("kubectl apply -f " + domainYaml , true );
516
523
}
517
524
518
- int clusterReplicas =
519
- TestUtils .getClusterReplicas (DOMAINUID , domain .getClusterName (), domain .getDomainNs ());
520
-
521
- String patchStr = "'{\" spec\" :{\" serverStartPolicy\" :\" NEVER\" }}'" ;
522
- TestUtils .kubectlpatch (DOMAINUID , domain .getDomainNs (), patchStr );
523
- domain .verifyServerPodsDeleted (clusterReplicas );
524
-
525
+ // recreate the configmap with new overrride files
525
526
String cmd =
526
527
"kubectl create configmap "
527
528
+ DOMAINUID
@@ -533,6 +534,11 @@ private void recreateConfigMapandRestart(String oldSecret, String newSecret) thr
533
534
cmd = "kubectl describe cm -n " + domain .getDomainNs () + " customsitconfigdomain-sitconfigcm" ;
534
535
TestUtils .exec (cmd , true );
535
536
537
+ // apply the new domain.yaml
538
+ TestUtils .exec ("kubectl apply -f " + domainYaml , true );
539
+
540
+ // start the pods so that introspector can run and replace files with new secret if changed and
541
+ // with new config override files
536
542
patchStr = "'{\" spec\" :{\" serverStartPolicy\" :\" IF_NEEDED\" }}'" ;
537
543
TestUtils .kubectlpatch (DOMAINUID , domain .getDomainNs (), patchStr );
538
544
domain .verifyDomainCreated ();
0 commit comments