Skip to content

Commit 44f5b06

Browse files
committed
Rearrange restart of pods
1 parent 5a5aca6 commit 44f5b06

File tree

1 file changed

+15
-9
lines changed
  • integration-tests/src/test/java/oracle/kubernetes/operator

1 file changed

+15
-9
lines changed

integration-tests/src/test/java/oracle/kubernetes/operator/SitConfig.java

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ private static void copySitConfigFiles(String files[], String secretName) throws
197197
} else {
198198
Files.write(path, content.getBytes(charset));
199199
}
200-
display(dstDir);
200+
// display(dstDir);
201201
}
202202
}
203203

@@ -490,6 +490,13 @@ private void createJdbcResource() throws Exception {
490490
* @throws Exception when pods restart fail
491491
*/
492492
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+
493500
if (!oldSecret.equals(newSecret)) {
494501
String content =
495502
new String(Files.readAllBytes(Paths.get(domainYaml)), StandardCharsets.UTF_8);
@@ -499,6 +506,7 @@ private void recreateConfigMapandRestart(String oldSecret, String newSecret) thr
499506
content.getBytes(StandardCharsets.UTF_8),
500507
StandardOpenOption.TRUNCATE_EXISTING);
501508

509+
// delete the old secret and add new secret to domain.yaml
502510
TestUtils.exec("kubectl delete secret " + domain.getDomainUid() + "-" + oldSecret, true);
503511
String cmd =
504512
"kubectl -n "
@@ -512,16 +520,9 @@ private void recreateConfigMapandRestart(String oldSecret, String newSecret) thr
512520
+ " --from-literal=dbusername=root"
513521
+ " --from-literal=dbpassword=root123";
514522
TestUtils.exec(cmd, true);
515-
TestUtils.exec("kubectl apply -f " + domainYaml, true);
516523
}
517524

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
525526
String cmd =
526527
"kubectl create configmap "
527528
+ DOMAINUID
@@ -533,6 +534,11 @@ private void recreateConfigMapandRestart(String oldSecret, String newSecret) thr
533534
cmd = "kubectl describe cm -n " + domain.getDomainNs() + " customsitconfigdomain-sitconfigcm";
534535
TestUtils.exec(cmd, true);
535536

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
536542
patchStr = "'{\"spec\":{\"serverStartPolicy\":\"IF_NEEDED\"}}'";
537543
TestUtils.kubectlpatch(DOMAINUID, domain.getDomainNs(), patchStr);
538544
domain.verifyDomainCreated();

0 commit comments

Comments
 (0)