@@ -259,6 +259,7 @@ public static Domain createDomainResource(
259259 * @param dbSecretName name of the Secret for WebLogic configuration overrides
260260 * @param allowReplicasBelowMinDynClusterSize whether to allow scaling below min dynamic cluster size
261261 * @param onlineUpdateEnabled whether to enable onlineUpdate feature for mii dynamic update
262+ * @param setDataHome whether to set data home at domain resource
262263 * @return domain object of the domain resource
263264 */
264265 public static Domain createDomainResourceWithLogHome (
@@ -275,69 +276,74 @@ public static Domain createDomainResourceWithLogHome(
275276 String configMapName ,
276277 String dbSecretName ,
277278 boolean allowReplicasBelowMinDynClusterSize ,
278- boolean onlineUpdateEnabled ) {
279+ boolean onlineUpdateEnabled ,
280+ boolean setDataHome ) {
279281 LoggingFacade logger = getLogger ();
280282
281283 List <String > securityList = new ArrayList <>();
282284 if (dbSecretName != null ) {
283285 securityList .add (dbSecretName );
284286 }
285287
288+ DomainSpec domainSpec = new DomainSpec ()
289+ .domainUid (domainResourceName )
290+ .domainHomeSourceType ("FromModel" )
291+ .allowReplicasBelowMinDynClusterSize (allowReplicasBelowMinDynClusterSize )
292+ .image (imageName )
293+ .addImagePullSecretsItem (new V1LocalObjectReference ()
294+ .name (repoSecretName ))
295+ .webLogicCredentialsSecret (new V1SecretReference ()
296+ .name (adminSecretName )
297+ .namespace (domNamespace ))
298+ .includeServerOutInPodLog (true )
299+ .logHomeEnabled (Boolean .TRUE )
300+ .logHome ("/shared/logs" )
301+ .serverStartPolicy ("IF_NEEDED" )
302+ .serverPod (new ServerPod ()
303+ .addEnvItem (new V1EnvVar ()
304+ .name ("JAVA_OPTIONS" )
305+ .value ("-Dweblogic.security.SSL.ignoreHostnameVerification=true" ))
306+ .addEnvItem (new V1EnvVar ()
307+ .name ("USER_MEM_ARGS" )
308+ .value ("-Djava.security.egd=file:/dev/./urandom " ))
309+ .addVolumesItem (new V1Volume ()
310+ .name (pvName )
311+ .persistentVolumeClaim (new V1PersistentVolumeClaimVolumeSource ()
312+ .claimName (pvcName )))
313+ .addVolumeMountsItem (new V1VolumeMount ()
314+ .mountPath ("/shared" )
315+ .name (pvName )))
316+ .adminServer (new AdminServer ()
317+ .serverStartState ("RUNNING" )
318+ .adminService (new AdminService ()
319+ .addChannelsItem (new Channel ()
320+ .channelName ("default" )
321+ .nodePort (0 ))))
322+ .addClustersItem (new Cluster ()
323+ .clusterName (clusterName )
324+ .replicas (replicaCount )
325+ .serverStartState ("RUNNING" ))
326+ .configuration (new Configuration ()
327+ .secrets (securityList )
328+ .model (new Model ()
329+ .domainType ("WLS" )
330+ .configMap (configMapName )
331+ .runtimeEncryptionSecret (encryptionSecretName )
332+ .onlineUpdate (new OnlineUpdate ()
333+ .enabled (onlineUpdateEnabled )))
334+ .introspectorJobActiveDeadlineSeconds (300L ));
335+
336+ if (setDataHome ) {
337+ domainSpec .dataHome ("/shared/data" );
338+ }
286339 // create the domain CR
287340 Domain domain = new Domain ()
288341 .apiVersion (DOMAIN_API_VERSION )
289342 .kind ("Domain" )
290343 .metadata (new V1ObjectMeta ()
291344 .name (domainResourceName )
292345 .namespace (domNamespace ))
293- .spec (new DomainSpec ()
294- .domainUid (domainResourceName )
295- .domainHomeSourceType ("FromModel" )
296- .allowReplicasBelowMinDynClusterSize (allowReplicasBelowMinDynClusterSize )
297- .image (imageName )
298- .addImagePullSecretsItem (new V1LocalObjectReference ()
299- .name (repoSecretName ))
300- .webLogicCredentialsSecret (new V1SecretReference ()
301- .name (adminSecretName )
302- .namespace (domNamespace ))
303- .includeServerOutInPodLog (true )
304- .logHomeEnabled (Boolean .TRUE )
305- .logHome ("/shared/logs" )
306- .dataHome ("/shared/data" )
307- .serverStartPolicy ("IF_NEEDED" )
308- .serverPod (new ServerPod ()
309- .addEnvItem (new V1EnvVar ()
310- .name ("JAVA_OPTIONS" )
311- .value ("-Dweblogic.security.SSL.ignoreHostnameVerification=true" ))
312- .addEnvItem (new V1EnvVar ()
313- .name ("USER_MEM_ARGS" )
314- .value ("-Djava.security.egd=file:/dev/./urandom " ))
315- .addVolumesItem (new V1Volume ()
316- .name (pvName )
317- .persistentVolumeClaim (new V1PersistentVolumeClaimVolumeSource ()
318- .claimName (pvcName )))
319- .addVolumeMountsItem (new V1VolumeMount ()
320- .mountPath ("/shared" )
321- .name (pvName )))
322- .adminServer (new AdminServer ()
323- .serverStartState ("RUNNING" )
324- .adminService (new AdminService ()
325- .addChannelsItem (new Channel ()
326- .channelName ("default" )
327- .nodePort (0 ))))
328- .addClustersItem (new Cluster ()
329- .clusterName (clusterName )
330- .replicas (replicaCount )
331- .serverStartState ("RUNNING" ))
332- .configuration (new Configuration ()
333- .secrets (securityList )
334- .model (new Model ()
335- .domainType ("WLS" )
336- .configMap (configMapName )
337- .runtimeEncryptionSecret (encryptionSecretName )
338- .onlineUpdate (new OnlineUpdate ()
339- .enabled (onlineUpdateEnabled )))
340- .introspectorJobActiveDeadlineSeconds (300L )));
346+ .spec (domainSpec );
341347
342348 logger .info ("Create domain custom resource for domainUid {0} in namespace {1}" ,
343349 domainResourceName , domNamespace );
0 commit comments