Skip to content

Commit 076047a

Browse files
authored
Merge pull request #707 from oracle/domain-home-in-image-fixes
RC1 CANDIDATE: Domain home in image sample regression fixing, fine-tuning and cleanup
2 parents 774df34 + a70de6d commit 076047a

File tree

17 files changed

+73
-53
lines changed

17 files changed

+73
-53
lines changed

integration-tests/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<parent>
99
<groupId>oracle.kubernetes</groupId>
1010
<artifactId>operator-parent</artifactId>
11-
<version>2.0-rc1</version>
11+
<version>2.0-SNAPSHOT</version>
1212
</parent>
1313

1414
<artifactId>operator-integration-tests</artifactId>

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -942,6 +942,7 @@ private void initialize(String inputYaml) throws Exception {
942942
}
943943

944944
domainMap.put("domainHome", "/shared/domains/" + domainUid);
945+
domainMap.put("logHome", "/shared/logs/" + domainUid);
945946
domainMap.put(
946947
"createDomainFilesDir",
947948
BaseTest.getProjectRoot() + "/integration-tests/src/test/resources/domain-home-on-pv");

json-schema-maven-plugin/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>operator-parent</artifactId>
77
<groupId>oracle.kubernetes</groupId>
8-
<version>2.0-rc1</version>
8+
<version>2.0-SNAPSHOT</version>
99
</parent>
1010

1111
<artifactId>jsonschema-maven-plugin</artifactId>

json-schema/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<artifactId>operator-parent</artifactId>
77
<groupId>oracle.kubernetes</groupId>
8-
<version>2.0-rc1</version>
8+
<version>2.0-SNAPSHOT</version>
99
</parent>
1010
<modelVersion>4.0.0</modelVersion>
1111

kubernetes/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<parent>
99
<groupId>oracle.kubernetes</groupId>
1010
<artifactId>operator-parent</artifactId>
11-
<version>2.0-rc1</version>
11+
<version>2.0-SNAPSHOT</version>
1212
</parent>
1313

1414
<artifactId>installation-tests</artifactId>

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

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ The sample scripts demonstrate the creation of a WebLogic domain home in a Docke
55
## Prerequisites
66

