Skip to content

Commit 7007192

Browse files
authored
OWLS-104468 Update create-weblogic-domain samples to use Operator 4.0 Domain and Cluster resources (#3735)
* Update create-weblogic-domain samples to use Operator 4.0 Domain and Cluster resources
1 parent 50068e5 commit 7007192

File tree

13 files changed

+345
-179
lines changed

13 files changed

+345
-179
lines changed

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

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# This is an example of how to define a Domain resource.
55
#
6-
apiVersion: "weblogic.oracle/v8"
6+
apiVersion: "weblogic.oracle/v9"
77
kind: Domain
88
metadata:
99
name: %DOMAIN_UID%
@@ -83,12 +83,26 @@ spec:
8383
# Uncomment to export the T3Channel as a service
8484
%EXPOSE_T3_CHANNEL_PREFIX% - channelName: T3Channel
8585

86-
# clusters is used to configure the desired behavior for starting member servers of a cluster.
87-
# If you use this entry, then the rules will be applied to ALL servers that are members of the named clusters.
86+
# References to Cluster resources that describe the lifecycle options for all
87+
# the Managed Server members of a WebLogic cluster, including Java
88+
# options, environment variables, additional Pod content, and the ability to
89+
# explicitly start, stop, or restart cluster members. The Cluster resource
90+
# must describe a cluster that already exists in the WebLogic domain
91+
# configuration.
8892
clusters:
89-
- clusterName: %CLUSTER_NAME%
90-
replicas: %INITIAL_MANAGED_SERVER_REPLICAS%
93+
- name: %DOMAIN_UID%-%CLUSTER_NAME%
94+
9195
# The number of managed servers to start for unlisted clusters
9296
# replicas: 1
9397

98+
---
99+
# This is an example of how to define a Cluster resource.
100+
apiVersion: weblogic.oracle/v1
101+
kind: Cluster
102+
metadata:
103+
name: %DOMAIN_UID%-%CLUSTER_NAME%
104+
namespace: %NAMESPACE%
105+
spec:
106+
clusterName: %CLUSTER_NAME%
107+
replicas: %INITIAL_MANAGED_SERVER_REPLICAS%
94108

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

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# This is an example of how to define a Domain resource.
55
#
6-
apiVersion: "weblogic.oracle/v8"
6+
apiVersion: "weblogic.oracle/v9"
77
kind: Domain
88
metadata:
99
name: %DOMAIN_UID%
@@ -49,11 +49,11 @@ spec:
4949
# data storage directories are determined from the WebLogic domain home configuration.
5050
dataHome: "%DATA_HOME%"
5151

52-
# serverStartPolicy legal values are "NEVER", "IF_NEEDED", or "ADMIN_ONLY"
52+
# serverStartPolicy legal values are "Never, "IfNeeded", or "AdminOnly"
5353
# This determines which WebLogic Servers the Operator will start up when it discovers this Domain
54-
# - "NEVER" will not start any server in the domain
55-
# - "ADMIN_ONLY" will start up only the administration server (no managed servers will be started)
56-
# - "IF_NEEDED" will start all non-clustered servers, including the administration server and clustered servers up to the replica count
54+
# - "Never" will not start any server in the domain
55+
# - "AdminOnly" will start up only the administration server (no managed servers will be started)
56+
# - "IfNeeded" will start all non-clustered servers, including the administration server and clustered servers up to the replica count
5757
serverStartPolicy: %SERVER_START_POLICY%
5858

5959
serverPod:
@@ -87,12 +87,26 @@ spec:
8787
- name: USER_MEM_ARGS
8888
value: "-Djava.security.egd=file:/dev/./urandom -Xms512m -Xmx1024m "
8989

90-
# clusters is used to configure the desired behavior for starting member servers of a cluster.
91-
# If you use this entry, then the rules will be applied to ALL servers that are members of the named clusters.
90+
# References to Cluster resources that describe the lifecycle options for all
91+
# the Managed Server members of a WebLogic cluster, including Java
92+
# options, environment variables, additional Pod content, and the ability to
93+
# explicitly start, stop, or restart cluster members. The Cluster resource
94+
# must describe a cluster that already exists in the WebLogic domain
95+
# configuration.
9296
clusters:
93-
- clusterName: %CLUSTER_NAME%
94-
replicas: %INITIAL_MANAGED_SERVER_REPLICAS%
97+
- name: %DOMAIN_UID%-%CLUSTER_NAME%
98+
9599
# The number of managed servers to start for unlisted clusters
96100
# replicas: 1
97101

102+
---
103+
# This is an example of how to define a Cluster resource.
104+
apiVersion: weblogic.oracle/v1
105+
kind: Cluster
106+
metadata:
107+
name: %DOMAIN_UID%-%CLUSTER_NAME%
108+
namespace: %NAMESPACE%
109+
spec:
110+
clusterName: %CLUSTER_NAME%
111+
replicas: %INITIAL_MANAGED_SERVER_REPLICAS%
98112

kubernetes/samples/scripts/common/utility.sh

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -289,24 +289,27 @@ getKubernetesClusterIP() {
289289
#
290290
buildServerPodResources() {
291291

292+
level1_indent=" "
293+
level2_indent="${level1_indent} "
294+
292295
if [ -n "${serverPodMemoryRequest}" ]; then
293-
local memoryRequest=" memory\: \"${serverPodMemoryRequest}\"\n"
296+
local memoryRequest="${level2_indent}memory\: \"${serverPodMemoryRequest}\"\n"
294297
fi
295298
if [ -n "${serverPodCpuRequest}" ]; then
296-
local cpuRequest=" cpu\: \"${serverPodCpuRequest}\"\n"
299+
local cpuRequest="${level2_indent}cpu\: \"${serverPodCpuRequest}\"\n"
297300
fi
298301
if [ -n "${memoryRequest}" ] || [ -n "${cpuRequest}" ]; then
299-
local requests=" requests\: \n$memoryRequest $cpuRequest"
302+
local requests="${level1_indent}requests\: \n${memoryRequest}${cpuRequest}"
300303
fi
301304

302305
if [ -n "${serverPodMemoryLimit}" ]; then
303-
local memoryLimit=" memory\: \"${serverPodMemoryLimit}\"\n"
306+
local memoryLimit="${level2_indent}memory\: \"${serverPodMemoryLimit}\"\n"
304307
fi
305308
if [ -n "${serverPodCpuLimit}" ]; then
306-
local cpuLimit=" cpu\: \"${serverPodCpuLimit}\"\n"
309+
local cpuLimit="${level2_indent}cpu\: \"${serverPodCpuLimit}\"\n"
307310
fi
308311
if [ -n "${memoryLimit}" ] || [ -n "${cpuLimit}" ]; then
309-
local limits=" limits\: \n$memoryLimit $cpuLimit"
312+
local limits="${level1_indent}limits\: \n${memoryLimit}${cpuLimit}"
310313
fi
311314

312315
if [ -n "${requests}" ] || [ -n "${limits}" ]; then
@@ -654,11 +657,13 @@ createFiles() {
654657

655658
#
656659
# Function to markup the wdt model file
660+
# $1 - Name of wdt model file. Optional. Defaults to wdt_k8s_model_template.yaml
657661
#
658662
updateModelFile() {
659663
# Update the wdt model file with kubernetes section
660664
modelFile="${domainOutputDir}/tmp/wdt_model.yaml"
661-
cat ${scriptDir}/wdt_k8s_model_template.yaml >> ${modelFile}
665+
model_template_file=${1:-wdt_k8s_model_template.yaml}
666+
cat ${scriptDir}/${model_template_file} >> ${modelFile}
662667

663668
sed -i -e "s:%DOMAIN_UID%:${domainUID}:g" ${modelFile}
664669
sed -i -e "s:%NAMESPACE%:$namespace:g" ${modelFile}
@@ -688,6 +693,7 @@ updateModelFile() {
688693
sed -i -e "s:%EXPOSE_ADMIN_PORT_PREFIX%:${exposeAdminNodePortPrefix}:g" ${modelFile}
689694
sed -i -e "s:%ADMIN_NODE_PORT%:${adminNodePort}:g" ${modelFile}
690695
sed -i -e "s:%CLUSTER_NAME%:${clusterName}:g" ${modelFile}
696+
sed -i -e "s:%CLUSTER_NAME2%:${clusterName2}:g" ${modelFile}
691697
sed -i -e "s:%INITIAL_MANAGED_SERVER_REPLICAS%:${initialManagedServerReplicas}:g" ${modelFile}
692698
# MII settings are used for model-in-image integration testing
693699
sed -i -e "s:%MII_PREFIX%:${miiPrefix}:g" ${modelFile}

kubernetes/samples/scripts/common/validate.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -262,16 +262,16 @@ validateServerStartPolicy() {
262262
validateInputParamsSpecified serverStartPolicy
263263
if [ ! -z "${serverStartPolicy}" ]; then
264264
case ${serverStartPolicy} in
265-
"NEVER")
265+
"Never")
266266
;;
267-
"ALWAYS")
267+
"Always")
268268
;;
269-
"IF_NEEDED")
269+
"IfNeeded")
270270
;;
271-
"ADMIN_ONLY")
271+
"AdminOnly")
272272
;;
273273
*)
274-
validationError "Invalid value for serverStartPolicy: ${serverStartPolicy}. Valid values are 'NEVER', 'ALWAYS', 'IF_NEEDED', and 'ADMIN_ONLY'."
274+
validationError "Invalid value for serverStartPolicy: ${serverStartPolicy}. Valid values are 'Never', 'Always', 'IfNeeded', and 'AdminOnly'."
275275
;;
276276
esac
277277
fi

