@@ -129,8 +129,8 @@ function validateClusterName {
129
129
# When the parameter is not specified in the input file, it will default to use the value domainUid
130
130
#
131
131
function validateStorageClass {
132
- if [ -z $ persistenceStorageClass ]; then
133
- persistenceStorageClass=$domainUid
132
+ if [ -z " ${ persistenceStorageClass} " ]; then
133
+ persistenceStorageClass=${ domainUid}
134
134
echo Defaulting the input parameter persistenceStorageClass to be $domainUid
135
135
else
136
136
validateLowerCase " persistenceStorageClass" ${persistenceStorageClass}
@@ -141,25 +141,51 @@ function validateStorageClass {
141
141
# Function to validate the persistent volume claim name
142
142
#
143
143
function validatePersistentVolumeClaimName {
144
- validateLowerCase " persistenceVolumeClaimName" ${persistenceVolumeClaimName}
145
-
146
- if [[ ${persistenceVolumeClaimName} != ${domainUid} -* ]] ; then
147
- echo persistenceVolumeClaimName specified does not starts with \' ${domainUid} -\' , appending it
148
- persistenceVolumeClaimName=${domainUid} -${persistenceVolumeClaimName}
149
- echo persistenceVolumeClaimName is now ${persistenceVolumeClaimName}
144
+ validateInputParamsSpecified persistenceVolumeClaimName
145
+ if [ ! -z " ${persistenceVolumeClaimName} " ]; then
146
+ validateLowerCase " persistenceVolumeClaimName" ${persistenceVolumeClaimName}
147
+ if [[ " ${persistenceVolumeClaimName} " != ${domainUid} -* ]] ; then
148
+ echo persistenceVolumeClaimName specified does not starts with \' ${domainUid} -\' , appending it
149
+ persistenceVolumeClaimName=${domainUid} -${persistenceVolumeClaimName}
150
+ echo persistenceVolumeClaimName is now ${persistenceVolumeClaimName}
151
+ fi
150
152
fi
151
153
}
152
154
153
155
#
154
156
# Function to validate the persistent volume name
155
157
#
156
- function validatePersistenVolumeName {
157
- validateLowerCase " persistenceVolumeName" ${persistenceVolumeName}
158
+ function validatePersistentVolumeName {
159
+ validateInputParamsSpecified persistenceVolumeName
160
+ if [ ! -z " ${persistenceVolumeName} " ]; then
161
+ validateLowerCase " persistenceVolumeName" ${persistenceVolumeName}
162
+ if [[ " ${persistenceVolumeName} " != ${domainUid} -* ]] ; then
163
+ echo persistenceVolumeName specified does not starts with \' ${domainUid} -\' , appending it
164
+ persistenceVolumeName=${domainUid} -${persistenceVolumeName}
165
+ echo persistenceVolumeName is now ${persistenceVolumeName}
166
+ fi
167
+ fi
168
+ }
158
169
159
- if [[ ${persistenceVolumeName} != ${domainUid} -* ]] ; then
160
- echo persistenceVolumeName specified does not starts with \' ${domainUid} -\' , appending it
161
- persistenceVolumeName=${domainUid} -${persistenceVolumeName}
162
- echo persistenceVolumeName is now ${persistenceVolumeName}
170
+ #
171
+ # Function to validate the persistence type
172
+ #
173
+ function validatePersistenceType {
174
+ validateInputParamsSpecified persistenceType
175
+ if [ ! -z " ${persistenceType} " ]; then
176
+ PERSISTENCE_TYPE_HOST_PATH=" hostPath"
177
+ PERSISTENCE_TYPE_NFS=" nfs"
178
+ case ${persistenceType} in
179
+ ${PERSISTENCE_TYPE_HOST_PATH} )
180
+ ;;
181
+ ${PERSISTENCE_TYPE_NFS} )
182
+ validateInputParamsSpecified nfsServer
183
+ ;;
184
+ * )
185
+ validationError " Invalid value for persistenceType: ${persistenceType} . Valid values are hostPath and nfs."
186
+ validationError " Invalid value for loadBalancer: ${loadBalancer} . Valid values are traefik and none."
187
+ ;;
188
+ esac
163
189
fi
164
190
}
165
191
@@ -174,18 +200,20 @@ function validateSecretName {
174
200
# Function to validate the load balancer value
175
201
#
176
202
function validateLoadBalancer {
177
- LOAD_BALANCER_TRAEFIK=" traefik"
178
- LOAD_BALANCER_NONE=" none"
179
-
180
- case ${loadBalancer} in
181
- ${LOAD_BALANCER_TRAEFIK} )
182
- ;;
183
- ${LOAD_BALANCER_NONE} )
184
- ;;
185
- * )
186
- validationError " Invalid valid for loadBalancer: ${loadBalancer} . Valid values are traefik and none."
187
- ;;
188
- esac
203
+ validateInputParamsSpecified loadBalancer
204
+ if [ ! -z " ${loadBalancer} " ]; then
205
+ LOAD_BALANCER_TRAEFIK=" traefik"
206
+ LOAD_BALANCER_NONE=" none"
207
+ case ${loadBalancer} in
208
+ ${LOAD_BALANCER_TRAEFIK} )
209
+ ;;
210
+ ${LOAD_BALANCER_NONE} )
211
+ ;;
212
+ * )
213
+ validationError " Invalid value for loadBalancer: ${loadBalancer} . Valid values are traefik and none."
214
+ ;;
215
+ esac
216
+ fi
189
217
}
190
218
191
219
#
@@ -231,7 +259,6 @@ function validateImagePullSecretName {
231
259
# Function to validate the image pull secret exists
232
260
#
233
261
function validateImagePullSecret {
234
-
235
262
# The kubernetes secret for pulling images from the docker store is optional.
236
263
# If it was specified, make sure it exists.
237
264
validateSecretExists ${imagePullSecretName} ${namespace}
@@ -242,27 +269,29 @@ function validateImagePullSecret {
242
269
# Function to validate the server startup control value
243
270
#
244
271
function validateStartupControl {
245
- STARTUP_CONTROL_NONE=" NONE"
246
- STARTUP_CONTROL_ALL=" ALL"
247
- STARTUP_CONTROL_ADMIN=" ADMIN"
248
- STARTUP_CONTROL_SPECIFIED=" SPECIFIED"
249
- STARTUP_CONTROL_AUTO=" AUTO"
250
-
251
- case ${startupControl} in
252
- ${STARTUP_CONTROL_NONE} )
253
- ;;
254
- ${STARTUP_CONTROL_ALL} )
255
- ;;
256
- ${STARTUP_CONTROL_ADMIN} )
257
- ;;
258
- ${STARTUP_CONTROL_SPECIFIED} )
259
- ;;
260
- ${STARTUP_CONTROL_AUTO} )
261
- ;;
262
- * )
263
- validationError " Invalid valid for startupControl: ${startupControl} . Valid values are 'NONE', 'ALL', 'ADMIN', 'SPECIFIED', and 'AUTO'."
264
- ;;
265
- esac
272
+ validateInputParamsSpecified startupControl
273
+ if [ ! -z " ${startupControl} " ]; then
274
+ STARTUP_CONTROL_NONE=" NONE"
275
+ STARTUP_CONTROL_ALL=" ALL"
276
+ STARTUP_CONTROL_ADMIN=" ADMIN"
277
+ STARTUP_CONTROL_SPECIFIED=" SPECIFIED"
278
+ STARTUP_CONTROL_AUTO=" AUTO"
279
+ case ${startupControl} in
280
+ ${STARTUP_CONTROL_NONE} )
281
+ ;;
282
+ ${STARTUP_CONTROL_ALL} )
283
+ ;;
284
+ ${STARTUP_CONTROL_ADMIN} )
285
+ ;;
286
+ ${STARTUP_CONTROL_SPECIFIED} )
287
+ ;;
288
+ ${STARTUP_CONTROL_AUTO} )
289
+ ;;
290
+ * )
291
+ validationError " Invalid valid for startupControl: ${startupControl} . Valid values are 'NONE', 'ALL', 'ADMIN', 'SPECIFIED', and 'AUTO'."
292
+ ;;
293
+ esac
294
+ fi
266
295
}
267
296
268
297
#
@@ -334,13 +363,11 @@ function initialize {
334
363
managedServerNameBase \
335
364
persistencePath \
336
365
persistenceSize \
337
- persistenceVolumeClaimName \
338
366
persistenceVolumeName \
367
+ persistenceVolumeClaimName \
339
368
secretName \
340
369
namespace \
341
- loadBalancer \
342
370
javaOptions \
343
- startupControl \
344
371
t3PublicAddress
345
372
346
373
validateIntegerInputParamsSpecified \
@@ -362,7 +389,8 @@ function initialize {
362
389
validateNamespace
363
390
validateClusterName
364
391
validateStorageClass
365
- validatePersistenVolumeName
392
+ validatePersistenceType
393
+ validatePersistentVolumeName
366
394
validatePersistentVolumeClaimName
367
395
validateSecretName
368
396
validateImagePullSecretName
@@ -398,12 +426,23 @@ function createYamlFiles {
398
426
echo Generating ${domainPVOutput}
399
427
400
428
cp ${domainPVInput} ${domainPVOutput}
429
+ if [ " ${persistenceType} " == " nfs" ]; then
430
+ hostPathPrefix=" ${disabledPrefix} "
431
+ nfsPrefix=" ${enabledPrefix} "
432
+ sed -i -e " s:%NFS_SERVER%:${nfsServer} :g" ${domainPVOutput}
433
+ else
434
+ hostPathPrefix=" ${enabledPrefix} "
435
+ nfsPrefix=" ${disabledPrefix} "
436
+ fi
437
+
401
438
sed -i -e " s:%DOMAIN_UID%:${domainUid} :g" ${domainPVOutput}
402
439
sed -i -e " s:%NAMESPACE%:$namespace :g" ${domainPVOutput}
403
440
sed -i -e " s:%PERSISTENT_VOLUME%:${persistenceVolumeName} :g" ${domainPVOutput}
404
441
sed -i -e " s:%PERSISTENT_VOLUME_PATH%:${persistencePath} :g" ${domainPVOutput}
405
442
sed -i -e " s:%PERSISTENT_VOLUME_SIZE%:${persistenceSize} :g" ${domainPVOutput}
406
443
sed -i -e " s:%STORAGE_CLASS_NAME%:${persistenceStorageClass} :g" ${domainPVOutput}
444
+ sed -i -e " s:%HOST_PATH_PREFIX%:${hostPathPrefix} :g" ${domainPVOutput}
445
+ sed -i -e " s:%NFS_PREFIX%:${nfsPrefix} :g" ${domainPVOutput}
407
446
408
447
# Generate the yaml to create the persistent volume claim
409
448
echo Generating ${domainPVCOutput}
0 commit comments