Skip to content

Commit 9046a78

Browse files
committed
merge from develop
2 parents 87c3112 + d204689 commit 9046a78

File tree

25 files changed

+319
-503
lines changed

25 files changed

+319
-503
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ The sample scripts demonstrate the creation of a WebLogic domain home in a Docke
66

77
The following prerequisites must be handled prior to running the create domain script:
88
* 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.
910
* Create a Kubernetes namespace for the domain unless the intention is to use the default namespace.
1011
* Create the Kubernetes secrets `username` and `password` of the admin account in the same Kubernetes namespace as the domain.
1112
* 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.
@@ -27,7 +28,7 @@ The script will perform the following steps:
2728
* Create a directory for the generated properties and Kubernetes YAML files for this domain if it does not already exist. The pathname is `/path/to/weblogic-operator-output-directory/weblogic-domains/<domainUID>`. If the directory already exists, its contents will be removed.
2829
* 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.
2930
* Clone the weblogic docker-images project via the `git clone https://github.com/oracle/docker-images.git` into the current directory.
30-
* Replace the built-in username and password in the `properties/docker_build/domain_security.properties` file with the `username` and `password` that are supplied in the command line via the `-u` and `-p` options. These credentials need to match the WebLogic domain admin credentials in the secret that is specified via `weblogicCredentialsSecretName` property in the `create-domain-inputs.yaml` file.
31+
* Replace the built-in username and password in the `properties/docker-build/domain_security.properties` file with the `username` and `password` that are supplied in the command line via the `-u` and `-p` options. These credentials need to match the WebLogic domain admin credentials in the secret that is specified via `weblogicCredentialsSecretName` property in the `create-domain-inputs.yaml` file.
3132
* 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.
3233
* 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.
3334

@@ -77,7 +78,7 @@ The following parameters can be provided in the inputs file.
7778
| `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` |
7879
| `exposeAdminNodePort` | Boolean indicating if the Administration Server is exposed outside of the Kubernetes cluster. | `false` |
7980
| `exposeAdminT3Channel` | Boolean indicating if the T3 administrative channel is exposed outside the Kubernetes cluster. | `false` |
80-
| `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-wdt` |
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` |
8182
| `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` |
8283
| `imagePullPolicy` | WebLogic Docker image pull policy. Legal values are "IfNotPresent", "Always", or "Never" | `IfNotPresent` |
8384
| `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 | |

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,9 @@ managedServerPort: 8001
4040
# Boolean indicating if production mode is enabled for the domain
4141
productionModeEnabled: true
4242

43-
# WebLogic Docker image that the domain resource will use.
44-
# If not specified, the value is the name of the generated Docker image, which is
45-
# "12213-domain-home-in-image" if the imagePath property is specified as "12213-domain-home-in-image";
46-
# "12213-domain-wdt" if the imagePath property is specified as "12213-domain-home-in-image-wdt".
47-
image: 12213-domain-wdt
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:
4846

4947
# Image pull policy
5048
# Legal values are "IfNotPresent", "Always", or "Never"

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

