Skip to content

Commit b9b56b1

Browse files
authored
Merge pull request #1199 from oracle/owls-74699
OWLS-74699 Add serverPod resources requests and limits input values to create domain samples
2 parents bfc927e + 8dbf835 commit b9b56b1

File tree

9 files changed

+94
-2
lines changed

9 files changed

+94
-2
lines changed

docs-source/content/samples/simple/domains/domain-home-in-image/_index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ The following parameters can be provided in the inputs file.
149149
| `t3ChannelPort` | Port for the T3 channel of the NetworkAccessPoint. | `30012` |
150150
| `t3PublicAddress` | Public address for the T3 channel. This should be set to the public address of the Kubernetes cluster. This would normally be a load balancer address. <p/>For development environments only: In a single server (all-in-one) Kubernetes deployment, this may be set to the address of the master, or at the very least, it must be set to the address of one of the worker nodes. | If not provided, the script will attempt to set it to the IP address of the kubernetes cluster |
151151
| `weblogicCredentialsSecretName` | Name of the Kubernetes secret for the Administration Server's user name and password. | `domain1-weblogic-credentials` |
152+
| `serverPodCpuRequest`, `serverPodMemoryRequest`, `serverPodCpuCLimit`, `serverPodMemoryLimit` | The maximum amount of compute resources allowed, and minimum amount of compute resources required, for each server pod. Please refer to the Kubernetes documentation on `Managing Compute Resources for Containers` for details. | Resource requests and resource limits are not specified. |
152153

153154
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 `("-")`.
154155

docs-source/content/samples/simple/domains/domain-home-on-pv/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ The following parameters can be provided in the inputs file.
106106
| `t3PublicAddress` | Public address for the T3 channel. This should be set to the public address of the Kubernetes cluster. This would normally be a load balancer address. <p/>For development environments only: In a single server (all-in-one) Kubernetes deployment, this may be set to the address of the master, or at the very least, it must be set to the address of one of the worker nodes. | If not provided, the script will attempt to set it to the IP address of the Kubernetes cluster |
107107
| `weblogicCredentialsSecretName` | Name of the Kubernetes secret for the Administration Server's user name and password. If not specified, the value is derived from the `domainUID` as `<domainUID>-weblogic-credentials`. | `domain1-weblogic-credentials` |
108108
| `weblogicImagePullSecretName` | Name of the Kubernetes secret for the Docker Store, used to pull the WebLogic Server image. | `docker-store-secret` |
109-
109+
| `serverPodCpuRequest`, `serverPodMemoryRequest`, `serverPodCpuCLimit`, `serverPodMemoryLimit` | The maximum amount of compute resources allowed, and minimum amount of compute resources required, for each server pod. Please refer to the Kubernetes documentation on `Managing Compute Resources for Containers` for details. | Resource requests and resource limits are not specified. |
110110
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 `("-")`.
111111

112112
The sample demonstrates how to create a WebLogic domain home and associated Kubernetes resources for a domain that only has one cluster. In addition, the sample provides the capability for users to supply their own scripts to create the domain home for other use cases. The generated domain YAML file could also be modified to cover more use cases.