77
The following prerequisites must be handled prior to running the create domain script:
8+
* The WDT sample requires that JAVA_HOME is set to a java JDK version 1.8 or greater
89
* Make sure the WebLogic operator is running.
9-
* The operator requires WebLogic Server 12.2.1.3.0 with patch 28076014 applied. Refer to [Weblogic docker images](../../../../../site/weblogic-docker-images.md) for details on how to create one.
10+
* The operator requires WebLogic Server 12.2.1.3.0 with patch 28076014 applied. Refer to [Weblogic Docker images](../../../../../site/weblogic-docker-images.md) for details on how to create one. If a different `domainHomeImageBase` (see Configuration table below) is specified, the specified image needs to be built locally or pulled from a repository.
1011
* Create a Kubernetes namespace for the domain unless the intention is to use the default namespace.
1112
* Create the Kubernetes secrets `username` and `password` of the admin account in the same Kubernetes namespace as the domain.
12-
* Build the Oracle WebLogic image `oracle/weblogic:12.2.1.3-developer`. Refer to [Oracle WebLogic Server on Docker](https://github.com/oracle/docker-images/tree/master/OracleWebLogic/dockerfiles/12.2.1.3). If a different `baseImage` (see Configuration table below) is specified, the specified image needs to be built locally or pulled from a repository.
1313

1414
## Use the script to create a domain
1515

@@ -31,8 +31,13 @@ The script will perform the following steps:
3131
* Replace the built-in user name and password in the `properties/docker-build/domain_security.properties` file with the `username` and `password` that are supplied on the command line using the `-u` and `-p` options. These credentials need to match the WebLogic domain admin credentials in the secret that is specified via the `weblogicCredentialsSecretName` property in the `create-domain-inputs.yaml` file.
3232
* Build a Docker image based on the Docker sample, [Example Image with a WebLogic Server Domain using the Oracle WebLogic Deploy Tooling (WDT)](https://github.com/oracle/docker-images/tree/master/OracleWebLogic/samples/12213-domain-home-in-image-wdt) and [Example Image with a WebLogic Server Domain using WLST](https://github.com/oracle/docker-images/tree/master/OracleWebLogic/samples/12213-domain-home-in-image). It will create a sample WebLogic Server domain in the Docker image. Also, you can run the Docker sample, [Example Image with a WebLogic Server Domain](https://github.com/oracle/docker-images/tree/master/OracleWebLogic/samples/12213-domain-home-in-image), manually with the generated `domain.properties` to create a domain home image. **Note**: Oracle recommends keeping the domain home image private in the local repository.
3333
* Create a Kubernetes domain YAML file, `domain.yaml`, in the directory that is created above. This YAML file can be used to create the Kubernetes resource using the `kubectl create -f` or `kubectl apply -f` command.
34+
```
35+
kubectl apply -f /path/to/output-directory/weblogic-domains/<domainUID>/domain.yaml
36+
```
37+
38+
As a convenience, using the `-e` option, the script can optionally create the domain object, which in turn results in the creation of the corresponding WebLogic Server pods and services. This option should only be used in a single node Kubernetes cluster.
3439

35-
As a convenience, using the `-e` option, the script can optionally create the domain object, which in turn results in the creation of the corresponding WebLogic Server pods and services.
40+
For a multi-node Kubernetes cluster, make sure that the generated image is available on all nodes before creating the domain resource using the kubectl apply -f command.
3641

3742
The usage of the create script is as follows:
3843

@@ -71,15 +76,15 @@ The following parameters can be provided in the inputs file.
7176
| `adminPort` | Port number for the Administration Server inside the Kubernetes cluster. | `7001` |
7277
| `adminNodePort` | Port number of the Administration Server outside the Kubernetes cluster. | `30701` |
7378
| `adminServerName` | Name of the Administration Server. | `admin-server` |
74-
| `baseImage` | The image that is used to build the domain-home-in-image Docker image. If not specified, use the built-in base image `oracle/weblogic:12.2.1.3-developer`. The image specified here needs to be built locally or pulled from a repository before the `create-domain.sh` script is executed. | `oracle/weblogic:12.2.1.3-developer` |
7579
| `clusterName` | Name of the WebLogic cluster instance to generate for the domain. | `cluster-1` |
7680
| `clusterType` | Type of the WebLogic Cluster. Legal values are `CONFIGURED` or `DYNAMIC`. | `DYNAMIC` |
77-
| `configuredManagedServerCount` | Number of Managed Server instances to generate for the domain. | `2` |
81+
| `configuredManagedServerCount` | Number of Managed Server instances to generate for the domain. | `5` |
82+
| `domainHomeImageBase` | Base WebLogic binary image used to build the WebLogic domain image. The operator requires WebLogic Server 12.2.1.3.0 with patch 28076014 applied. Refer to [Weblogic Docker images](../../../../../site/weblogic-docker-images.md) for details on how to create one. If a different `domainHomeImageBase` (see Configuration table below) is specified, the specified image needs to be built locally or pulled from a repository before the `create-domain.sh` script is executed. | |
83+
| `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-wdt". Another possible value is "./docker-images/OracleWebLogic/samples/12213-domain-home-in-image" which uses WLST scripts, instead of WDT, to generate the domain configuration. | `./docker-images/OracleWebLogic/samples/12213-domain-home-in-image-wdt` |
7884
| `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` |
7985
| `exposeAdminNodePort` | Boolean indicating if the Administration Server is exposed outside of the Kubernetes cluster. | `false` |
8086
| `exposeAdminT3Channel` | Boolean indicating if the T3 administrative channel is exposed outside the Kubernetes cluster. | `false` |
81-
| `image` | WebLogic Docker image that the domain resource will use. If not specified, the value is the name of the generated Docker image. | `12213-domain-home-in-image-wdt` |
82-
| `imagePath` | The relative directory of the WebLogic domain home in image Docker image in `https://github.com/oracle/docker-images.git` project under the `docker-images/OracleWebLogic/samples` directory. | `12213-domain-home-in-image-wdt` |
87+
| `image` | WebLogic Docker image that the domain resource will pull if needed. You only need to specify this if you are going to push the generated image from the local Docker repository to another Docker repository. If not specified, the sample uses the internally generated image name, either "domain-home-in-image:latest" or "domain-home-in-image-wdt:latest". | |
8388
| `imagePullPolicy` | WebLogic Docker image pull policy. Legal values are "IfNotPresent", "Always", or "Never" | `IfNotPresent` |
8489
| `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 | |
8590
| `includeServerOutInPodLog` | Boolean indicating whether to include server .out to the pod's stdout. | `true` |
@@ -89,7 +94,7 @@ The following parameters can be provided in the inputs file.
8994
| `managedServerPort` | Port number for each Managed Server. | `8001` |
9095
| `namespace` | Kubernetes namespace in which to create the domain. | `default` |
9196
| `productionModeEnabled` | Boolean indicating if production mode is enabled for the domain. | `true` |
92-
| `serverStartPolicy` | Determines which WebLogic Servers will be started up. Legal values are `NEVER`, `ALWAYS`, `IF_NEEDED`, `ADMIN_ONLY`. | `IF_NEEDED` |
97+
| `serverStartPolicy` | Determines which WebLogic Servers will be started up. Legal values are `NEVER`, `IF_NEEDED`, `ADMIN_ONLY`. | `IF_NEEDED` |
9398
| `t3ChannelPort` | Port for the T3 channel of the NetworkAccessPoint. | `30012` |
9499
| `t3PublicAddress` | Public address for the T3 channel. | `kubernetes` |
95100
| `weblogicCredentialsSecretName` | Name of the Kubernetes secret for the Administration Server's username and password. | `domain1-weblogic-credentials` |
@@ -171,6 +176,7 @@ spec:
171176
# replicas: 1
172177
173178
```
179+
###
174180

175181
### Verify the domain
176182

kubernetes/samples/scripts/create-weblogic-domain/domain-home-in-image/create-domain-inputs.yaml

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ domainUID: domain1
1919
clusterType: DYNAMIC
2020

2121
# Determines which WebLogic Servers the Operator will start up
22-
# Legal values are "NEVER", "ALWAYS", "IF_NEEDED", or "ADMIN_ONLY"
22+
# Legal values are "NEVER", "IF_NEEDED", or "ADMIN_ONLY"
2323
serverStartPolicy: IF_NEEDED
2424

2525
# Cluster name
2626
clusterName: cluster-1
2727

2828
# Number of managed servers to generate for the domain
29-
configuredManagedServerCount: 2
29+
configuredManagedServerCount: 5
3030

3131
# Number of managed servers to initially start for the domain
3232
initialManagedServerReplicas: 2
@@ -40,9 +40,12 @@ managedServerPort: 8001
4040
# Boolean indicating if production mode is enabled for the domain
4141
productionModeEnabled: true
4242

43-
# WebLogic Docker image.
44-
# The operator requires WebLogic Server 12.2.1.3.0 with patch 28076014 applied. See README.md for more help.
45-
#image:
43+
# WebLogic Docker image that the domain resource will pull if needed.
44+
# You only need to specify this if you are going to push the generated image from the local Docker repository
45+
# to another Docker repository.
46+
# If not specified, the sample uses the internally generated image name, either "domain-home-in-image:latest"
47+
# or "domain-home-in-image-wdt:latest".
48+
# image:
4649

4750
# Image pull policy
4851
# Legal values are "IfNotPresent", "Always", or "Never"
@@ -85,14 +88,14 @@ namespace: default
8588
# Java Option for Weblogic Server
8689
javaOptions: -Dweblogic.StdoutDebugEnabled=false
8790

88-
# Base image used to build the domain home in image Docker image
89-
# If not specified, use the built-in base image oracle/weblogic:12.2.1.3-developer
90-
baseImage: oracle/weblogic:12.2.1.3-developer
91-
92-
# The relative directory of the WebLogic domain home in image Docker image in the i
93-
# `https://github.com/oracle/docker-images.git` project under the `docker-images/OracleWebLogic/samples` directory.
94-
# If not specified, use 12213-domain-home-in-image-wdt.
95-
# Another possible value is 12213-domain-home-in-image which uses WLST script instead of WDT to
96-
# generate the domain home.
97-
imagePath: 12213-domain-home-in-image-wdt
91+
# Base WebLogic binary image used to build the WebLogic domain image
92+
# The operator requires WebLogic Server 12.2.1.3.0 with patch 28076014 applied. See README.md for more help.
93+
# domainHomeImageBase:
94+
95+
# Location of the WebLogic "domain home in image" Docker image sample in the
96+
# `https://github.com/oracle/docker-images.git` project.
97+
# If not specified, use "./docker-images/OracleWebLogic/samples/12213-domain-home-in-image-wdt".
98+
# Another possible value is "./docker-images/OracleWebLogic/samples/12213-domain-home-in-image" which
99+
# uses WLST script, instead of WDT, to generate the domain configuration.
100+
domainHomeImageBuildPath: ./docker-images/OracleWebLogic/samples/12213-domain-home-in-image-wdt
98101

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

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
# The domain creation inputs can be customized by editing create-domain-inputs.yaml
1010
#
1111
# The following pre-requisites must be handled prior to running this script:
12+
# * The WDT sample requires that JAVA_HOME is set to a java JDK version 1.8 or greater
1213
# * The kubernetes namespace must already be created
1314
# * The kubernetes secrets 'username' and 'password' of the admin account have been created in the namespace
1415
#
@@ -22,7 +23,7 @@ source ${scriptDir}/../../common/validate.sh
2223
function usage {
2324
echo usage: ${script} -o dir -i file -u username -p password [-k] [-e] [-h]
2425
echo " -i Parameter inputs file, must be specified."
25-
echo " -o Ouput directory for the generated properties and YAML files, must be specified."
26+
echo " -o Output directory for the generated properties and YAML files, must be specified."
2627
echo " -u Username used in building the Docker image for WebLogic domain in image."
2728
echo " -p Password used in building the Docker image for WebLogic domain in image."
2829
echo " -e Also create the resources in the generated YAML files, optional."
@@ -174,8 +175,8 @@ function createFiles {
174175
enabledPrefix="" # uncomment the feature
175176
disabledPrefix="# " # comment out the feature
176177

177-
if [ -z "${image}" ]; then
178-
fail "Please specify image in your input YAML"
178+
if [ -z "${domainHomeImageBase}" ]; then
179+
fail "Please specify domainHomeImageBase in your input YAML"
179180
fi
180181

181182
domainName=${domainUID}
@@ -238,11 +239,13 @@ function createFiles {
238239
sed -i -e "s:%WEBLOGIC_IMAGE_PULL_POLICY%:${imagePullPolicy}:g" ${dcrOutput}
239240
sed -i -e "s:%WEBLOGIC_IMAGE_PULL_SECRET_NAME%:${imagePullSecretName}:g" ${dcrOutput}
240241
sed -i -e "s:%WEBLOGIC_IMAGE_PULL_SECRET_PREFIX%:${imagePullSecretPrefix}:g" ${dcrOutput}
241-
242-
if [ -z $imagePath ]; then
243-
imagePath="12213-domain-home-in-image-wdt"
242+
243+
domainHomeImageBuildPathDefault="./docker-images/OracleWebLogic/samples/12213-domain-home-in-image-wdt"
244+
if [ -z $domainHomeImageBuildPath ]; then
245+
domainHomeImageBuildPath=${domainHomeImageBuildPathDefault}
244246
fi
245-
imageName="${imagePath}:latest"
247+
248+
imageName="`basename ${domainHomeImageBuildPath} | sed 's/^[0-9]*-//'`"
246249

247250
# now we know which image to use, update the domain yaml file
248251
if [ -z $image ]; then
@@ -259,7 +262,7 @@ function createFiles {
259262
# Function to build docker image and create WebLogic domain home
260263
#
261264
function createDomainHome {
262-
dockerDir=${scriptDir}/docker-images/OracleWebLogic/samples/${imagePath}
265+
dockerDir=${scriptDir}/${domainHomeImageBuildPath}
263266
dockerPropsDir=${dockerDir}/properties
264267
cp ${domainPropertiesOutput} ${dockerPropsDir}/docker-build
265268

@@ -276,11 +279,17 @@ function createDomainHome {
276279
sed -i -e "s|myuser|${username}|g" $usernameFile
277280
sed -i -e "s|mypassword1|${password}|g" $passwordFile
278281

279-
if [ ! -z $baseImage ]; then
280-
sed -i -e "s|\(FROM \).*|\1 ${baseImage}|g" ${dockerDir}/Dockerfile
282+
if [ ! -z $domainHomeImageBase ]; then
283+
sed -i -e "s|\(FROM \).*|\1 ${domainHomeImageBase}|g" ${dockerDir}/Dockerfile
281284
fi
282285

283286
sh ${dockerDir}/build.sh
287+
imageNameOrigin="`basename ${domainHomeImageBuildPath}`"
288+
289+
# if use the default images, we tag it to a more generic name (without the release version numbers)
290+
if [ -z $image ]; then
291+
docker tag $imageNameOrigin:latest $imageName:latest
292+
fi
284293

285294
if [ "$?" != "0" ]; then
286295
fail "Create domain ${domainName} failed."

kubernetes/samples/scripts/create-weblogic-domain/domain-home-in-image/domain-template.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ spec:
3131
includeServerOutInPodLog: %INCLUDE_SERVER_OUT_IN_POD_LOG%
3232
# serverStartPolicy legal values are "NEVER", "IF_NEEDED", or "ADMIN_ONLY"
3333
# This determines which WebLogic Servers the Operator will start up when it discovers this Domain
34-
# - "NEVER" will not start any servers in the domain
34+
# - "NEVER" will not start any server in the domain
3535
# - "ADMIN_ONLY" will start up only the administration server (no managed servers will be started)
3636
# - "IF_NEEDED" will start all non-clustered servers, including the administration server and clustered servers up to the replica count
3737
serverStartPolicy: "%SERVER_START_POLICY%"

0 commit comments

Comments
 (0)