Lines changed: 27 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ function initialize {
153153
#
154154
function getDockerSample {
155155
rm -rf ${scriptDir}/docker-images
156-
git clone https://github.com/oracle/docker-images.git
156+
git clone https://github.com/oracle/docker-images.git ${scriptDir}/docker-images
157157
}
158158

159159
#
@@ -174,6 +174,10 @@ function createFiles {
174174
enabledPrefix="" # uncomment the feature
175175
disabledPrefix="# " # comment out the feature
176176

177+
if [ -z "${image}" ]; then
178+
fail "Please specify image in your input YAML"
179+
fi
180+
177181
domainName=${domainUID}
178182

179183
# Generate the properties file that will be used when creating the weblogic domain
@@ -235,25 +239,10 @@ function createFiles {
235239
sed -i -e "s:%WEBLOGIC_IMAGE_PULL_SECRET_NAME%:${imagePullSecretName}:g" ${dcrOutput}
236240
sed -i -e "s:%WEBLOGIC_IMAGE_PULL_SECRET_PREFIX%:${imagePullSecretPrefix}:g" ${dcrOutput}
237241

238-
# Remove any "...yaml-e" files left over from running sed
239-
rm -f ${domainOutputDir}/*.yaml-e
240-
}
241-
242-
#
243-
# Function to build docker image and create WebLogic domain home
244-
#
245-
function createDomainHome {
246242
if [ -z $imagePath ]; then
247243
imagePath="12213-domain-home-in-image-wdt"
248244
fi
249-
250-
cp ${domainPropertiesOutput} ./docker-images/OracleWebLogic/samples/${imagePath}/properties/docker_build
251-
252-
imageName="12213-domain-home-in-image"
253-
# use the existence of build-archive.sh file to determine if we need to download WDT
254-
if [ -f "./docker-images/OracleWebLogic/samples/${imagePath}/build-archive.sh" ]; then
255-
imageName="12213-domain-wdt"
256-
fi
245+
imageName="${imagePath}:latest"
257246

258247
# now we know which image to use, update the domain yaml file
259248
if [ -z $image ]; then
@@ -262,40 +251,41 @@ function createDomainHome {
262251
sed -i -e "s|%IMAGE_NAME%|${image}|g" ${dcrOutput}
263252
fi
264253

265-
cd docker-images/OracleWebLogic/samples/${imagePath}
254+
# Remove any "...yaml-e" files left over from running sed
255+
rm -f ${domainOutputDir}/*.yaml-e
256+
}
266257

267-
# 12213-domain-home-in-image use one properties file for the credentials
268-
usernameFile="properties/docker_build/domain_security.properties"
269-
passwordFile="properties/docker_build/domain_security.properties"
258+
#
259+
# Function to build docker image and create WebLogic domain home
260+
#
261+
function createDomainHome {
262+
dockerDir=${scriptDir}/docker-images/OracleWebLogic/samples/${imagePath}
263+
dockerPropsDir=${dockerDir}/properties
264+
cp ${domainPropertiesOutput} ${dockerPropsDir}/docker-build
270265

266+
# 12213-domain-home-in-image use one properties file for the credentials
267+
usernameFile="${dockerPropsDir}/docker-build/domain_security.properties"
268+
passwordFile="${dockerPropsDir}/docker-build/domain_security.properties"
269+
271270
# 12213-domain-home-in-image-wdt uses two properties files for the credentials
272271
if [ ! -f $usernameFile ]; then
273-
usernameFile="properties/docker-build/adminuser.properties"
274-
passwordFile="properties/docker-build/adminpass.properties"
275-
sed -i -e "s|weblogic|${username}|g" $usernameFile
276-
sed -i -e "s|welcome1|${password}|g" $passwordFile
277-
else
278-
sed -i -e "s|myuser|${username}|g" $usernameFile
279-
sed -i -e "s|mypassword1|${password}|g" $passwordFile
272+
usernameFile="${dockerPropsDir}/docker-build/adminuser.properties"
273+
passwordFile="${dockerPropsDir}/docker-build/adminpass.properties"
280274
fi
275+
276+
sed -i -e "s|myuser|${username}|g" $usernameFile
277+
sed -i -e "s|mypassword1|${password}|g" $passwordFile
281278

282-
# use the existence of build-archive.sh file to determine if we need to download WDT
283-
if [ -f "build-archive.sh" ]; then
284-
sh ./build-archive.sh
285-
wget https://github.com/oracle/weblogic-deploy-tooling/releases/download/weblogic-deploy-tooling-0.14/weblogic-deploy.zip
286-
fi
287-
288279
if [ ! -z $baseImage ]; then
289-
sed -i -e "s|\(FROM \).*|\1 ${baseImage}|g" Dockerfile
280+
sed -i -e "s|\(FROM \).*|\1 ${baseImage}|g" ${dockerDir}/Dockerfile
290281
fi
291282

292-
sh ./build.sh
283+
sh ${dockerDir}/build.sh
293284

294285
if [ "$?" != "0" ]; then
295286
fail "Create domain ${domainName} failed."
296287
fi
297288

298-
cd -
299289
echo ""
300290
echo "Create domain ${domainName} successfully."
301291
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +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 28076014 applied. Refer to [Weblogic docker images](../../../../../site/weblogic-docker-images.md) for details on how to create one.
1112
* Create a Kubernetes namespace for the domain unless the intention is to use the default namespace.
1213
* 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).
1314
* Create the Kubernetes secrets `username` and `password` of the admin account in the same Kubernetes namespace as the domain.

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@ managedServerNameBase: managed-server
4141
# Port number for each managed server
4242
managedServerPort: 8001
4343

44-
# WebLogic Docker image
45-
image: store/oracle/weblogic:12.2.1.3
44+
# WebLogic Docker image.
45+
# The operator requires WebLogic Server 12.2.1.3.0 with patch 28076014 applied. See README.md for more help.
46+
#image:
4647

4748
# Image pull policy
4849
# Legal values are "IfNotPresent", "Always", or "Never"

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,10 @@ function createFiles {
162162
enabledPrefix="" # uncomment the feature
163163
disabledPrefix="# " # comment out the feature
164164

165+
if [ -z "${image}" ]; then
166+
fail "Please specify image in your input YAML"
167+
fi
168+
165169
domainName=${domainUID}
166170

167171
# Use the default value if not defined.

kubernetes/samples/scripts/elasticsearch-and-kibana/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ to, therefore, the customer only needs to set elkIntegrationEnabled to true in t
1919

2020
To install ElasticSearch and Kibana, use:
2121
```
22-
kubectl apply -f kubernetes/samples/scripts/elasticsearch_and_kibana.yaml
22+
kubectl apply -f kubernetes/samples/scripts/elasticsearch-and-kibana/elasticsearch_and_kibana.yaml
2323
```
2424

2525
To remove them, use:
2626
```
27-
kubectl delete -f kubernetes/samples/scripts/elasticsearch_and_kibana.yaml
28-
```
27+
kubectl delete -f kubernetes/samples/scripts/elasticsearch-and-kibana/elasticsearch_and_kibana.yaml
28+
```

model/src/main/java/oracle/kubernetes/weblogic/domain/v2/Domain.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,10 @@ public String getLogHome() {
306306
.orElse(String.format(LOG_HOME_DEFAULT_PATTERN, getDomainUID()));
307307
}
308308

309+
public boolean getLogHomeEnabled() {
310+
return spec.getLogHomeEnabled();
311+
}
312+
309313
public boolean isIncludeServerOutInPodLog() {
310314
return spec.getIncludeServerOutInPodLog();
311315
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ protected boolean isDomainHomeInImage() {
9999
}
100100

101101
String getEffectiveLogHome() {
102+
if (!getDomain().getLogHomeEnabled()) return "";
102103
String logHome = getLogHome();
103104
if (logHome == null || "".equals(logHome.trim())) {
104105
// logHome not specified, use default value

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ private String getLogHome() {
139139
}
140140

141141
private String getEffectiveLogHome() {
142+
if (!getDomain().getLogHomeEnabled()) return "";
142143
String logHome = getLogHome();
143144
if (logHome == null || "".equals(logHome.trim())) {
144145
// logHome not specified, use default value

0 commit comments

Comments
 (0)