docs-source/content/samples/simple/domains/fmw-domain/_index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ The following parameters can be provided in the inputs file.
132132
| `t3PublicAddress` | Public address for the T3 channel. This should be set to the public address of the Kubernetes cluster. This would normally be a load balancer address. <p/>For development environments only: In a single server (all-in-one) Kubernetes deployment, this may be set to the address of the master, or at the very least, it must be set to the address of one of the worker nodes. | If not provided, the script will attempt to set it to the IP address of the Kubernetes cluster |
133133
| `weblogicCredentialsSecretName` | Name of the Kubernetes secret for the Administration Server's user name and password. If not specified, then the value is derived from the `domainUID` as `<domainUID>-weblogic-credentials`. | `domain1-weblogic-credentials` |
134134
| `weblogicImagePullSecretName` | Name of the Kubernetes secret for the Docker Store, used to pull the WebLogic Server image. | `docker-store-secret` |
135+
| `serverPodCpuRequest`, `serverPodMemoryRequest`, `serverPodCpuCLimit`, `serverPodMemoryLimit` | The maximum amount of compute resources allowed, and minimum amount of compute resources required, for each server pod. Please refer to the Kubernetes documentation on `Managing Compute Resources for Containers` for details. | Resource requests and resource limits are not specified. |
135136
| `rcuSchemaPrefix` | The schema prefix to use in the database, for example `SOA1`. You may wish to make this the same as the domainUID in order to simplify matching domains to their RCU schemas. | `domain1` |
136137
| `rcuDatabaseURL` | The database URL. | `database:1521/service` |
137138
| `rcuCredentialsSecret` | The Kubernetes secret containing the database credentials. | `domain1-rcu-credentials` |

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ spec:
6363
value: "%JAVA_OPTIONS%"
6464
- name: USER_MEM_ARGS
6565
value: "-XX:+UseContainerSupport -Djava.security.egd=file:/dev/./urandom "
66+
%OPTIONAL_SERVERPOD_RESOURCES%
6667
%LOG_HOME_ON_PV_PREFIX%volumes:
6768
%LOG_HOME_ON_PV_PREFIX%- name: weblogic-domain-storage-volume
6869
%LOG_HOME_ON_PV_PREFIX% persistentVolumeClaim:

kubernetes/samples/scripts/common/utility.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,40 @@ function getKubernetesClusterIP {
213213

214214
}
215215

