Skip to content

Commit a31582b

Browse files
merge to the origin/develop branch
2 parents 0ddd0f1 + 583aef5 commit a31582b

File tree

76 files changed

+1372
-893
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+1372
-893
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Oracle WebLogic Server Kubernetes Operator
22

3-
Built with [Wercker](http://www.wercker.com)
3+
Built with [Jenkins](http://build.weblogick8s.org:8080/job/weblogic-kubernetes-operator/)
44

5-
[![wercker status](https://app.wercker.com/status/68ce42623fce7fb2e52d304de8ea7530/m/develop "wercker status")](https://app.wercker.com/project/byKey/68ce42623fce7fb2e52d304de8ea7530)
5+
[![Build Status](http://build.weblogick8s.org:8080/buildStatus/icon?job=weblogic-kubernetes-operator)](http://build.weblogick8s.org:8080/job/weblogic-kubernetes-operator/)
66

77
Oracle is finding ways for organizations using WebLogic Server to run important workloads, to move those workloads into the cloud. By certifying on industry standards, such as Docker and Kubernetes, WebLogic now runs in a cloud neutral infrastructure. In addition, we've provided an open-source Oracle WebLogic Server Kubernetes Operator (the “operator”) which has several key features to assist you with deploying and managing WebLogic domains in a Kubernetes environment. You can:
88

@@ -18,7 +18,7 @@ Oracle is finding ways for organizations using WebLogic Server to run important
1818
* Scale WebLogic domains by starting and stopping Managed Servers on demand, or by integrating with a REST API to initiate scaling based on WLDF, Prometheus, Grafana, or other rules.
1919
* Publish operator and WebLogic Server logs into Elasticsearch and interact with them in Kibana.
2020

21-
The fastest way to experience the operator is to follow the [Quick Start guide](site/quickstart.md), or you can peruse our [documentation](site), read our [blogs](https://blogs.oracle.com/weblogicserver/how-to-weblogic-server-on-kubernetes), or try out the [samples](kubernetes/samples/README.md).
21+
The fastest way to experience the operator is to follow the [Quick Start guide](site/quickstart.md), or you can peruse our [documentation](site), read our [blogs](https://blogs.oracle.com/fusionmiddlewaresupport/updated-weblogic-kubernetes-support-with-operator-20-v2), or try out the [samples](kubernetes/samples/README.md).
2222

2323
```diff
2424
+ The current release of the operator is 2.0-rc2, a release candidate for our 2.0 release.
@@ -81,7 +81,7 @@ The [User guide](site/user-guide.md) provides detailed information about all asp
8181

8282
Please refer to our [samples](kubernetes/samples/README.md) for information about the available sample code.
8383

84-
# Need more help? Have a suggestion? Come and say "Hello!"
84+
# Need more help? Have a suggestion? Come and say, "Hello!"
8585

8686
We have a **public Slack channel** where you can get in touch with us to ask questions about using the operator or give us feedback
8787
or suggestions about what features and improvements you would like to see. We would love to hear from you. To join our channel,
@@ -100,7 +100,7 @@ Please take a look at our [wish list](https://github.com/oracle/weblogic-kuberne
100100

101101
## API documentation
102102

103-
Documentation for APIs is provided here:
103+
Documentation for APIs:
104104

105105
* The operator provides a REST API that you can use to obtain configuration information and to initiate scaling actions. For details about how to use the REST APIs, see [Using the operator's REST services](site/rest.md).
106106

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

Lines changed: 191 additions & 360 deletions
Large diffs are not rendered by default.

integration-tests/src/test/java/oracle/kubernetes/operator/utils/Domain.java

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,12 @@ public class Domain {
6565
private static int waitTime = BaseTest.getWaitTimePod();
6666

6767
public Domain(String inputYaml) throws Exception {
68+
// read input domain yaml to test
69+
this(TestUtils.loadYaml(inputYaml));
70+
}
6871

69-
initialize(inputYaml);
72+
public Domain(Map<String, Object> inputDomainMap) throws Exception {
73+
initialize(inputDomainMap);
7074
createPV();
7175
createSecret();
7276
generateInputYaml();
@@ -699,16 +703,8 @@ private void createPV() throws Exception {
699703
weblogicDomainStorageReclaimPolicy = (String) pvMap.get("weblogicDomainStorageReclaimPolicy");
700704
weblogicDomainStorageSize = (String) pvMap.get("weblogicDomainStorageSize");
701705

702-
// test NFS for domain5 on JENKINS
703-
if (domainUid.equals("domain6")
704-
&& (System.getenv("JENKINS") != null
705-
&& System.getenv("JENKINS").equalsIgnoreCase("true"))) {
706-
pvMap.put("weblogicDomainStorageType", "NFS");
707-
pvMap.put("weblogicDomainStorageNFSServer", TestUtils.getHostName());
708-
} else {
709-
pvMap.put("weblogicDomainStorageType", "HOST_PATH");
710-
pvMap.put("weblogicDomainStorageNFSServer", TestUtils.getHostName());
711-
}
706+
pvMap.put("weblogicDomainStorageNFSServer", TestUtils.getHostName());
707+
712708
// set pv path
713709
domainMap.put(
714710
"weblogicDomainStoragePath",
@@ -837,7 +833,7 @@ private void createLoadBalancer() throws Exception {
837833
lbMap.put("name", "traefik-ingress-" + domainUid);
838834
}
839835

840-
if (domainUid.equals("domain7") && loadBalancer.equals("APACHE")) {
836+
if (loadBalancer.equals("APACHE")) {
841837
/* lbMap.put("loadBalancerAppPrepath", "/weblogic");
842838
lbMap.put("loadBalancerExposeAdminPort", new Boolean(true)); */
843839
}
@@ -960,12 +956,11 @@ private void callWebAppAndCheckForServerNameInResponse(
960956
}
961957
}
962958

963-
private void initialize(String inputYaml) throws Exception {
959+
private void initialize(Map<String, Object> inputDomainMap) throws Exception {
960+
domainMap = inputDomainMap;
964961
this.userProjectsDir = BaseTest.getUserProjectsDir();
965962
this.projectRoot = BaseTest.getProjectRoot();
966963

967-
// read input domain yaml to test
968-
domainMap = TestUtils.loadYaml(inputYaml);
969964
domainMap.put("domainName", domainMap.get("domainUID"));
970965

971966
// read sample domain inputs
@@ -1000,7 +995,7 @@ private void initialize(String inputYaml) throws Exception {
1000995
clusterName = (String) domainMap.get("clusterName");
1001996
clusterType = (String) domainMap.get("clusterType");
1002997
serverStartPolicy = (String) domainMap.get("serverStartPolicy");
1003-
/*
998+
/*TODO remove mhe
1004999
if (domainMap.containsKey("ingressPerDomain")) {
10051000
ingressPerDomain = ((Boolean) domainMap.get("ingressPerDomain")).booleanValue();
10061001
}
@@ -1014,9 +1009,9 @@ private void initialize(String inputYaml) throws Exception {
10141009

10151010
domainMap.put("domainHome", "/shared/domains/" + domainUid);
10161011
domainMap.put("logHome", "/shared/logs/" + domainUid);
1017-
domainMap.put(
1018-
"createDomainFilesDir",
1019-
BaseTest.getProjectRoot() + "/integration-tests/src/test/resources/domain-home-on-pv");
1012+
/* domainMap.put(
1013+
"createDomainFilesDir",
1014+
BaseTest.getProjectRoot() + "/integration-tests/src/test/resources/domain-home-on-pv"); */
10201015
String imageName = "store/oracle/weblogic";
10211016
if (System.getenv("IMAGE_NAME_WEBLOGIC") != null) {
10221017
imageName = System.getenv("IMAGE_NAME_WEBLOGIC");

integration-tests/src/test/java/oracle/kubernetes/operator/utils/Operator.java

Lines changed: 60 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,16 @@
1717
/** Operator class with all the utility methods for Operator. */
1818
public class Operator {
1919

20+
public static enum RESTCertType {
21+
/*self-signed certificate and public key stored in a kubernetes tls secret*/
22+
SELF_SIGNED,
23+
/*Certificate signed by an auto-created CA signed by an auto-created root certificate,
24+
* both and stored in a kubernetes tls secret*/
25+
CHAIN,
26+
/*Certificate and public key, and stored in a kubernetes tls secret*/
27+
LEGACY
28+
};
29+
2030
public static final String CREATE_OPERATOR_SCRIPT_MESSAGE =
2131
"The Oracle WebLogic Server Kubernetes Operator is deployed";
2232

@@ -36,6 +46,7 @@ public class Operator {
3646

3747
private static int maxIterationsOp = BaseTest.getMaxIterationsPod(); // 50 * 5 = 250 seconds
3848
private static int waitTimeOp = BaseTest.getWaitTimePod();
49+
private static RESTCertType restCertType = RESTCertType.SELF_SIGNED;
3950

4051
/**
4152
* Takes operator input properties which needs to be customized and generates a operator input
@@ -44,9 +55,10 @@ public class Operator {
4455
* @param inputYaml
4556
* @throws Exception
4657
*/
47-
public Operator(String inputYaml, boolean useLegacyRESTIdentity) throws Exception {
58+
public Operator(String inputYaml, RESTCertType restCertType) throws Exception {
59+
this.restCertType = restCertType;
4860
initialize(inputYaml);
49-
generateInputYaml(useLegacyRESTIdentity);
61+
generateInputYaml();
5062
callHelmInstall();
5163
}
5264

@@ -195,8 +207,7 @@ public void scale(String domainUid, String clusterName, int numOfMS) throws Exce
195207
.append(clusterName)
196208
.append("/scale");
197209

198-
TestUtils.makeOperatorPostRestCall(
199-
operatorNS, myOpRestApiUrl.toString(), myJsonObjStr, userProjectsDir);
210+
TestUtils.makeOperatorPostRestCall(this, myOpRestApiUrl.toString(), myJsonObjStr);
200211
// give sometime to complete
201212
logger.info("Wait 30 sec for scaling to complete...");
202213
Thread.sleep(30 * 1000);
@@ -217,7 +228,23 @@ public void verifyDomainExists(String domainUid) throws Exception {
217228
.append(externalRestHttpsPort)
218229
.append("/operator/latest/domains/")
219230
.append(domainUid);
220-
TestUtils.makeOperatorGetRestCall(operatorNS, myOpRestApiUrl.toString(), userProjectsDir);
231+
TestUtils.makeOperatorGetRestCall(this, myOpRestApiUrl.toString());
232+
}
233+
234+
/**
235+
* Verify the Operator's REST Api is working fine over TLS
236+
*
237+
* @throws Exception
238+
*/
239+
public void verifyOperatorExternalRESTEndpoint() throws Exception {
240+
// Operator REST external API URL to scale
241+
StringBuffer myOpRestApiUrl =
242+
new StringBuffer("https://")
243+
.append(TestUtils.getHostName())
244+
.append(":")
245+
.append(externalRestHttpsPort)
246+
.append("/operator/");
247+
TestUtils.makeOperatorGetRestCall(this, myOpRestApiUrl.toString());
221248
}
222249

223250
public Map<String, Object> getOperatorMap() {
@@ -258,23 +285,28 @@ private String getExecFailure(String cmd, ExecResult result) throws Exception {
258285
}
259286

260287
private void generateInputYaml() throws Exception {
261-
generateInputYaml(false);
262-
}
263-
264-
private void generateInputYaml(boolean useLegacyRESTIdentity) throws Exception {
265288
Path parentDir =
266289
Files.createDirectories(Paths.get(userProjectsDir + "/weblogic-operators/" + operatorNS));
267290
generatedInputYamlFile = parentDir + "/weblogic-operator-values.yaml";
268291
TestUtils.createInputFile(operatorMap, generatedInputYamlFile);
269292
StringBuilder sb = new StringBuilder(200);
270293
sb.append(BaseTest.getProjectRoot());
271-
if (useLegacyRESTIdentity) {
272-
sb.append(
273-
"/integration-tests/src/test/resources/scripts/legacy-generate-external-rest-identity.sh ");
274-
} else {
275-
sb.append("/kubernetes/samples/scripts/rest/generate-external-rest-identity.sh ");
276-
sb.append(" -n ");
277-
sb.append(operatorNS);
294+
switch (restCertType) {
295+
case LEGACY:
296+
sb.append(
297+
"/integration-tests/src/test/resources/scripts/legacy-generate-external-rest-identity.sh ");
298+
break;
299+
case CHAIN:
300+
sb.append(
301+
"/integration-tests/src/test/resources/scripts/generate-external-rest-identity-chain.sh ");
302+
sb.append(" -n ");
303+
sb.append(operatorNS);
304+
break;
305+
case SELF_SIGNED:
306+
sb.append("/kubernetes/samples/scripts/rest/generate-external-rest-identity.sh ");
307+
sb.append(" -n ");
308+
sb.append(operatorNS);
309+
break;
278310
}
279311
sb.append(" DNS:");
280312
sb.append(TestUtils.getHostName());
@@ -395,4 +427,16 @@ private void initialize(String yamlFile) throws Exception {
395427
operatorNS);
396428
}
397429
}
430+
431+
public String getOperatorNamespace() {
432+
return operatorNS;
433+
}
434+
435+
public String getUserProjectsDir() {
436+
return userProjectsDir;
437+
}
438+
439+
public RESTCertType getRestCertType() {
440+
return restCertType;
441+
}
398442
}

integration-tests/src/test/java/oracle/kubernetes/operator/utils/PEMImporter.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import java.security.KeyStoreException;
1515
import java.security.NoSuchAlgorithmException;
1616
import java.security.PrivateKey;
17+
import java.security.cert.Certificate;
1718
import java.security.cert.CertificateException;
1819
import java.security.cert.CertificateFactory;
1920
import java.security.cert.X509Certificate;
@@ -34,12 +35,11 @@ public class PEMImporter {
3435
* @param certificatePem the certificate(s) PEM file
3536
* @param the password to set to protect the private key
3637
*/
37-
public static KeyStore createKeyStore(
38-
File privateKeyPem, File certificatePem, final String password)
38+
public static KeyStore createKeyStore(File certificatePem, final String password)
3939
throws Exception, KeyStoreException, IOException, NoSuchAlgorithmException,
4040
CertificateException {
4141
// Import certificate pem file
42-
final X509Certificate[] cert = createCertificates(certificatePem);
42+
final X509Certificate[] certChain = createCertificates(certificatePem);
4343

4444
// Create a Keystore obj if the type "JKS"
4545
final KeyStore keystore = KeyStore.getInstance(KeyStore.getDefaultType());
@@ -48,10 +48,13 @@ public static KeyStore createKeyStore(
4848
keystore.load(null);
4949

5050
// Import private key
51-
final PrivateKey key = createPrivateKey(privateKeyPem);
51+
// final PrivateKey key = createPrivateKey(privateKeyPem);
5252

5353
// Load cert and key files into the Keystore obj and create it
54-
keystore.setKeyEntry(privateKeyPem.getName(), key, password.toCharArray(), cert);
54+
// keystore.setKeyEntry(privateKeyPem.getName(), key, password.toCharArray(), cert);
55+
for (Certificate cert : certChain) {
56+
keystore.setCertificateEntry("operator", cert);
57+
}
5558

5659
return keystore;
5760
}

0 commit comments

Comments
 (0)