Skip to content

Commit 233c534

Browse files
committed
Merge branch 'develop' of https://github.com/oracle/weblogic-kubernetes-operator into optimize-sitconfig-tests
2 parents 483120b + 6e101d9 commit 233c534

File tree

17 files changed

+189
-34
lines changed

17 files changed

+189
-34
lines changed

kubernetes/samples/scripts/common/domain-template.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ spec:
4646
- name: JAVA_OPTIONS
4747
value: "%JAVA_OPTIONS%"
4848
- name: USER_MEM_ARGS
49-
value: "-Xms64m -Xmx256m "
49+
value: "-Djava.security.egd=file:/dev/./urandom -Xms64m -Xmx256m "
5050
%LOG_HOME_ON_PV_PREFIX%volumes:
5151
%LOG_HOME_ON_PV_PREFIX%- name: weblogic-domain-storage-volume
5252
%LOG_HOME_ON_PV_PREFIX% persistentVolumeClaim:

kubernetes/samples/scripts/create-weblogic-domain/domain-home-in-image/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# WebLogic sample domain home in Docker image
22

3-
The sample scripts demonstrate the creation of a WebLogic domain home in a Docker image using one of the domain home in image samples in the [WebLogic Server Domain Docker image samples GitHub project](https://github.com/oracle/docker-images/tree/master/OracleWebLogic/samples). The sample scripts have an option of putting the WebLogic domain log, server logs, server output files, and the node manager logs on an existing Kubernetes persistent volume (PV) and persistent volume claim (PVC). The scripts also generate the domain YAML file, which can then be used by the scripts or manually to start the Kubernetes artifacts of the corresponding domain, including the WebLogic Server pods and services.
3+
The sample scripts demonstrate the creation of a WebLogic domain home in a Docker image using one of the domain home in image samples in the [WebLogic Server Domain Docker image samples GitHub project](https://github.com/oracle/docker-images/tree/master/OracleWebLogic/samples). The sample scripts have an option of putting the WebLogic domain log, server logs, server output files, and the Node Manager logs on an existing Kubernetes persistent volume (PV) and persistent volume claim (PVC). The scripts also generate the domain YAML file, which can then be used by the scripts or used manually to start the Kubernetes artifacts of the corresponding domain, including the WebLogic Server pods and services.
44

55
## Prerequisites
66

77
Before you begin, read this guide, [Domain Resource](../../../../../site/domain-resource.md).
88

99
The following prerequisites must be handled prior to running the create domain script:
1010
* The WDT sample requires that `JAVA_HOME` is set to a Java JDK version 1.8 or later.
11-
* The operator requires WebLogic Server 12.2.1.3.0 with patch 29135930 applied. The existing WebLogic Docker image, `store/oracle/weblogic:12.2.1.3`, was updated on January 17, 2019, and has all the necessary patches applied; a `docker pull` is required if you already have this image. Refer to [WebLogic Docker images](../../../../../site/weblogic-docker-images.md) for details on how to obtain or create the image.
11+
* The operator requires WebLogic Server 12.2.1.3.0 with patch 29135930 applied. The existing WebLogic Docker image, `store/oracle/weblogic:12.2.1.3`, was updated on January 17, 2019, and has all the necessary patches applied; a `docker pull` is required if you pulled the image prior to that date. Refer to [WebLogic Docker images](../../../../../site/weblogic-docker-images.md) for details on how to obtain or create the image.
1212
* Create a Kubernetes namespace for the domain unless the intention is to use the default namespace.
13-
* If logHomeOnPV is enabled, create the Kubernetes persistent volume where the log home will be hosted, and the Kubernetes persistent volume claim for the domain in the same Kubernates namespace. For samples to create a PV and PVC, see [Create sample PV and PVC](../../create-weblogic-domain-pv-pvc/README.md).
13+
* If `logHomeOnPV` is enabled, create the Kubernetes persistent volume where the log home will be hosted, and the Kubernetes persistent volume claim for the domain in the same Kubernates namespace. For samples to create a PV and PVC, see [Create sample PV and PVC](../../create-weblogic-domain-pv-pvc/README.md).
1414
* Create a Kubernetes secret for the WebLogic administrator credentials that contains the fields `username` and `password`, and make sure that the secret name matches the value specified for `weblogicCredentialsSecretName` (see Configuration table below). For example:
1515

1616
```
@@ -108,7 +108,7 @@ The following parameters can be provided in the inputs file.
108108
| `adminServerName` | Name of the Administration Server. | `admin-server` |
109109
| `clusterName` | Name of the WebLogic cluster instance to generate for the domain. | `cluster-1` |
110110
| `configuredManagedServerCount` | Number of Managed Server instances to generate for the domain. | `5` |
111-
| `domainHomeImageBase` | Base WebLogic binary image used to build the WebLogic domain image. The operator requires WebLogic Server 12.2.1.3.0 with patch 29135930 applied. The existing WebLogic Docker image, `store/oracle/weblogic:12.2.1.3`, was updated on January 17, 2019, and has all the necessary patches applied; a `docker pull` is required if you already have this image. Refer to [WebLogic Docker images](../../../../../site/weblogic-docker-images.md) for details on how to obtain or create the image. | `store/oracle/weblogic:12.2.1.3` |
111+
| `domainHomeImageBase` | Base WebLogic binary image used to build the WebLogic domain image. The operator requires WebLogic Server 12.2.1.3.0 with patch 29135930 applied. The existing WebLogic Docker image, `store/oracle/weblogic:12.2.1.3`, was updated on January 17, 2019, and has all the necessary patches applied; a `docker pull` is required if you pulled the image prior to that date. Refer to [WebLogic Docker images](../../../../../site/weblogic-docker-images.md) for details on how to obtain or create the image. | `store/oracle/weblogic:12.2.1.3` |
112112
| `domainHomeImageBuildPath` | Location of the WebLogic "domain home in image" Docker image in `https://github.com/oracle/docker-images.git` project. If not specified, use "./docker-images/OracleWebLogic/samples/12213-domain-home-in-image". Another possible value is "./docker-images/OracleWebLogic/samples/12213-domain-home-in-image-wdt" which uses WDT, instead of WLST, to generate the domain configuration. | `./docker-images/OracleWebLogic/samples/12213-domain-home-in-image` |
113113
| `domainPVMountPath` | Mount path of the domain persistent volume. This parameter is required if `logHomeOnPV` is true. Otherwise, it is ignored. | `/shared` |
114114
| `domainUID` | Unique ID that will be used to identify this particular domain. Used as the name of the generated WebLogic domain as well as the name of the Kubernetes domain resource. This ID must be unique across all domains in a Kubernetes cluster. This ID cannot contain any character that is not valid in a Kubernetes service name. | `domain1` |
@@ -121,7 +121,7 @@ The following parameters can be provided in the inputs file.
121121
| `initialManagedServerReplicas` | Number of Managed Servers to initially start for the domain. | `2` |
122122
| `javaOptions` | Java options for starting the Administration and Managed Servers. A Java option can have references to one or more of the following pre-defined variables to obtain WebLogic domain information: `$(DOMAIN_NAME)`, `$(DOMAIN_HOME)`, `$(ADMIN_NAME)`, `$(ADMIN_PORT)`, and `$(SERVER_NAME)`. | `-Dweblogic.StdoutDebugEnabled=false` |
123123
| `logHomeOnPV` | Specifies whether the log home is stored on the persistent volume. If set to true, then you must specify the `logHome`, `persistentVolumeClaimName` and `domainPVMountPath` parameters.| `false` |
124-
| `logHome` | The in-pod location for domain log, server logs, server out, and node manager log files. If not specified, the value is derived from the `domainUID` as `/shared/logs/<domainUID>`. This parameter is required if `logHomeOnPV` is true. Otherwise, it is ignored. | `/shared/logs/domain1` |
124+
| `logHome` | The in-pod location for domain log, server logs, server out, and Node Manager log files. If not specified, the value is derived from the `domainUID` as `/shared/logs/<domainUID>`. This parameter is required if `logHomeOnPV` is true. Otherwise, it is ignored. | `/shared/logs/domain1` |
125125
| `managedServerNameBase` | Base string used to generate Managed Server names. | `managed-server` |
126126
| `managedServerPort` | Port number for each Managed Server. | `8001` |
127127
| `namespace` | Kubernetes namespace in which to create the domain. | `default` |
@@ -130,7 +130,7 @@ The following parameters can be provided in the inputs file.
130130
| `serverStartPolicy` | Determines which WebLogic Servers will be started up. Legal values are `NEVER`, `IF_NEEDED`, `ADMIN_ONLY`. | `IF_NEEDED` |
131131
| `t3ChannelPort` | Port for the T3 channel of the NetworkAccessPoint. | `30012` |
132132
| `t3PublicAddress` | Public address for the T3 channel. This should be set to the public address of the Kubernetes cluster. This would normally be a load balancer address. <p/>For development environments only: In a single server (all-in-one) Kubernetes deployment, this may be set to the address of the master, or at the very least, it must be set to the address of one of the worker nodes. | `kubernetes` |
133-
| `weblogicCredentialsSecretName` | Name of the Kubernetes secret for the Administration Server's username and password. | `domain1-weblogic-credentials` |
133+
| `weblogicCredentialsSecretName` | Name of the Kubernetes secret for the Administration Server's user name and password. | `domain1-weblogic-credentials` |
134134

135135
Note that the names of the Kubernetes resources in the generated YAML files may be formed with the value of some of the properties specified in the `create-inputs.yaml` file. Those properties include the `adminServerName`, `clusterName` and `managedServerNameBase`. If those values contain any characters that are invalid in a Kubernetes service name, those characters are converted to valid values in the generated YAML files. For example, an uppercase letter is converted to a lowercase letter and an underscore `("_")` is converted to a hyphen `("-")`.
136136

@@ -181,7 +181,7 @@ spec:
181181
includeServerOutInPodLog: true
182182
# Whether to enable log home
183183
# logHomeEnabled: false
184-
# The in-pod location for domain log, server logs, server out, and node manager log files
184+
# The in-pod location for domain log, server logs, server out, and Node Manager log files
185185
# logHome: /shared/logs/domain1
186186
# serverStartPolicy legal values are "NEVER", "IF_NEEDED", or "ADMIN_ONLY"
187187
# This determines which WebLogic Servers the operator will start up when it discovers this Domain
@@ -195,7 +195,7 @@ spec:
195195
- name: JAVA_OPTIONS
196196
value: "-Dweblogic.StdoutDebugEnabled=false"
197197
- name: USER_MEM_ARGS
198-
value: "-Xms64m -Xmx256m "
198+
value: "-Djava.security.egd=file:/dev/./urandom -Xms64m -Xmx256m "
199199
# volumes:
200200
# - name: weblogic-domain-storage-volume
201201
# persistentVolumeClaim:

kubernetes/samples/scripts/create-weblogic-domain/domain-home-on-pv/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Before you begin, read this guide, [Domain Resource](../../../../../site/domain-
88

99
The following prerequisites must be handled prior to running the create domain script:
1010
* Make sure the WebLogic operator is running.
11-
* The operator requires WebLogic Server 12.2.1.3.0 with patch 29135930 applied. The existing WebLogic Docker image, `store/oracle/weblogic:12.2.1.3`, was updated on January 17, 2019, and has all the necessary patches applied; a `docker pull` is required if you already have this image. Refer to [WebLogic Docker images](../../../../../site/weblogic-docker-images.md) for details on how to obtain or create the image.
11+
* The operator requires WebLogic Server 12.2.1.3.0 with patch 29135930 applied. The existing WebLogic Docker image, `store/oracle/weblogic:12.2.1.3`, was updated on January 17, 2019, and has all the necessary patches applied; a `docker pull` is required if you pulled the image prior to that date. Refer to [WebLogic Docker images](../../../../../site/weblogic-docker-images.md) for details on how to obtain or create the image.
1212
* Create a Kubernetes namespace for the domain unless the intention is to use the default namespace.
1313
* In the same Kubernetes namespace, create the Kubernetes persistent volume where the domain home will be hosted, and the Kubernetes persistent volume claim for the domain. For samples to create a PV and PVC, see [Create sample PV and PVC](../../create-weblogic-domain-pv-pvc/README.md).
1414
* Create the Kubernetes secrets `username` and `password` of the admin account in the same Kubernetes namespace as the domain.
@@ -82,13 +82,13 @@ The following parameters can be provided in the inputs file.
8282
| `domainUID` | Unique ID that will be used to identify this particular domain. Used as the name of the generated WebLogic domain as well as the name of the Kubernetes domain resource. This ID must be unique across all domains in a Kubernetes cluster. This ID cannot contain any character that is not valid in a Kubernetes service name. | `domain1` |
8383
| `exposeAdminNodePort` | Boolean indicating if the Administration Server is exposed outside of the Kubernetes cluster. | `false` |
8484
| `exposeAdminT3Channel` | Boolean indicating if the T3 administrative channel is exposed outside the Kubernetes cluster. | `false` |
85-
| `image` | WebLogic Docker image. The operator requires WebLogic Server 12.2.1.3.0 with patch 29135930 applied. The existing WebLogic Docker image, `store/oracle/weblogic:12.2.1.3`, was updated on January 17, 2019, and has all the necessary patches applied; a `docker pull` is required if you already have this image. Refer to [WebLogic Docker images](../../../../../site/weblogic-docker-images.md) for details on how to obtain or create the image. | `store/oracle/weblogic:12.2.1.3` |
86-
| `imagePullPolicy` | WebLogic Docker image pull policy. Legal values are "IfNotPresent", "Always", or "Never" | `IfNotPresent` |
85+
| `image` | WebLogic Docker image. The operator requires WebLogic Server 12.2.1.3.0 with patch 29135930 applied. The existing WebLogic Docker image, `store/oracle/weblogic:12.2.1.3`, was updated on January 17, 2019, and has all the necessary patches applied; a `docker pull` is required if you pulled the image prior to that date. Refer to [WebLogic Docker images](../../../../../site/weblogic-docker-images.md) for details on how to obtain or create the image. | `store/oracle/weblogic:12.2.1.3` |
86+
| `imagePullPolicy` | WebLogic Docker image pull policy. Legal values are `IfNotPresent`, `Always`, or `Never` | `IfNotPresent` |
8787
| `imagePullSecretName` | Name of the Kubernetes secret to access the Docker Store to pull the WebLogic Server Docker image. The presence of the secret will be validated when this parameter is specified | |
88-
| `includeServerOutInPodLog` | Boolean indicating whether to include server .out to the pod's stdout. | `true` |
88+
| `includeServerOutInPodLog` | Boolean indicating whether to include the server .out to the pod's stdout. | `true` |
8989
| `initialManagedServerReplicas` | Number of Managed Servers to initially start for the domain. | `2` |
9090
| `javaOptions` | Java options for starting the Administration and Managed Servers. A Java option can have references to one or more of the following pre-defined variables to obtain WebLogic domain information: `$(DOMAIN_NAME)`, `$(DOMAIN_HOME)`, `$(ADMIN_NAME)`, `$(ADMIN_PORT)`, and `$(SERVER_NAME)`. | `-Dweblogic.StdoutDebugEnabled=false` |
91-
| `logHome` | The in-pod location for domain log, server logs, server out, and node manager log files. If not specified, the value is derived from the `domainUID` as `/shared/logs/<domainUID>`. | `/shared/logs/domain1` |
91+
| `logHome` | The in-pod location for domain log, server logs, server out, and Node Manager log files. If not specified, the value is derived from the `domainUID` as `/shared/logs/<domainUID>`. | `/shared/logs/domain1` |
9292
| `managedServerNameBase` | Base string used to generate Managed Server names. | `managed-server` |
9393
| `managedServerPort` | Port number for each Managed Server. | `8001` |
9494
| `namespace` | Kubernetes namespace in which to create the domain. | `default` |
@@ -149,7 +149,7 @@ spec:
149149
includeServerOutInPodLog: true
150150
# Whether to enable log home
151151
logHomeEnabled: true
152-
# The in-pod name location for domain log, server logs, server out, and node manager log files
152+
# The in-pod name location for domain log, server logs, server out, and Node Manager log files
153153
logHome: /shared/logs/domain1
154154
# serverStartPolicy legal values are "NEVER", "IF_NEEDED", or "ADMIN_ONLY"
155155
# This determines which WebLogic Servers the operator will start up when it discovers this Domain
@@ -163,7 +163,7 @@ spec:
163163
- name: JAVA_OPTIONS
164164
value: "-Dweblogic.StdoutDebugEnabled=false"
165165
- name: USER_MEM_ARGS
166-
value: "-Xms64m -Xmx256m "
166+
value: "-Djava.security.egd=file:/dev/./urandom -Xms64m -Xmx256m "
167167
volumes:
168168
- name: weblogic-domain-storage-volume
169169
persistentVolumeClaim:

model/src/test/java/oracle/kubernetes/weblogic/domain/DomainTestBase.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,11 @@ public void whenDomainReadFromYaml_Server1OverridesDefaults() throws IOException
395395
assertThat(
396396
serverSpec.getEnvironmentVariables(),
397397
both(hasItem(envVar("JAVA_OPTIONS", "-server")))
398-
.and(hasItem(envVar("USER_MEM_ARGS", "-Xms64m -Xmx256m "))));
398+
.and(
399+
hasItem(
400+
envVar(
401+
"USER_MEM_ARGS",
402+
"-Djava.security.egd=file:/dev/./urandom -Xms64m -Xmx256m "))));
399403
assertThat(serverSpec.getDesiredState(), equalTo("RUNNING"));
400404
}
401405

model/src/test/java/oracle/kubernetes/weblogic/domain/v2/DomainV2Test.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ public void whenDomainReadFromYaml_server1OverridesDefaults() throws IOException
697697
serverSpec.getEnvironmentVariables(),
698698
containsInAnyOrder(
699699
envVar("JAVA_OPTIONS", "-server"),
700-
envVar("USER_MEM_ARGS", "-Xms64m -Xmx256m "),
700+
envVar("USER_MEM_ARGS", "-Djava.security.egd=file:/dev/./urandom -Xms64m -Xmx256m "),
701701
envVar("var1", "value0")));
702702
assertThat(serverSpec.getConfigOverrides(), equalTo("overrides-config-map"));
703703
assertThat(

model/src/test/resources/oracle/kubernetes/weblogic/domain/v2/domain-sample.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ spec:
7979
- name: JAVA_OPTIONS
8080
value: "-server"
8181
- name: USER_MEM_ARGS
82-
value: "-Xms64m -Xmx256m "
82+
value: "-Djava.security.egd=file:/dev/./urandom -Xms64m -Xmx256m "
8383
nodeSelector:
8484
os_arch: arm64
8585
resources:

operator/src/main/java/oracle/kubernetes/operator/helpers/JobStepContext.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ public abstract class JobStepContext extends StepContextBase {
3535

3636
private final DomainPresenceInfo info;
3737
private V1Job jobModel;
38-
final long DEFAULT_ACTIVE_DEADLINE_SECONDS = 120L;
39-
final long DEFAULT_ACTIVE_DEADLINE_INCREMENT_SECONDS = 60L;
38+
static final long DEFAULT_ACTIVE_DEADLINE_SECONDS = 120L;
39+
static final long DEFAULT_ACTIVE_DEADLINE_INCREMENT_SECONDS = 60L;
4040

4141
JobStepContext(Packet packet) {
4242
info = packet.getSPI(DomainPresenceInfo.class);
@@ -217,7 +217,7 @@ private V1PodTemplateSpec createPodTemplateSpec(TuningParameters tuningParameter
217217
private V1PodSpec createPodSpec(TuningParameters tuningParameters) {
218218
V1PodSpec podSpec =
219219
new V1PodSpec()
220-
.activeDeadlineSeconds(60L)
220+
.activeDeadlineSeconds(getActiveDeadlineSeconds())
221221
.restartPolicy("Never")
222222
.addContainersItem(createContainer(tuningParameters))
223223
.addVolumesItem(new V1Volume().name(SECRETS_VOLUME).secret(getSecretsVolume()))

operator/src/main/java/oracle/kubernetes/operator/helpers/StepContextBase.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ final List<V1EnvVar> getEnvironmentVariables(TuningParameters tuningParameters)
3737

3838
List<V1EnvVar> vars = getConfiguredEnvVars(tuningParameters);
3939

40+
addDefaultEnvVarIfMissing(vars, "USER_MEM_ARGS", "-Djava.security.egd=file:/dev/./urandom");
41+
4042
hideAdminUserCredentials(vars);
4143
doSubstitution(vars);
4244

@@ -63,6 +65,21 @@ protected void addEnvVar(List<V1EnvVar> vars, String name, String value) {
6365
vars.add(new V1EnvVar().name(name).value(value));
6466
}
6567

68+
protected boolean hasEnvVar(List<V1EnvVar> vars, String name) {
69+
for (V1EnvVar var : vars) {
70+
if (name.equals(var.getName())) {
71+
return true;
72+
}
73+
}
74+
return false;
75+
}
76+
77+
protected void addDefaultEnvVarIfMissing(List<V1EnvVar> vars, String name, String value) {
78+
if (!hasEnvVar(vars, name)) {
79+
addEnvVar(vars, name, value);
80+
}
81+
}
82+
6683
// Hide the admin account's user name and password.
6784
// Note: need to use null v.s. "" since if you upload a "" to kubectl then download it,
6885
// it comes back as a null and V1EnvVar.equals returns false even though it's supposed to

operator/src/main/resources/scripts/introspectDomain.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ ${SCRIPTPATH}/startNodeManager.sh || exit 1
8888

8989
trace "Running introspector WLST script ${SCRIPTPATH}/introspectDomain.py"
9090

91+
9192
${SCRIPTPATH}/wlst.sh ${SCRIPTPATH}/introspectDomain.py || exit 1
9293

9394
trace "Domain introspection complete"

0 commit comments

Comments
 (0)