kubernetes/samples/scripts/common/wdt-and-wit-utility.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ run_wdt() {
221221
-domain_home $domain_home_dir
222222
-model_file $model_final
223223
-variable_file $inputs_final
224+
-target wko4
224225
"
225226
echo @@ "Info: About to run the following WDT command:"
226227
echo "${cmd}"

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ domainUID: domain1
2020
domainHome: /u01/oracle/user_projects/domains/domain1
2121

2222
# Determines which OracleFMWInfrastructure Servers the operator will start up
23-
# Legal values are "NEVER", "IF_NEEDED", or "ADMIN_ONLY"
24-
serverStartPolicy: IF_NEEDED
23+
# Legal values are "Never", "IfNeeded", or "AdminOnly"
24+
serverStartPolicy: IfNeeded
2525

2626
# Cluster name
2727
clusterName: cluster-1

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ domainUID: domain1
1818
# If not specified, the value is derived from the domainUID as /shared/domains/<domainUID>
1919
domainHome: /shared/domains/domain1
2020

21-
# Determines which WebLogic Servers the operator will start up
22-
# Legal values are "NEVER", "IF_NEEDED", or "ADMIN_ONLY"
23-
serverStartPolicy: IF_NEEDED
21+
# Determines which OracleFMWInfrastructure Servers the operator will start up
22+
# Legal values are "Never", "IfNeeded", or "AdminOnly"
23+
serverStartPolicy: IfNeeded
2424

2525
# Cluster name
2626
clusterName: cluster-1

kubernetes/samples/scripts/create-fmw-infrastructure-domain/domain-home-on-pv/wdt_k8s_model_template.yaml

Lines changed: 83 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -6,84 +6,98 @@
66
# extractDomainResource script to generate a domain.yaml
77
#
88
kubernetes:
9-
apiVersion: "weblogic.oracle/v8"
10-
kind: Domain
11-
metadata:
12-
name: %DOMAIN_UID%
13-
namespace: "%NAMESPACE%"
14-
labels:
15-
#weblogic.resourceVersion: "domain-v2"
16-
weblogic.domainUID: %DOMAIN_UID%
17-
spec:
18-
# The WebLogic Domain Home
19-
domainHome: %DOMAIN_HOME%
9+
domain:
10+
metadata:
11+
name: %DOMAIN_UID%
12+
namespace: "%NAMESPACE%"
13+
spec:
14+
# The WebLogic Domain Home
15+
domainHome: %DOMAIN_HOME%
2016

21-
# The domain home source type
22-
# Set to PersistentVolume for domain-in-pv, Image for domain-in-image, or FromModel for model-in-image
23-
domainHomeSourceType: %DOMAIN_HOME_SOURCE_TYPE%
17+
# The domain home source type
18+
# Set to PersistentVolume for domain-in-pv, Image for domain-in-image, or FromModel for model-in-image
19+
domainHomeSourceType: %DOMAIN_HOME_SOURCE_TYPE%
2420

25-
# The WebLogic Server Docker image that the Operator uses to start the domain
26-
image: "%WEBLOGIC_IMAGE%"
21+
# The WebLogic Server Docker image that the Operator uses to start the domain
22+
image: "%WEBLOGIC_IMAGE%"
2723

28-
# imagePullPolicy defaults to "Always" if image version is :latest
29-
imagePullPolicy: %WEBLOGIC_IMAGE_PULL_POLICY%
24+
# imagePullPolicy defaults to "Always" if image version is :latest
25+
imagePullPolicy: %WEBLOGIC_IMAGE_PULL_POLICY%
3026

31-
# Identify which Secret contains the credentials for pulling an image
32-
%WEBLOGIC_IMAGE_PULL_SECRET_PREFIX%imagePullSecrets:
33-
%WEBLOGIC_IMAGE_PULL_SECRET_PREFIX% - name: "%WEBLOGIC_IMAGE_PULL_SECRET_NAME%"
34-
# Identify which Secret contains the WebLogic Admin credentials (note that there is an example of
35-
# how to create that Secret at the end of this file)
36-
webLogicCredentialsSecret:
37-
name: '%WEBLOGIC_CREDENTIALS_SECRET_NAME%'
27+
# Identify which Secret contains the credentials for pulling an image
28+
%WEBLOGIC_IMAGE_PULL_SECRET_PREFIX%imagePullSecrets:
29+
%WEBLOGIC_IMAGE_PULL_SECRET_PREFIX% - name: "%WEBLOGIC_IMAGE_PULL_SECRET_NAME%"
30+
# Identify which Secret contains the WebLogic Admin credentials (note that there is an example of
31+
# how to create that Secret at the end of this file)
32+
webLogicCredentialsSecret:
33+
name: '%WEBLOGIC_CREDENTIALS_SECRET_NAME%'
3834

39-
# Whether to include the server out file into the pod's stdout, default is true
40-
includeServerOutInPodLog: %INCLUDE_SERVER_OUT_IN_POD_LOG%
35+
# Whether to include the server out file into the pod's stdout, default is true
36+
includeServerOutInPodLog: %INCLUDE_SERVER_OUT_IN_POD_LOG%
4137

42-
# Whether to enable log home
43-
%LOG_HOME_ON_PV_PREFIX%logHomeEnabled: %LOG_HOME_ENABLED%
38+
# Whether to enable log home
39+
%LOG_HOME_ON_PV_PREFIX%logHomeEnabled: %LOG_HOME_ENABLED%
4440

45-
# Whether to write HTTP access log file to log home
46-
#%LOG_HOME_ON_PV_PREFIX%httpAccessLogInLogHome: %HTTP_ACCESS_LOG_IN_LOG_HOME%
41+
# Whether to write HTTP access log file to log home
42+
#%LOG_HOME_ON_PV_PREFIX%httpAccessLogInLogHome: %HTTP_ACCESS_LOG_IN_LOG_HOME%
4743

48-
# The in-pod location for domain log, server logs, server out, and Node Manager log files
49-
%LOG_HOME_ON_PV_PREFIX%logHome: %LOG_HOME%
50-
# An (optional) in-pod location for data storage of default and custom file stores.
51-
# If not specified or the value is either not set or empty (e.g. dataHome: "") then the
52-
# data storage directories are determined from the WebLogic domain home configuration.
53-
dataHome: "%DATA_HOME%"
44+
# The in-pod location for domain log, server logs, server out, and Node Manager log files
45+
%LOG_HOME_ON_PV_PREFIX%logHome: %LOG_HOME%
46+
# An (optional) in-pod location for data storage of default and custom file stores.
47+
# If not specified or the value is either not set or empty (e.g. dataHome: "") then the
48+
# data storage directories are determined from the WebLogic domain home configuration.
49+
dataHome: "%DATA_HOME%"
5450

55-
replicas: %INITIAL_MANAGED_SERVER_REPLICAS%
51+
replicas: %INITIAL_MANAGED_SERVER_REPLICAS%
5652

57-
# serverStartPolicy legal values are "NEVER", "IF_NEEDED", or "ADMIN_ONLY"
58-
# This determines which WebLogic Servers the Operator will start up when it discovers this Domain
59-
# - "NEVER" will not start any server in the domain
60-
# - "ADMIN_ONLY" will start up only the administration server (no managed servers will be started)
61-
# - "IF_NEEDED" will start all non-clustered servers, including the administration server and clustered servers up to the replica count
62-
serverStartPolicy: %SERVER_START_POLICY%
53+
# serverStartPolicy legal values are "Never, "IfNeeded", or "AdminOnly"
54+
# This determines which WebLogic Servers the Operator will start up when it discovers this Domain
55+
# - "Never" will not start any server in the domain
56+
# - "AdminOnly" will start up only the administration server (no managed servers will be started)
57+
# - "IfNeeded" will start all non-clustered servers, including the administration server and clustered servers up to the replica count
58+
serverStartPolicy: %SERVER_START_POLICY%
6359

64-
serverPod:
65-
# an (optional) list of environment variable to be set on the servers
66-
env:
67-
- name: JAVA_OPTIONS
68-
value: "%JAVA_OPTIONS%"
69-
- name: USER_MEM_ARGS
70-
value: "-Djava.security.egd=file:/dev/./urandom "
71-
%OPTIONAL_SERVERPOD_RESOURCES%
72-
%LOG_HOME_ON_PV_PREFIX%volumes:
73-
%LOG_HOME_ON_PV_PREFIX% - name: 'weblogic-domain-storage-volume'
74-
%LOG_HOME_ON_PV_PREFIX% persistentVolumeClaim:
75-
%LOG_HOME_ON_PV_PREFIX% claimName: '%DOMAIN_PVC_NAME%'
76-
%LOG_HOME_ON_PV_PREFIX%volumeMounts:
77-
%LOG_HOME_ON_PV_PREFIX% - name: 'weblogic-domain-storage-volume'
78-
%LOG_HOME_ON_PV_PREFIX% mountPath: %DOMAIN_ROOT_DIR%
79-
80-
# adminServer is used to configure the desired behavior for starting the administration server.
81-
adminServer:
82-
%EXPOSE_ANY_CHANNEL_PREFIX%adminService:
83-
%EXPOSE_ANY_CHANNEL_PREFIX% channels:
84-
# The Admin Server's NodePort
85-
%EXPOSE_ANY_CHANNEL_PREFIX% - channelName: default
86-
%EXPOSE_ADMIN_PORT_PREFIX% nodePort: %ADMIN_NODE_PORT%
87-
# Uncomment to export the T3Channel as a service
88-
%EXPOSE_T3_CHANNEL_PREFIX% - channelName: T3Channel
60+
serverPod:
61+
# an (optional) list of environment variable to be set on the servers
62+
env:
63+
- name: JAVA_OPTIONS
64+
value: "%JAVA_OPTIONS%"
65+
- name: USER_MEM_ARGS
66+
value: "-Djava.security.egd=file:/dev/./urandom "
67+
%OPTIONAL_SERVERPOD_RESOURCES%
68+
%LOG_HOME_ON_PV_PREFIX%volumes:
69+
%LOG_HOME_ON_PV_PREFIX% - name: 'weblogic-domain-storage-volume'
70+
%LOG_HOME_ON_PV_PREFIX% persistentVolumeClaim:
71+
%LOG_HOME_ON_PV_PREFIX% claimName: '%DOMAIN_PVC_NAME%'
72+
%LOG_HOME_ON_PV_PREFIX%volumeMounts:
73+
%LOG_HOME_ON_PV_PREFIX% - name: 'weblogic-domain-storage-volume'
74+
%LOG_HOME_ON_PV_PREFIX% mountPath: %DOMAIN_ROOT_DIR%
8975

76+
# adminServer is used to configure the desired behavior for starting the administration server.
77+
adminServer:
78+
%EXPOSE_ANY_CHANNEL_PREFIX%adminService:
79+
%EXPOSE_ANY_CHANNEL_PREFIX% channels:
80+
# The Admin Server's NodePort
81+
%EXPOSE_ANY_CHANNEL_PREFIX% - channelName: default
82+
%EXPOSE_ADMIN_PORT_PREFIX% nodePort: %ADMIN_NODE_PORT%
83+
# Uncomment to export the T3Channel as a service
84+
%EXPOSE_T3_CHANNEL_PREFIX% - channelName: T3Channel
85+
86+
# References to Cluster resources that describe the lifecycle options for all
87+
# the Managed Server members of a WebLogic cluster, including Java
88+
# options, environment variables, additional Pod content, and the ability to
89+
# explicitly start, stop, or restart cluster members. The Cluster resource
90+
# must describe a cluster that already exists in the WebLogic domain
91+
# configuration.
92+
clusters:
93+
- name: %DOMAIN_UID%-%CLUSTER_NAME%
94+
95+
# clusters is used to configure the desired behavior for starting member servers of a cluster.
96+
# If you use this entry, then the rules will be applied to ALL servers that are members of the named clusters.
97+
clusters:
98+
- metadata:
99+
name: %DOMAIN_UID%-%CLUSTER_NAME%
100+
namespace: "%NAMESPACE%"
101+
spec:
102+
clusterName: %CLUSTER_NAME%
103+
replicas: %INITIAL_MANAGED_SERVER_REPLICAS%

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ domainUID: domain1
2727
domainHome: /u01/oracle/user_projects/domains/domain1
2828

2929
# Determines which WebLogic Servers the operator will start up
30-
# Legal values are "NEVER", "IF_NEEDED", or "ADMIN_ONLY"
31-
serverStartPolicy: IF_NEEDED
30+
# Legal values are "Never", "IfNeeded", or "AdminOnly"
31+
serverStartPolicy: IfNeeded
3232

3333
# Cluster name
3434
clusterName: cluster-1

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ domainUID: domain1
1818
# If not specified, the value is derived from the domainUID as /shared/domains/<domainUID>
1919
domainHome: /shared/domains/domain1
2020

21+
domainHomeSourceType:
22+
2123
# Determines which WebLogic Servers the operator will start up
22-
# Legal values are "NEVER", "IF_NEEDED", or "ADMIN_ONLY"
23-
serverStartPolicy: IF_NEEDED
24+
# Legal values are "Never", "IfNeeded", or "AdminOnly"
25+
serverStartPolicy: IfNeeded
2426

2527
# Cluster name
2628
clusterName: cluster-1

0 commit comments

Comments
 (0)