Skip to content

Commit 6be3971

Browse files
committed
More changes
Signed-off-by: doxiao <[email protected]>
1 parent 24561d9 commit 6be3971

File tree

5 files changed

+57
-12
lines changed

5 files changed

+57
-12
lines changed

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ The script will perform the following steps:
2929
* Create a properties file, `domain.properties`, in the directory that is created above. This properties file will be used to create a sample WebLogic Server domain.
3030
* Clone the weblogic docker-images project into the current directory using `git clone https://github.com/oracle/docker-images.git`.
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.
32-
* 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.
32+
* Build a Docker image based on [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) or [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.
33+
* The generated image is tagged according the inputs properties.
3334
* 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.
3435
```
3536
$ kubectl apply -f /path/to/output-directory/weblogic-domains/<domainUID>/domain.yaml
@@ -65,10 +66,10 @@ The default domain created by the script has the following characteristics:
6566
* No applications deployed.
6667
* A T3 channel.
6768

68-
If you run the sample from a machine that is remote to the Kubernetes cluster, and you need to push the new image to a registry that is local to the cluster, you need to do the following:
69-
* Set the `image` property in the inputs file to the target image name (including the tag if needed).
69+
If you run the sample from a machine that is remote to the Kubernetes cluster, and you need to push the new image to a registry that is local to the cluster, you need to do the following (also see the `image` property in the table in the next section):
70+
* Set the `image` property in the inputs file to the target image name (including the registry hostname/port and the tag if needed).
7071
* Run the `create-domain.sh` script without the `-e` option.
71-
* Push the generated image `domain-home-in-image-wdt:lastest` (or `domain-home-in-image:latest`) to the registry.
72+
* Push the `image` to the target registry.
7273
* Run the following command to create the domain.
7374

7475
```
@@ -88,11 +89,11 @@ The following parameters can be provided in the inputs file.
8889
| `clusterName` | Name of the WebLogic cluster instance to generate for the domain. | `cluster-1` |
8990
| `configuredManagedServerCount` | Number of Managed Server instances to generate for the domain. | `5` |
9091
| `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. | |
91-
| `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` |
92+
| `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 scripts, instead of WLST, to generate the domain configuration. | `./docker-images/OracleWebLogic/samples/12213-domain-home-in-image` |
9293
| `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` |
9394
| `exposeAdminNodePort` | Boolean indicating if the Administration Server is exposed outside of the Kubernetes cluster. | `false` |
9495
| `exposeAdminT3Channel` | Boolean indicating if the T3 administrative channel is exposed outside the Kubernetes cluster. | `false` |
95-
| `image` | WebLogic Docker image that the domain resource will pull if needed. You only need to specify this if you are going to tag the generated image to a different name. If not specified, the sample uses the internally generated image name, either "domain-home-in-image-wdt:latest" or "domain-home-in-image:latest". | |
96+
| `image` | WebLogic Docker image that the domain resource will pull if needed. You only need to specify this if you are going to tag the generated image to a different name. If you run the sample script from a machine that is remote to the Kubernetes cluster, you need to specify this to point to an image in a registry local to the cluster, and then push the generate image to that registry before starting the domain. If not specified, the sample uses the internally generated image name, either "domain-home-in-image:latest" or "domain-home-in-image-wdt:latest". | |
9697
| `imagePullPolicy` | WebLogic Docker image pull policy. Legal values are "IfNotPresent", "Always", or "Never" | `IfNotPresent` |
9798
| `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 | |
9899
| `includeServerOutInPodLog` | Boolean indicating whether to include server .out to the pod's stdout. | `true` |

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

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,7 @@ javaOptions: -Dweblogic.StdoutDebugEnabled=false
9999

100100
# Location of the WebLogic "domain home in image" Docker image sample in the
101101
# `https://github.com/oracle/docker-images.git` project.
102-
# If not specified, use "./docker-images/OracleWebLogic/samples/12213-domain-home-in-image-wdt".
103-
# Another possible value is "./docker-images/OracleWebLogic/samples/12213-domain-home-in-image",
104-
# which uses a WLST script, instead of WDT, to generate the domain configuration.
105-
domainHomeImageBuildPath: ./docker-images/OracleWebLogic/samples/12213-domain-home-in-image-wdt
106-
102+
# If not specified, use "./docker-images/OracleWebLogic/samples/12213-domain-home-in-image".
103+
# Another possible value is "./docker-images/OracleWebLogic/samples/12213-domain-home-in-image-wdt",
104+
# which uses a WDT script, instead of WLST, to generate the domain configuration.
105+
domainHomeImageBuildPath: ./docker-images/OracleWebLogic/samples/12213-domain-home-in-image

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ DB_PORT=1527
1111
DEBUG_FLAG=true
1212
DERBY_FLAG=true
1313
PRODUCTION_MODE_ENABLED=%PRODUCTION_MODE_ENABLED%
14+
CLUSTER_TYPE=%CLUSTER_TYPE%
1415
JAVA_OPTIONS=%JAVA_OPTIONS%
1516
T3_CHANNEL_PORT=%T3_CHANNEL_PORT%
1617
T3_PUBLIC_ADDRESS=%T3_PUBLIC_ADDRESS%

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,7 @@ function createFiles {
227227
sed -i -e "s:%T3_CHANNEL_PORT%:${t3ChannelPort}:g" ${createJobOutput}
228228
sed -i -e "s:%T3_PUBLIC_ADDRESS%:${t3PublicAddress}:g" ${createJobOutput}
229229
sed -i -e "s:%CLUSTER_NAME%:${clusterName}:g" ${createJobOutput}
230+
sed -i -e "s:%CLUSTER_TYPE%:${clusterType}:g" ${createJobOutput}
230231
sed -i -e "s:%DOMAIN_PVC_NAME%:${persistentVolumeClaimName}:g" ${createJobOutput}
231232
sed -i -e "s:%DOMAIN_ROOT_DIR%:${domainPVMountPath}:g" ${createJobOutput}
232233
sed -i -e "s:%CREATE_DOMAIN_SCRIPT_DIR%:${createDomainScriptsMountPath}:g" ${createJobOutput}
@@ -305,12 +306,16 @@ function createDomainConfigmap {
305306
cp ${scriptDir}/common/* ${externalFilesTmpDir}/
306307
fi
307308
cp ${domainOutputDir}/create-domain-inputs.yaml ${externalFilesTmpDir}/
308-
309+
309310
# Set the domainName in the inputs file that is contained in the configmap.
310311
# this inputs file can be used by the scripts, such as WDT, that creates the WebLogic
311312
# domain in the job.
312313
echo domainName: $domainName >> ${externalFilesTmpDir}/create-domain-inputs.yaml
313314

315+
if [ -f ${externalFilesTmpDir}/prepare.sh ]; then
316+
sh ${externalFilesTmpDir}/prepare.sh -t ${clusterType} -i ${externalFilesTmpDir}
317+
fi
318+
314319
# create the configmap and label it properly
315320
local cmName=${domainUID}-create-weblogic-sample-domain-job-cm
316321
kubectl create configmap ${cmName} -n $namespace --from-file $externalFilesTmpDir
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash
2+
# Copyright 2018, Oracle Corporation and/or its affiliates. All rights reserved.
3+
# Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
4+
#
5+
6+
# Perform preparation based on the specified cluster type
7+
8+
function usage {
9+
echo usage: ${script} -t clusterTpe -i file [-h]
10+
echo " -i Directory, must be specified."
11+
echo " -t Cluster type, CONFIGURED or DYNAMIC, default is DYNAMIC."
12+
echo " -h Help"
13+
exit $1
14+
}
15+
16+
17+
while getopts "hi:t:" opt; do
18+
case $opt in
19+
i) externalFilesTmpDir="${OPTARG}"
20+
;;
21+
t) clusterType="${OPTARG}"
22+
;;
23+
h) usage 0
24+
;;
25+
*) usage 1
26+
;;
27+
esac
28+
done
29+
30+
echo Preparing the scripts with clusterType $clusterType
31+
32+
if [ "${clusterType}" = "CONFIGURED" ]; then
33+
source_model=${externalFilesTmpDir}/wdt_model_configured.yaml
34+
else
35+
source_model=${externalFilesTmpDir}/wdt_model_dynamic.yaml
36+
fi
37+
38+
cp $source_model ${externalFilesTmpDir}/wdt_model.yaml
39+

0 commit comments

Comments
 (0)