216+
#
217+
# Function to set the serverPodResources variable for including into the generated
218+
# domain.yaml, base on the serverPod resource requests and limits input values,
219+
# if specified.
220+
# The serverPodResources variable remains unset if none of the input values are provided.
221+
#
222+
function buildServerPodResources {
223+
224+
if [ -n "${serverPodMemoryRequest}" ]; then
225+
local memoryRequest=" memory\: \"${serverPodMemoryRequest}\"\n"
226+
fi
227+
if [ -n "${serverPodCpuRequest}" ]; then
228+
local cpuRequest=" cpu\: \"${serverPodCpuRequest}\"\n"
229+
fi
230+
if [ -n "${memoryRequest}" ] || [ -n "${cpuRequest}" ]; then
231+
local requests=" requests\: \n$memoryRequest $cpuRequest"
232+
fi
233+
234+
if [ -n "${serverPodMemoryLimit}" ]; then
235+
local memoryLimit=" memory\: \"${serverPodMemoryLimit}\"\n"
236+
fi
237+
if [ -n "${serverPodCpuLimit}" ]; then
238+
local cpuLimit=" cpu\: \"${serverPodCpuLimit}\"\n"
239+
fi
240+
if [ -n "${memoryLimit}" ] || [ -n "${cpuLimit}" ]; then
241+
local limits=" limits\: \n$memoryLimit $cpuLimit"
242+
fi
243+
244+
if [ -n "${requests}" ] || [ -n "${limits}" ]; then
245+
# build resources element and remove last '\n'
246+
serverPodResources=$(echo "resources\:\n${requests}${limits}" | sed -e 's/\\n$//')
247+
fi
248+
}
249+
216250
#
217251
# Function to generate the properties and yaml files for creating a domain
218252
#
@@ -437,6 +471,13 @@ function createFiles {
437471
sed -i -e "s:%ISTIO_ENABLED%:${istioEnabled}:g" ${dcrOutput}
438472
sed -i -e "s:%ISTIO_READINESS_PORT%:${istioReadinessPort}:g" ${dcrOutput}
439473

474+
buildServerPodResources
475+
if [ -z "${serverPodResources}" ]; then
476+
sed -i -e "/%OPTIONAL_SERVERPOD_RESOURCES%/d" ${dcrOutput}
477+
else
478+
sed -i -e "s:%OPTIONAL_SERVERPOD_RESOURCES%:${serverPodResources}:g" ${dcrOutput}
479+
fi
480+
440481
if [ "${domainHomeInImage}" == "true" ]; then
441482

442483
# now we know which image to use, update the domain yaml file

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,18 @@ domainHomeImageBase: container-registry.oracle.com/middleware/fmw-infrastructure
135135
# which uses WDT, instead of WLST, to generate the domain configuration.
136136
domainHomeImageBuildPath: ./docker-images/OracleFMWInfrastructure/samples/12213-domain-home-in-image
137137

138+
# Uncomment and edit value(s) below to specify the maximum amount of
139+
# compute resources allowed, and minimum amount of compute resources
140+
# required for each server pod.
141+
# These are optional.
142+
# Please refer to the kubernetes documentation on Managing Compute
143+
# Resources for Containers for details.
144+
#
145+
# serverPodMemoryRequest: "64Mi"
146+
# serverPodCpuRequest: "250m"
147+
# serverPodMemoryLimit: "1Gi"
148+
# serverPodCpuLimit: "1000m"
149+
138150
#
139151
# RCU configuration details
140152
#

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,17 @@ createDomainScriptName: create-domain-job.sh
135135
# so that the Kubernetes pod can use the scripts and supporting files to create a domain home.
136136
createDomainFilesDir: wlst
137137

138+
# Uncomment and edit value(s) below to specify the maximum amount of
139+
# compute resources allowed, and minimum amount of compute resources
140+
# required for each server pod.
141+
# These are optional.
142+
# Please refer to the kubernetes documentation on Managing Compute
143+
# Resources for Containers for details.
144+
#
145+
# serverPodMemoryRequest: "64Mi"
146+
# serverPodCpuRequest: "250m"
147+
# serverPodMemoryLimit: "1Gi"
148+
# serverPodCpuLimit: "1000m"
138149

139150
#
140151
# RCU configuration details

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,3 +134,16 @@ domainHomeImageBase: container-registry.oracle.com/middleware/weblogic:12.2.1.3
134134
# Another possible value is "./docker-images/OracleWebLogic/samples/12213-domain-home-in-image-wdt",
135135
# which uses WDT, instead of WLST, to generate the domain configuration.
136136
domainHomeImageBuildPath: ./docker-images/OracleWebLogic/samples/12213-domain-home-in-image
137+
138+
# Uncomment and edit value(s) below to specify the maximum amount of
139+
# compute resources allowed, and minimum amount of compute resources
140+
# required for each server pod.
141+
# These are optional.
142+
# Please refer to the kubernetes documentation on Managing Compute
143+
# Resources for Containers for details.
144+
#
145+
# serverPodMemoryRequest: "64Mi"
146+
# serverPodCpuRequest: "250m"
147+
# serverPodMemoryLimit: "1Gi"
148+
# serverPodCpuLimit: "1000m"
149+

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,22 @@ createDomainScriptName: create-domain-job.sh
135135
# so that the Kubernetes pod can use the scripts and supporting files to create a domain home.
136136
createDomainFilesDir: wlst
137137

138+
# Uncomment and edit value(s) below to specify the maximum amount of
139+
# compute resources allowed, and minimum amount of compute resources
140+
# required for each server pod.
141+
# These are optional.
142+
# Please refer to the kubernetes documentation on Managing Compute
143+
# Resources for Containers for details.
144+
#
145+
# serverPodMemoryRequest: "64Mi"
146+
# serverPodCpuRequest: "250m"
147+
# serverPodMemoryLimit: "1Gi"
148+
# serverPodCpuLimit: "1000m"
149+
138150
# Istio service mesh support is experimental.
139151
# istioEnabled specifies whether or not it is deployed under Istio.
140152
istioEnabled: false
141153

142154
# Istio service mesh support is experimental.
143155
# istioReadinessPort specifies the WebLogic NAP port for use by the readiness probe
144-
istioReadinessPort: 8888
156+
istioReadinessPort: 8888

0 commit comments

Comments
 (0)