Skip to content

Support custom PVC, default domain home and default log home #453

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 45 commits into from
Oct 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
de46cf9
Initial version for supporting custom PVC and shared PV
doxiao Oct 15, 2018
7362618
Modify operator code to handle shard domain home base
doxiao Oct 16, 2018
b627c49
Minor cleanup
doxiao Oct 16, 2018
559c184
More work on shared pv and modify integration test
doxiao Oct 18, 2018
a4fad10
Change WDT script for shared pv and null domainName in inputs
doxiao Oct 19, 2018
9fbda4c
Change default log home to /shared/logs/domainUID and domain home to …
doxiao Oct 19, 2018
27a8ab6
Redirect dynamic cluster server logs
doxiao Oct 19, 2018
01da6a3
Support redirect of dynamic cluster server logs when use WDT
doxiao Oct 19, 2018
409b599
Initial version for supporting custom PVC and shared PV
doxiao Oct 15, 2018
9f41b90
Modify operator code to handle shard domain home base
doxiao Oct 16, 2018
ae2c80d
Minor cleanup
doxiao Oct 16, 2018
8eea0e6
More work on shared pv and modify integration test
doxiao Oct 18, 2018
eb571d3
Change WDT script for shared pv and null domainName in inputs
doxiao Oct 19, 2018
3c6f2ca
Change default log home to /shared/logs/domainUID and domain home to …
doxiao Oct 19, 2018
c73abec
Redirect dynamic cluster server logs
doxiao Oct 19, 2018
9a16e27
Support redirect of dynamic cluster server logs when use WDT
doxiao Oct 19, 2018
9394ccd
Add label to pv and pvc
doxiao Oct 23, 2018
6b9a19b
Merge branch 'improve_samples_OOTB_experience' of https://github.com/…
doxiao Oct 23, 2018
c9ef1ef
Modify integration test scaling script
doxiao Oct 23, 2018
47923ac
Add default values
doxiao Oct 23, 2018
952de7e
Add check on domain resource creation
doxiao Oct 24, 2018
b1f6440
Modify java integration test 3 and 9
doxiao Oct 25, 2018
cc31b62
Initial version for supporting custom PVC and shared PV
doxiao Oct 15, 2018
4f174b5
Modify operator code to handle shard domain home base
doxiao Oct 16, 2018
84e9558
Minor cleanup
doxiao Oct 16, 2018
f9c3bb1
Merge branch 'develop' into improve_samples_OOTB_experience
doxiao Oct 25, 2018
ecf1a36
More work on shared pv and modify integration test
doxiao Oct 18, 2018
b286ba0
Change WDT script for shared pv and null domainName in inputs
doxiao Oct 19, 2018
a7c5cd0
Change default log home to /shared/logs/domainUID and domain home to …
doxiao Oct 19, 2018
5edb293
Redirect dynamic cluster server logs
doxiao Oct 19, 2018
cf33849
Support redirect of dynamic cluster server logs when use WDT
doxiao Oct 19, 2018
aa93e68
Initial version for supporting custom PVC and shared PV
doxiao Oct 15, 2018
306c7d9
Modify operator code to handle shard domain home base
doxiao Oct 16, 2018
f0ce3b7
Minor cleanup
doxiao Oct 16, 2018
8bf9e4a
More work on shared pv and modify integration test
doxiao Oct 18, 2018
61293de
Change default log home to /shared/logs/domainUID and domain home to …
doxiao Oct 19, 2018
b5d7b25
Add label to pv and pvc
doxiao Oct 23, 2018
9568768
Modify integration test scaling script
doxiao Oct 23, 2018
e4c8da2
Add default values
doxiao Oct 23, 2018
5858f7e
Add check on domain resource creation
doxiao Oct 24, 2018
3c63164
Modify java integration test 3 and 9
doxiao Oct 25, 2018
a246ea3
Modify java integration test
doxiao Oct 25, 2018
00985a5
Merge branch 'improve_samples_OOTB_experience' of https://github.com/…
doxiao Oct 25, 2018
4078d21
Modify integration test to keep the current behavior
doxiao Oct 25, 2018
9912112
Temporarily make the domainName and domainUID the same in java integr…
doxiao Oct 25, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -273,11 +273,11 @@ public void testWLDFScaling(Operator operator, Domain domain) throws Exception {
String scriptsDir =
"/scratch/acceptance_test_pv/persistentVolume-"
+ domainUid
+ "/domain/"
+ domainName
+ "/domains/"
+ domainUid
+ "/bin/scripts";

copyScalingScriptToPod(scriptsDir, domainName, adminPodName, domainNS);
copyScalingScriptToPod(scriptsDir, domainUid, adminPodName, domainNS);
TestUtils.createRBACPoliciesForWLDFScaling();

// deploy opensessionapp
Expand Down Expand Up @@ -391,15 +391,15 @@ public static String getBranchName() {
}

private void copyScalingScriptToPod(
String dirPathToCreate, String domainName, String podName, String domainNS) throws Exception {
String dirPathToCreate, String domainUID, String podName, String domainNS) throws Exception {

// create scripts dir under domain pv
TestUtils.createDirUnderDomainPV(dirPathToCreate);

// copy script to pod
TestUtils.kubectlcp(
getProjectRoot() + "/src/scripts/scaling/scalingAction.sh",
"/shared/domain/" + domainName + "/bin/scripts/scalingAction.sh",
"/shared/domains/" + domainUID + "/bin/scripts/scalingAction.sh",
// "/shared/scalingAction.sh",
podName,
domainNS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public Domain(String inputYaml) throws Exception {
createPV();
createSecret();
generateInputYaml();
callCreateDomainScript();
callCreateDomainScript(userProjectsDir + "/weblogic-domains/" + domainUid);
createLoadBalancer();
}

Expand Down Expand Up @@ -411,13 +411,13 @@ public Map<String, Object> getDomainMap() {

public void deletePVCAndCheckPVReleased() throws Exception {
StringBuffer cmd = new StringBuffer("kubectl get pv ");
cmd.append(domainUid).append("-weblogic-domain-pv -n ").append(domainNS);
cmd.append(domainUid).append("-pv -n ").append(domainNS);

ExecResult result = ExecCommand.exec(cmd.toString());
if (result.exitValue() == 0) {
logger.info("Status of PV before deleting PVC " + result.stdout());
}
TestUtils.deletePVC(domainUid + "-weblogic-domain-pvc", domainNS);
TestUtils.deletePVC(domainUid + "-pvc", domainNS);
String reclaimPolicy = (String) domainMap.get("weblogicDomainStorageReclaimPolicy");
boolean pvReleased = TestUtils.checkPVReleased(domainUid, domainNS);
if (reclaimPolicy != null && reclaimPolicy.equals("Recycle") && !pvReleased) {
Expand All @@ -430,14 +430,23 @@ public void deletePVCAndCheckPVReleased() throws Exception {

public void createDomainOnExistingDirectory() throws Exception {
String domainStoragePath = domainMap.get("weblogicDomainStoragePath").toString();
String domainDir = domainStoragePath + "/domain/" + domainMap.get("domainName").toString();
String domainDir = domainStoragePath + "/domains/" + domainMap.get("domainUID").toString();
logger.info("making sure the domain directory exists");
if (domainDir != null && !(new File(domainDir).exists())) {
throw new RuntimeException(
"FAIL: the domain directory " + domainDir + " does not exist, exiting!");
}
logger.info("Run the script to create domain");
StringBuffer cmd = new StringBuffer("cd ");
try {
callCreateDomainScript(userProjectsDir + "/weblogic-domains2/" + domainUid);
} catch (RuntimeException re) {
re.printStackTrace();
logger.info("[SUCCESS] create domain job failed, this is the expected behavior");
return;
}
throw new RuntimeException("FAIL: unexpected result, create domain job did not report error");

/* StringBuffer cmd = new StringBuffer("cd ");
cmd.append(BaseTest.getProjectRoot())
.append(" && helm install kubernetes/charts/weblogic-domain");
cmd.append(" --name ")
Expand All @@ -454,7 +463,7 @@ public void createDomainOnExistingDirectory() throws Exception {
} else {
throw new RuntimeException(
"FAIL: unexpected result, create domain job exit code: " + result.exitValue());
}
} */
}

public void verifyAdminConsoleViaLB() throws Exception {
Expand Down Expand Up @@ -534,9 +543,11 @@ private void createPV() throws Exception {
+ "/kubernetes/samples/scripts/create-weblogic-domain-pv-pvc/create-pv-pvc-inputs.yaml"));
Map<String, Object> pvMap = yaml.load(pv_is);
pv_is.close();
pvMap.put("domainName", domainMap.get("domainName"));
pvMap.put("domainUID", domainUid);

// each domain uses its own pv for now
domainMap.put("persistentVolumeClaimName", domainUid + "-pvc");

if (domainMap.get("weblogicDomainStorageReclaimPolicy") != null) {
pvMap.put(
"weblogicDomainStorageReclaimPolicy",
Expand All @@ -545,6 +556,7 @@ private void createPV() throws Exception {
if (domainMap.get("weblogicDomainStorageSize") != null) {
pvMap.put("weblogicDomainStorageSize", domainMap.get("weblogicDomainStorageSize"));
}
pvMap.put("baseName", domainUid);
pvMap.put("namespace", domainNS);

weblogicDomainStorageReclaimPolicy = (String) pvMap.get("weblogicDomainStorageReclaimPolicy");
Expand Down Expand Up @@ -590,13 +602,13 @@ private void generateInputYaml() throws Exception {
TestUtils.createInputFile(domainMap, generatedInputYamlFile);
}

private void callCreateDomainScript() throws Exception {
private void callCreateDomainScript(String outputDir) throws Exception {
StringBuffer cmd = new StringBuffer(BaseTest.getProjectRoot());
cmd.append(
"/kubernetes/samples/scripts/create-weblogic-domain/domain-home-on-pv/create-domain.sh -i ")
.append(generatedInputYamlFile)
.append(" -e -v -o ")
.append(userProjectsDir);
.append(outputDir);
logger.info("Running " + cmd);
ExecResult result = ExecCommand.exec(cmd.toString());
if (result.exitValue() != 0) {
Expand Down Expand Up @@ -755,6 +767,9 @@ private void initialize(String inputYaml) throws Exception {

// read input domain yaml to test
domainMap = TestUtils.loadYaml(inputYaml);
if (domainMap.get("domainName") == null) {
domainMap.put("domainName", domainMap.get("domainUID"));
}

// read sample domain inputs
Yaml dyaml = new Yaml();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ public LoadBalancer(Map lbMap) throws Exception {
this.lbMap = lbMap;
Path parentDir =
Files.createDirectories(
Paths.get(
BaseTest.getUserProjectsDir() + "/weblogic-domains/" + lbMap.get("domainUID")));
Paths.get(BaseTest.getUserProjectsDir() + "/loadbalancers/" + lbMap.get("domainUID")));
// generate input yaml
TestUtils.createInputFile(lbMap, parentDir + "/lb-inputs.yaml");

Expand All @@ -33,7 +32,9 @@ public LoadBalancer(Map lbMap) throws Exception {
+ " -i "
+ parentDir
+ "/lb-inputs.yaml -e -o "
+ BaseTest.getUserProjectsDir();
+ BaseTest.getUserProjectsDir()
+ "/loadbalancers/"
+ lbMap.get("domainUID");
logger.info("Executing cmd " + cmdLb);

ExecResult result = ExecCommand.exec(cmdLb);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,24 @@ public PersistentVolume(String dirPath, Map pvMap) throws Exception {
logger.info("command result " + result.stdout().trim());

Path parentDir =
Files.createDirectories(
Paths.get(
BaseTest.getUserProjectsDir() + "/weblogic-domains/" + pvMap.get("domainUID")));
pvMap.get("domainUID") != null
? Files.createDirectories(
Paths.get(BaseTest.getUserProjectsDir() + "/pv-pvcs/" + pvMap.get("domainUID")))
: Files.createDirectories(Paths.get(BaseTest.getUserProjectsDir() + "/pv-pvcs/"));

// generate input yaml
TestUtils.createInputFile(pvMap, parentDir + "/pv-inputs.yaml");
TestUtils.createInputFile(pvMap, parentDir + "/" + pvMap.get("baseName") + "-pv-inputs.yaml");

// create PV/PVC
String cmdPvPvc =
BaseTest.getProjectRoot()
+ "/kubernetes/samples/scripts/create-weblogic-domain-pv-pvc/create-pv-pvc.sh "
+ " -i "
+ parentDir
+ "/pv-inputs.yaml -e -o "
+ BaseTest.getUserProjectsDir();
+ "/"
+ pvMap.get("baseName")
+ "-pv-inputs.yaml -e -o "
+ parentDir;
logger.info("Executing cmd " + cmdPvPvc);

result = ExecCommand.exec(cmdPvPvc);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ public static void deletePVC(String pvcName, String namespace) throws Exception

public static boolean checkPVReleased(String domainUid, String namespace) throws Exception {
StringBuffer cmd = new StringBuffer("kubectl get pv ");
cmd.append(domainUid).append("-weblogic-domain-pv -n ").append(namespace);
cmd.append(domainUid).append("-pv -n ").append(namespace);

int i = 0;
while (i < BaseTest.getMaxIterationsPod()) {
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/src/test/resources/domain3.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.

adminServerName: admin-server
domainName: base_domain
domainName: domain3
domainUID: domain3
clusterName: cluster-1
configuredManagedServerCount: 4
Expand All @@ -17,4 +17,4 @@ adminNodePort: 30703
namespace: test1
loadBalancerWebPort: 30307
loadBalancerDashboardPort: 30317
createDomainFilesDir: wdt
createDomainFilesDir: wdt
4 changes: 2 additions & 2 deletions integration-tests/src/test/resources/domain4.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.

adminServerName: admin-server
domainName: base_domain
domainName: domain4
domainUID: domain4
clusterName: cluster-1
clusterType: CONFIGURED
Expand All @@ -18,4 +18,4 @@ adminNodePort: 30704
namespace: test2
loadBalancerWebPort: 30308
loadBalancerDashboardPort: 30318
createDomainFilesDir: wdt
createDomainFilesDir: wdt
4 changes: 2 additions & 2 deletions integration-tests/src/test/resources/wldf/wldf.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
scriptAct = wn1.createScriptAction('ScriptActionScaleUp')
scriptAct.setEnabled(true)
scriptAct.setTimeout(0)
scriptAct.setWorkingDirectory('/shared/domain/base_domain/bin/scripts/')
scriptAct.setPathToScript('/shared/domain/base_domain/bin/scripts/scalingAction.sh')
scriptAct.setWorkingDirectory('/shared/domains/domain3/bin/scripts/')
scriptAct.setPathToScript('/shared/domains/domain3/bin/scripts/scalingAction.sh')
props = Properties()
props.setProperty("INTERNAL_OPERATOR_CERT", operator_cert_data);
#props.setProperty("KUBERNETES_SERVICE_HOST", k8s_master_host);
Expand Down
1 change: 0 additions & 1 deletion kubernetes/samples/scripts/common/validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ function validateOutputDir {
shift
local in2=${1}
shift
internalValidateInputsFileDoesNotExistOrIsTheSame ${dir} ${in1} ${in2}
internalValidateGeneratedYamlFilesDoNotExist ${dir} $@
else
validationError "${dir} exists but is not a directory."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ adminPort: 7001
adminServerName: admin-server

# Name of the WebLogic domain to create
domainName: base_domain
# By default, this is the same as the domainUID
domainName: domain1

# Unique ID identifying a domain.
# This ID must not contain an underscope ("_"), and must be lowercase and unique across all domains in a Kubernetes cluster.
Expand Down
Loading