Skip to content

Commit 1e20a7a

Browse files
committed
merge from develop
2 parents 85cab62 + 26aeef7 commit 1e20a7a

File tree

135 files changed

+1279
-701
lines changed

Some content is hidden

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

135 files changed

+1279
-701
lines changed

docs/domains/Domain.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@
177177
]
178178
},
179179
"image": {
180-
"description": "The Weblogic Docker image; required when domainHomeInImage is true; otherwise, defaults to store/oracle/weblogic:12.2.1.3.",
180+
"description": "The WebLogic Docker image; required when domainHomeInImage is true; otherwise, defaults to store/oracle/weblogic:12.2.1.3.",
181181
"type": "string"
182182
},
183183
"imagePullPolicy": {
@@ -239,7 +239,7 @@
239239
"$ref": "#/definitions/KubernetesResource"
240240
},
241241
"domainHome": {
242-
"description": "The folder for the Weblogic Domain. Not required. Defaults to /shared/domains/domains/domainUID if domainHomeInImage is false Defaults to /u01/oracle/user_projects/domains/ if domainHomeInImage is true",
242+
"description": "The folder for the WebLogic Domain. Not required. Defaults to /shared/domains/domains/domainUID if domainHomeInImage is false Defaults to /u01/oracle/user_projects/domains/ if domainHomeInImage is true",
243243
"type": "string"
244244
},
245245
"logHomeEnabled": {

docs/domains/Domain.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ DomainSpec is a description of a domain.
2020
| clusters | array of [Cluster](#cluster) | Configuration for the clusters. |
2121
| configOverrides | string | The name of the config map for optional WebLogic configuration overrides. |
2222
| configOverrideSecrets | array of string | A list of names of the secrets for optional WebLogic configuration overrides. |
23-
| domainHome | string | The folder for the Weblogic Domain. Not required. Defaults to /shared/domains/domains/domainUID if domainHomeInImage is false Defaults to /u01/oracle/user_projects/domains/ if domainHomeInImage is true |
23+
| domainHome | string | The folder for the WebLogic Domain. Not required. Defaults to /shared/domains/domains/domainUID if domainHomeInImage is false Defaults to /u01/oracle/user_projects/domains/ if domainHomeInImage is true |
2424
| domainHomeInImage | boolean | True if this domain's home is defined in the docker image for the domain. Defaults to true. |
2525
| domainUID | string | Domain unique identifier. Must be unique across the Kubernetes cluster. Not required. Defaults to the value of metadata.name |
26-
| image | string | The Weblogic Docker image; required when domainHomeInImage is true; otherwise, defaults to store/oracle/weblogic:12.2.1.3. |
26+
| image | string | The WebLogic Docker image; required when domainHomeInImage is true; otherwise, defaults to store/oracle/weblogic:12.2.1.3. |
2727
| imagePullPolicy | string | The image pull policy for the WebLogic Docker image. Legal values are Always, Never and IfNotPresent. Defaults to Always if image ends in :latest, IfNotPresent otherwise. |
2828
| imagePullSecrets | array of [Local Object Reference](k8s1.9.0.md#local-object-reference) | A list of image pull secrets for the WebLogic Docker image. |
2929
| includeServerOutInPodLog | boolean | If true (the default), the server .out file will be included in the pod's stdout. |

docs/domains/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,7 +1097,7 @@
10971097
]
10981098
},
10991099
"image": {
1100-
"description": "The Weblogic Docker image; required when domainHomeInImage is true; otherwise, defaults to store/oracle/weblogic:12.2.1.3.",
1100+
"description": "The WebLogic Docker image; required when domainHomeInImage is true; otherwise, defaults to store/oracle/weblogic:12.2.1.3.",
11011101
"type": "string"
11021102
},
11031103
"imagePullPolicy": {
@@ -1159,7 +1159,7 @@
11591159
"$ref": "#/definitions/KubernetesResource"
11601160
},
11611161
"domainHome": {
1162-
"description": "The folder for the Weblogic Domain. Not required. Defaults to /shared/domains/domains/domainUID if domainHomeInImage is false Defaults to /u01/oracle/user_projects/domains/ if domainHomeInImage is true",
1162+
"description": "The folder for the WebLogic Domain. Not required. Defaults to /shared/domains/domains/domainUID if domainHomeInImage is false Defaults to /u01/oracle/user_projects/domains/ if domainHomeInImage is true",
11631163
"type": "string"
11641164
},
11651165
"logHomeEnabled": {

integration-tests/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ The tests accepts optional env var overrides:
204204
| RESULT_ROOT | The root directory to use for the tests temporary files. See "Directory Configuration and Structure" for defaults and a detailed description of test directories. |
205205
| PV_ROOT | The root directory on the kubernetes cluster used for persistent volumes. See "Directory Configuration and Structure" for defaults and a detailed description of test directories. |
206206
| QUICKTEST | When set to "true", limits testing to a subset of the tests. |
207+
| INGRESSPERDOMAIN | The defult value is true. If you want to test creating LB by kubectl yaml for multiple domains, set it to false. |
207208
| WERCKER | Set to true if invoking from Wercker, set to false or "" if running stand-alone or from Jenkins. Default is "". |
208209
| JENKINS | Set to true if invoking from Jenkins, set to false or "" if running stand-alone or from Wercker. Default is "". |
209210
| NODEPORT_HOST | DNS name of a Kubernetes worker node. Default is the local host's hostname. |

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,12 @@ public class ITOperator extends BaseTest {
5454
private static boolean QUICKTEST;
5555
private static boolean SMOKETEST;
5656
private static boolean JENKINS;
57+
private static boolean INGRESSPERDOMAIN = true;
5758

5859
// Set QUICKTEST env var to true to run a small subset of tests.
5960
// Set SMOKETEST env var to true to run an even smaller subset
6061
// of tests, plus leave domain1 up and running when the test completes.
62+
// set INGRESSPERDOMAIN to false to create LB's ingress by kubectl yaml file
6163
static {
6264
QUICKTEST =
6365
System.getenv("QUICKTEST") != null && System.getenv("QUICKTEST").equalsIgnoreCase("true");
@@ -67,6 +69,9 @@ public class ITOperator extends BaseTest {
6769
if (System.getenv("JENKINS") != null) {
6870
JENKINS = new Boolean(System.getenv("JENKINS")).booleanValue();
6971
}
72+
if (System.getenv("INGRESSPERDOMAIN") != null) {
73+
INGRESSPERDOMAIN = new Boolean(System.getenv("INGRESSPERDOMAIN")).booleanValue();
74+
}
7075
}
7176

7277
/**
@@ -231,6 +236,12 @@ public void testTwoDomainsManagedByTwoOperators() throws Exception {
231236
wlstDomainMap.put("domainUID", "domain1onpvwlst");
232237
wlstDomainMap.put("adminNodePort", new Integer("30702"));
233238
wlstDomainMap.put("t3ChannelPort", new Integer("30031"));
239+
if (!INGRESSPERDOMAIN) {
240+
wlstDomainMap.put("ingressPerDomain", new Boolean("false"));
241+
logger.info(
242+
"domain1onpvwlst ingressPerDomain is set to: "
243+
+ ((Boolean) wlstDomainMap.get("ingressPerDomain")).booleanValue());
244+
}
234245
domain1 = TestUtils.createDomain(wlstDomainMap);
235246
domain1.verifyDomainCreated();
236247
testBasicUseCases(domain1);
@@ -246,6 +257,12 @@ public void testTwoDomainsManagedByTwoOperators() throws Exception {
246257
wdtDomainMap.put("adminNodePort", new Integer("30703"));
247258
wdtDomainMap.put("t3ChannelPort", new Integer("30041"));
248259
// wdtDomainMap.put("clusterType", "Configured");
260+
if (!INGRESSPERDOMAIN) {
261+
wdtDomainMap.put("ingressPerDomain", new Boolean("false"));
262+
logger.info(
263+
"domain2onpvwdt ingressPerDomain is set to: "
264+
+ ((Boolean) wdtDomainMap.get("ingressPerDomain")).booleanValue());
265+
}
249266
domain2 = TestUtils.createDomain(wdtDomainMap);
250267
domain2.verifyDomainCreated();
251268
testBasicUseCases(domain2);

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

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public class Domain {
5555
private int loadBalancerWebPort = 30305;
5656
private String userProjectsDir = "";
5757
private String projectRoot = "";
58+
private boolean ingressPerDomain = false;
5859

5960
private String createDomainScript = "";
6061
private String inputTemplateFile = "";
@@ -803,14 +804,29 @@ private void callCreateDomainScript(String outputDir) throws Exception {
803804

804805
private void createLoadBalancer() throws Exception {
805806
Map<String, Object> lbMap = new HashMap<String, Object>();
806-
lbMap.put("name", "traefik-hostrouting-" + domainUid);
807807
lbMap.put("domainUID", domainUid);
808808
lbMap.put("namespace", domainNS);
809809
lbMap.put("host", domainUid + ".org");
810810
lbMap.put("serviceName", domainUid + "-cluster-" + domainMap.get("clusterName"));
811811
lbMap.put("loadBalancer", domainMap.getOrDefault("loadBalancer", loadBalancer));
812+
lbMap.put("ingressPerDomain", domainMap.getOrDefault("ingressPerDomain", ingressPerDomain));
813+
lbMap.put("clusterName", domainMap.get("clusterName"));
812814

813815
loadBalancer = (String) lbMap.get("loadBalancer");
816+
ingressPerDomain = ((Boolean) lbMap.get("ingressPerDomain")).booleanValue();
817+
logger.info(
818+
"For this domain loadBalancer is: "
819+
+ loadBalancer
820+
+ " ingressPerDomain is: "
821+
+ ingressPerDomain);
822+
823+
if (loadBalancer.equals("TRAEFIK") && !ingressPerDomain) {
824+
lbMap.put("name", "traefik-hostrouting-" + domainUid);
825+
}
826+
827+
if (loadBalancer.equals("TRAEFIK") && ingressPerDomain) {
828+
lbMap.put("name", "traefik-ingress-" + domainUid);
829+
}
814830

815831
if (loadBalancer.equals("APACHE")) {
816832
/* lbMap.put("loadBalancerAppPrepath", "/weblogic");

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

Lines changed: 78 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,14 @@ public LoadBalancer(Map lbMap) throws Exception {
3333
if (result.exitValue() != 0) {
3434
createTraefikLoadBalancer();
3535
}
36-
createTraefikHostRouting();
36+
37+
if (!((Boolean) lbMap.get("ingressPerDomain")).booleanValue()) {
38+
logger.info("Is going to createTraefikHostRouting");
39+
createTraefikHostRouting();
40+
} else {
41+
logger.info("Is going to createTraefikIngressPerDomain");
42+
createTraefikIngressPerDomain();
43+
}
3744
}
3845
}
3946

@@ -84,6 +91,76 @@ public void createTraefikHostRouting() throws Exception {
8491
}
8592
}
8693

94+
private void createTraefikIngressPerDomain() throws Exception {
95+
upgradeTraefikNamespace();
96+
createTraefikIngress();
97+
}
98+
99+
private void upgradeTraefikNamespace() throws Exception {
100+
101+
StringBuffer cmd = new StringBuffer("helm upgrade ");
102+
cmd.append("--reuse-values ")
103+
.append("--set ")
104+
.append("\"")
105+
.append("kubernetes.namespaces={traefik,")
106+
.append(lbMap.get("namespace"))
107+
.append("}")
108+
.append("\"")
109+
.append(" traefik-operator")
110+
.append(" stable/traefik ");
111+
112+
logger.info(" upgradeTraefikNamespace() Running " + cmd.toString());
113+
ExecResult result = ExecCommand.exec(cmd.toString());
114+
if (result.exitValue() != 0) {
115+
reportHelmInstallFailure(cmd.toString(), result);
116+
}
117+
String outputStr = result.stdout().trim();
118+
logger.info("Command returned " + outputStr);
119+
}
120+
121+
private void createTraefikIngress() throws Exception {
122+
123+
String chartDir = BaseTest.getProjectRoot() + "/integration-tests/src/test/resources/charts";
124+
125+
StringBuffer cmd = new StringBuffer("cd ");
126+
cmd.append(chartDir).append(" && helm install ingress-per-domain ");
127+
cmd.append(" --name ")
128+
.append(lbMap.get("name"))
129+
.append(" --namespace ")
130+
.append(lbMap.get("namespace"))
131+
.append(" --set ")
132+
.append("wlsDomain.domainUID=")
133+
.append(lbMap.get("domainUID"))
134+
.append(" --set ")
135+
.append("wlsDomain.clusterName=")
136+
.append(lbMap.get("clusterName"))
137+
.append(" --set ")
138+
.append("traefik.hostname=")
139+
.append(lbMap.get("domainUID"))
140+
.append(".org");
141+
142+
logger.info("createTraefikIngress() Running " + cmd.toString());
143+
ExecResult result = ExecCommand.exec(cmd.toString());
144+
if (result.exitValue() != 0) {
145+
reportHelmInstallFailure(cmd.toString(), result);
146+
}
147+
String outputStr = result.stdout().trim();
148+
logger.info("Command returned " + outputStr);
149+
}
150+
151+
private void reportHelmInstallFailure(String cmd, ExecResult result) throws Exception {
152+
throw new RuntimeException(getExecFailure(cmd, result));
153+
}
154+
155+
private String getExecFailure(String cmd, ExecResult result) throws Exception {
156+
return "FAILURE: command "
157+
+ cmd
158+
+ " failed, stdout:\n"
159+
+ result.stdout()
160+
+ "stderr:\n"
161+
+ result.stderr();
162+
}
163+
87164
public Map<String, Object> getLBMap() {
88165
return lbMap;
89166
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Copyright 2018, Oracle Corporation and/or its affiliates. All rights reserved.
2+
# Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
3+
4+
apiVersion: v1
5+
appVersion: "1.0"
6+
description: A Helm chart to create an Ingress for a WLS domain.
7+
name: ingress-per-domain
8+
version: 0.1.0
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Copyright 2018, 2019, Oracle Corporation and/or its affiliates. All rights reserved.
2+
# Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
3+
4+
{{- if eq .Values.type "TRAEFIK" }}
5+
---
6+
apiVersion: extensions/v1beta1
7+
kind: Ingress
8+
metadata:
9+
name: {{ .Values.wlsDomain.domainUID }}-traefik
10+
namespace: {{ .Release.Namespace }}
11+
labels:
12+
weblogic.resourceVersion: domain-v2
13+
spec:
14+
annotations:
15+
kubernetes.io/ingress.class: traefik
16+
rules:
17+
- host: '{{ .Values.traefik.hostname }}'
18+
http:
19+
paths:
20+
- path:
21+
backend:
22+
serviceName: '{{ .Values.wlsDomain.domainUID }}-cluster-{{ .Values.wlsDomain.clusterName | lower | replace "_" "-" }}'
23+
servicePort: {{ .Values.wlsDomain.managedServerPort }}
24+
{{- end }}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Copyright 2018, 2019, Oracle Corporation and/or its affiliates. All rights reserved.
2+
# Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
3+
4+
{{- if eq .Values.type "VOYAGER" }}
5+
---
6+
apiVersion: voyager.appscode.com/v1beta1
7+
kind: Ingress
8+
metadata:
9+
name: {{ .Values.wlsDomain.domainUID }}-voyager
10+
namespace: {{ .Release.Namespace }}
11+
labels:
12+
weblogic.resourceVersion: domain-v2
13+
annotations:
14+
ingress.appscode.com/type: 'NodePort'
15+
ingress.appscode.com/stats: 'true'
16+
ingress.appscode.com/affinity: 'cookie'
17+
spec:
18+
rules:
19+
- host: '*'
20+
http:
21+
nodePort: '{{ .Values.voyager.webPort }}'
22+
paths:
23+
- backend:
24+
serviceName: '{{ .Values.wlsDomain.domainUID }}-cluster-{{ .Values.wlsDomain.clusterName | lower | replace "_" "-" }}'
25+
servicePort: '{{ .Values.wlsDomain.managedServerPort }}'
26+
27+
---
28+
apiVersion: v1
29+
kind: Service
30+
metadata:
31+
name: {{ .Values.wlsDomain.domainUID }}-voyager-stats
32+
namespace: {{ .Release.Namespace }}
33+
labels:
34+
weblogic.resourceVersion: domain-v2
35+
spec:
36+
type: NodePort
37+
ports:
38+
- name: client
39+
protocol: TCP
40+
port: 56789
41+
targetPort: 56789
42+
nodePort: {{ .Values.voyager.statsPort }}
43+
selector:
44+
origin: voyager
45+
origin-name: {{ .Values.wlsDomain.domainUID }}-voyager
46+
{{- end }}

0 commit comments

Comments
 (0)