Skip to content

Commit 40c9ad2

Browse files
authored
Merge pull request #608 from oracle/domain-sample-cleanup
Fix domain home in image sample
2 parents 69c6b9f + 15e244c commit 40c9ad2

File tree

5 files changed

+134
-178
lines changed

5 files changed

+134
-178
lines changed

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

Lines changed: 93 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ Make a copy of the `create-domain-inputs.yaml` file, and run the create script,
1616

1717
```
1818
./create-domain.sh \
19+
-u <username> \
20+
-p <password> \
1921
-i create-domain-inputs.yaml \
2022
-o /path/to/output-directory
2123
```
@@ -24,6 +26,8 @@ The script will perform the following steps:
2426

2527
* 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>`. Note that the script fails if the directory is not empty when the `create-domain.sh` script is executed.
2628
* Create a proerties file, `domain.properties`, in the directory that is created above. This properties file will be used to create a sample WebLogic Server domain.
29+
* 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.
2731
* Build Docker image based on Docker sample [Example Image with a WebLogic Server Domain](https://github.com/oracle/docker-images/tree/master/OracleWebLogic/samples/12213-domain-home-in-image). It will create a sample WebLogic Server domain into the Docker image. You can also 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 domain home image. Note: Oracle recommends keeping the domain home image private in the local repository.
2832
* 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.
2933

@@ -33,10 +37,12 @@ The usage of the create script is as follows:
3337

3438
```
3539
$ sh create-domain.sh -h
36-
usage: create-domain.sh -o dir -i file [-e] [-h]
40+
usage: create-domain.sh -o dir -i file -u username -p password [-e] [-h]
3741
-i Parameter inputs file, must be specified.
38-
-o Output directory for the generated properties and YAML files, must be specified.
39-
-e Also create the resources in the generated YAML file, optional.
42+
-o Ouput directory for the generated properties and YAML files, must be specified.
43+
-u Username used in building the Docker image for WebLogic domain in image.
44+
-p Password used in building the Docker image for WebLogic domain in image.
45+
-e Also create the resources in the generated YAML files, optional.
4046
-h Help
4147
4248
```
@@ -68,6 +74,7 @@ The following parameters can be provided in the inputs file.
6874
| `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` |
6975
| `exposeAdminNodePort` | Boolean indicating if the Administration Server is exposed outside of the Kubernetes cluster. | `false` |
7076
| `exposeAdminT3Channel` | Boolean indicating if the T3 administrative channel is exposed outside the Kubernetes cluster. | `false` |
77+
| `includeServerOutInPodLog` | Boolean indicating whether to include server .out to the pod's stdout. | `true` |
7178
| `initialManagedServerReplicas` | Number of Managed Servers to initially start for the domain. | `2` |
7279
| `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` |
7380
| `managedServerNameBase` | Base string used to generate Managed Server names. | `managed-server` |
@@ -78,7 +85,6 @@ The following parameters can be provided in the inputs file.
7885
| `t3ChannelPort` | Port for the T3 channel of the NetworkAccessPoint. | `30012` |
7986
| `t3PublicAddress` | Public address for the T3 channel. | `kubernetes` |
8087
| `weblogicCredentialsSecretName` | Name of the Kubernetes secret for the Administration Server's username and password. | `domain1-weblogic-credentials` |
81-
| `includeServerOutInPodLog` | Boolean indicating whether to include server .out to the pod's stdout. | `true` |
8288

8389
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 `("-")`.
8490

@@ -108,15 +114,7 @@ metadata:
108114
labels:
109115
weblogic.resourceVersion: domain-v2
110116
weblogic.domainUID: domain1
111-
weblogic.domainName: domain1
112117
spec:
113-
# The domainUID must be unique across the entire Kubernetes Cluster. Each WebLogic Domain must
114-
# have its own unique domainUID. This does not have to be the same as the Domain Name. It is allowed
115-
# to have multiple Domains with the same Domain Name, but they MUST have different domainUID's.
116-
# The domainUID is also used to identify the Persistent Volume that belongs to/with this Domain.
117-
domainUID: domain1
118-
# The WebLogic Domain Name
119-
domainName: domain1
120118
# The WebLogic Domain Home
121119
domainHome: /u01/oracle/user_projects/domains/domain1
122120
# If the domain home is in the image
@@ -129,10 +127,6 @@ spec:
129127
# how to create that Secret at the end of this file)
130128
adminSecret:
131129
name: domain1-weblogic-credentials
132-
# The name of the Admin Server
133-
asName: "admin-server"
134-
# The Admin Server's ListenPort
135-
asPort: 7001
136130
# Whether to include the server out file into the pod's stdout, default is true
137131
includeServerOutInPodLog: true
138132
# serverStartPolicy legal values are "NEVER", "ALWAYS", "IF_NEEDED", or "ADMIN_ONLY"
@@ -141,6 +135,12 @@ spec:
141135
# - "ADMIN_ONLY" will start up only the administration server (no managed servers will be started)
142136
# - "IF_NEEDED" will start all non-clustered servers, including the administration server and clustered servers up to the replica count
143137
serverStartPolicy: "IF_NEEDED"
138+
# an (optional) list of environment variable to be set on the servers
139+
env:
140+
- name: JAVA_OPTIONS
141+
value: "-Dweblogic.StdoutDebugEnabled=false"
142+
- name: USER_MEM_ARGS
143+
value: "-Xms64m -Xmx256m "
144144
# adminServer is used to configure the desired behavior for starting the administration server.
145145
adminServer:
146146
# serverStartState legal values are "RUNNING" or "ADMIN"
@@ -152,37 +152,12 @@ spec:
152152
# Uncomment to export the T3Channel as a service
153153
# exportedNetworkAccessPoints:
154154
# T3Channel: {}
155-
# an (optional) list of environment variable to be set on the server
156-
env:
157-
- name: JAVA_OPTIONS
158-
value: "-Dweblogic.StdoutDebugEnabled=false"
159-
- name: USER_MEM_ARGS
160-
value: "-Xms64m -Xmx256m "
161-
volumes:
162-
- name: runtime-properties
163-
hostPath:
164-
path: "/scratch/weblogic-kubernetes-operator/kubernetes/samples/scripts/create-weblogic-domain/domain-home-in-image/docker-images/OracleWebLogic/samples/12213-domain-home-in-image/properties/docker_run"
165-
volumeMounts:
166-
- name: runtime-properties
167-
mountPath: "/u01/oracle/properties"
168155
# clusters is used to configure the desired behavior for starting member servers of a cluster.
169156
# If you use this entry, then the rules will be applied to ALL servers that are members of the named clusters.
170157
clusters:
171158
cluster-1:
172159
desiredState: "RUNNING"
173160
replicas: 2
174-
env:
175-
- name: JAVA_OPTIONS
176-
value: "-Dweblogic.StdoutDebugEnabled=false"
177-
- name: USER_MEM_ARGS
178-
value: "-Xms64m -Xmx256m "
179-
volumes:
180-
- name: runtime-properties
181-
hostPath:
182-
path: "/scratch/weblogic-kubernetes-operator/kubernetes/samples/scripts/create-weblogic-domain/domain-home-in-image/docker-images/OracleWebLogic/samples/12213-domain-home-in-image/properties/docker_run"
183-
volumeMounts:
184-
- name: runtime-properties
185-
mountPath: "/u01/oracle/properties"
186161
# The number of managed servers to start for unlisted clusters
187162
# replicas: 1
188163
@@ -204,92 +179,117 @@ Here is an example of the output of this command:
204179
$ kubectl describe domain domain1
205180
Name: domain1
206181
Namespace: default
207-
Labels: weblogic.domainName=base_domain
208-
weblogic.domainUID=domain1
182+
Labels: weblogic.domainUID=domain1
209183
weblogic.resourceVersion=domain-v2
210184
Annotations: <none>
211-
API Version: weblogic.oracle/v1
185+
API Version: weblogic.oracle/v2
212186
Kind: Domain
213187
Metadata:
214188
Cluster Name:
215-
Creation Timestamp: 2018-10-31T12:59:15Z
216-
Generation: 0
217-
Resource Version: 1314703
218-
Self Link: /apis/weblogic.oracle/v1/namespaces/default/domains/domain1
219-
UID: c52f5e11-dd0c-11e8-9238-fa163e855ac8
189+
Creation Timestamp: 2018-12-11T01:33:27Z
190+
Generation: 1
191+
Resource Version: 46624
192+
Self Link: /apis/weblogic.oracle/v2/namespaces/default/domains/domain1
193+
UID: c1f7be60-fce4-11e8-bc6c-0021f6985fb7
220194
Spec:
221195
Admin Secret:
222-
Name: domain1-weblogic-credentials
223-
As Name: admin-server
224-
As Port: 7001
225-
Cluster Startup:
226-
Cluster Name: cluster-1
227-
Desired State: RUNNING
228-
Env:
229-
Name: JAVA_OPTIONS
230-
Value: -Dweblogic.StdoutDebugEnabled=false
231-
Name: USER_MEM_ARGS
232-
Value: -Xms64m -Xmx256m
233-
Replicas: 2
196+
Name: domain1-weblogic-credentials
197+
Admin Server:
198+
Exported Network Access Points:
199+
Node Port Annotations:
200+
Node Port Labels:
201+
Server Pod:
202+
Container Security Context:
203+
Env:
204+
Liveness Probe:
205+
Node Selector:
206+
Pod Annotations:
207+
Pod Labels:
208+
Pod Security Context:
209+
Readiness Probe:
210+
Resources:
211+
Limits:
212+
Requests:
213+
Service Annotations:
214+
Service Labels:
215+
Volume Mounts:
216+
Volumes:
217+
Server Start State: RUNNING
234218
Clusters:
235-
Domain Home In Image: false
236-
Domain Name: base_domain
237-
Domain UID: domain1
238-
Env:
239-
Export T 3 Channels:
240-
T3Channel
241-
Exported Network Access Points:
242-
Image: store/oracle/weblogic:12.2.1.3
243-
Image Pull Policy: IfNotPresent
244-
Image Pull Secret:
245-
Liveness Probe:
219+
Cluster - 1:
220+
Replicas: 2
221+
Server Pod:
222+
Container Security Context:
223+
Env:
224+
Liveness Probe:
225+
Node Selector:
226+
Pod Annotations:
227+
Pod Labels:
228+
Pod Security Context:
229+
Readiness Probe:
230+
Resources:
231+
Limits:
232+
Requests:
233+
Service Annotations:
234+
Service Labels:
235+
Volume Mounts:
236+
Volumes:
237+
Server Start State: RUNNING
238+
Domain Home: /u01/oracle/user_projects/domains/domain1
239+
Domain Home In Image: true
240+
Image: 12213-domain-home-in-image:latest
241+
Image Pull Policy: Never
242+
Include Server Out In Pod Log: true
246243
Managed Servers:
247-
Readiness Probe:
248-
Server Startup:
249-
Desired State: RUNNING
244+
Server Pod:
245+
Container Security Context:
250246
Env:
251-
Name: JAVA_OPTIONS
252-
Value: -Dweblogic.StdoutDebugEnabled=false
253-
Name: USER_MEM_ARGS
254-
Value: -Xms64m -Xmx256m
255-
Node Port: 30701
256-
Server Name: admin-server
257-
Startup Control: AUTO
258-
Storage:
259-
Predefined:
260-
Claim: domain1-weblogic-sample-pvc
247+
Liveness Probe:
248+
Node Selector:
249+
Pod Annotations:
250+
Pod Labels:
251+
Pod Security Context:
252+
Readiness Probe:
253+
Resources:
254+
Limits:
255+
Requests:
256+
Service Annotations:
257+
Service Labels:
258+
Volume Mounts:
259+
Volumes:
260+
Server Start Policy: IF_NEEDED
261261
Status:
262262
Conditions:
263-
Last Transition Time: 2018-10-31T13:01:34.786Z
263+
Last Transition Time: 2018-12-11T01:35:23.652Z
264264
Reason: ServersReady
265265
Status: True
266266
Type: Available
267267
Servers:
268268
Health:
269-
Activation Time: 2018-10-31T13:07:14.472Z
269+
Activation Time: 2018-12-11T01:34:59.546Z
270270
Overall Health: ok
271271
Subsystems:
272272
Node Name: xxxxxxxx
273273
Server Name: admin-server
274274
State: RUNNING
275275
Cluster Name: cluster-1
276276
Health:
277-
Activation Time: 2018-10-31T13:01:05.100Z
277+
Activation Time: 2018-12-11T01:36:46.132Z
278278
Overall Health: ok
279279
Subsystems:
280280
Node Name: xxxxxxxx
281281
Server Name: managed-server1
282282
State: RUNNING
283283
Cluster Name: cluster-1
284284
Health:
285-
Activation Time: 2018-10-31T13:01:05.190Z
285+
Activation Time: 2018-12-11T01:36:47.865Z
286286
Overall Health: ok
287287
Subsystems:
288-
Node Name: xxxxxxxx
289-
Server Name: managed-server2
288+
Node Name: xxxxxxxx
289+
Server Name: managed-server2
290290
State: RUNNING
291-
Start Time: 2018-10-31T12:59:15.244Z
292-
Events: <none>
291+
Start Time: 2018-12-11T01:33:27.339Z
292+
Events: <none>
293293
```
294294

295295
In the `Status` section of the output, the available servers and clusters are listed. Note that if this command is issued very soon after the script finishes, there may be no servers available yet, or perhaps only the Administration Server but no Managed Servers. The operator will start up the Administration Server first and wait for it to become ready before starting Managed Servers.

0 commit comments

Comments
 (0)