10
10
import com .google .gson .annotations .SerializedName ;
11
11
import io .kubernetes .client .models .V1LocalObjectReference ;
12
12
import io .kubernetes .client .models .V1SecretReference ;
13
- import java .util .Collections ;
14
- import java .util .HashMap ;
15
- import java .util .List ;
16
- import java .util .Map ;
17
- import java .util .Optional ;
13
+ import java .util .*;
18
14
import javax .annotation .Nonnull ;
19
15
import javax .annotation .Nullable ;
20
16
import javax .validation .Valid ;
21
17
import javax .validation .constraints .NotNull ;
22
18
import oracle .kubernetes .json .Description ;
23
19
import oracle .kubernetes .operator .KubernetesConstants ;
24
- import oracle .kubernetes .operator .VersionConstants ;
25
20
import oracle .kubernetes .weblogic .domain .EffectiveConfigurationFactory ;
26
21
import org .apache .commons .lang3 .builder .EqualsBuilder ;
27
22
import org .apache .commons .lang3 .builder .HashCodeBuilder ;
28
23
import org .apache .commons .lang3 .builder .ToStringBuilder ;
29
24
30
25
/** DomainSpec is a description of a domain. */
31
- @ SuppressWarnings ("NullableProblems" )
32
26
public class DomainSpec extends BaseConfiguration {
33
27
34
28
/** The pattern for computing the default persistent volume claim name. */
@@ -114,7 +108,8 @@ public class DomainSpec extends BaseConfiguration {
114
108
/** Whether to include the server .out file to the pod's stdout. Default is true. */
115
109
@ SerializedName ("includeServerOutInPodLog" )
116
110
@ Expose
117
- private String includeServerOutInPodLog ;
111
+ @ Description ("If true (the default), the server .out file will be included in the pod's stdout" )
112
+ private Boolean includeServerOutInPodLog ;
118
113
119
114
/**
120
115
* The WebLogic Docker image.
@@ -175,7 +170,7 @@ public class DomainSpec extends BaseConfiguration {
175
170
@ Expose
176
171
@ Description (
177
172
"Flag indicating whether the domain home is part of the image. Default value is true. " )
178
- private boolean domainHomeInImage = true ;
173
+ private Boolean domainHomeInImage ;
179
174
180
175
/** The definition of the storage used for this domain. */
181
176
@ SerializedName ("storage" )
@@ -236,7 +231,7 @@ public class DomainSpec extends BaseConfiguration {
236
231
@ Description ("Configuration for the clusters" )
237
232
protected Map <String , Cluster > clusters = new HashMap <>();
238
233
239
- public AdminServer getOrCreateAdminServer (String adminServerName ) {
234
+ AdminServer getOrCreateAdminServer (String adminServerName ) {
240
235
if (adminServer != null ) return adminServer ;
241
236
242
237
return createAdminServer (adminServerName );
@@ -249,14 +244,11 @@ private AdminServer createAdminServer(String adminServerName) {
249
244
return adminServer ;
250
245
}
251
246
247
+ @ SuppressWarnings ("unused" )
252
248
EffectiveConfigurationFactory getEffectiveConfigurationFactory (String resourceVersionLabel ) {
253
249
return new V2EffectiveConfigurationFactory ();
254
250
}
255
251
256
- private boolean isVersion2Specified (String resourceVersionLabel ) {
257
- return VersionConstants .DOMAIN_V2 .equals (resourceVersionLabel );
258
- }
259
-
260
252
/**
261
253
* Domain unique identifier. Must be unique across the Kubernetes cluster. (Required)
262
254
*
@@ -321,7 +313,7 @@ public DomainSpec withDomainName(String domainName) {
321
313
* @since 2.0
322
314
* @return domain home
323
315
*/
324
- public String getDomainHome () {
316
+ String getDomainHome () {
325
317
return domainHome ;
326
318
}
327
319
@@ -346,33 +338,6 @@ public DomainSpec withImage(String image) {
346
338
return this ;
347
339
}
348
340
349
- /**
350
- * The image pull policy for the WebLogic Docker image. Legal values are Always, Never and
351
- * IfNotPresent.
352
- *
353
- * <p>Defaults to Always if image ends in :latest, IfNotPresent otherwise.
354
- *
355
- * <p>More info: https://kubernetes.io/docs/concepts/containers/images#updating-images
356
- *
357
- * @param imagePullPolicy image pull policy
358
- * @return this
359
- */
360
- public DomainSpec withImagePullPolicy (String imagePullPolicy ) {
361
- setImagePullPolicy (imagePullPolicy );
362
- return this ;
363
- }
364
-
365
- /**
366
- * The name of the secret used to authenticate a request for an image pull.
367
- *
368
- * <p>More info:
369
- * https://kubernetes.io/docs/concepts/containers/images/#referring-to-an-imagepullsecrets-on-a-pod
370
- */
371
- public DomainSpec withImagePullSecretName (String imagePullSecretName ) {
372
- setImagePullSecret (new V1LocalObjectReference ().name (imagePullSecretName ));
373
- return this ;
374
- }
375
-
376
341
public V1SecretReference getAdminSecret () {
377
342
return adminSecret ;
378
343
}
@@ -398,7 +363,7 @@ public String getAsName() {
398
363
return asName ;
399
364
}
400
365
401
- public void setAsName (String asName ) {
366
+ private void setAsName (String asName ) {
402
367
this .asName = asName ;
403
368
}
404
369
@@ -486,11 +451,6 @@ public void setLogHome(String logHome) {
486
451
this .logHome = logHome ;
487
452
}
488
453
489
- public DomainSpec withLogHome (String logHome ) {
490
- this .logHome = logHome ;
491
- return this ;
492
- }
493
-
494
454
/**
495
455
* Log home enabled
496
456
*
@@ -520,20 +480,12 @@ public void setLogHomeEnabled(boolean logHomeEnabled) {
520
480
* @return whether server .out should be included in pod's stdout.
521
481
* @since 2.0
522
482
*/
523
- public String getIncludeServerOutInPodLog () {
524
- return Optional .ofNullable (getConfiguredIncludeServerOutInPodLog () )
483
+ boolean getIncludeServerOutInPodLog () {
484
+ return Optional .ofNullable (includeServerOutInPodLog )
525
485
.orElse (KubernetesConstants .DEFAULT_INCLUDE_SERVER_OUT_IN_POD_LOG );
526
486
}
527
487
528
- String getConfiguredIncludeServerOutInPodLog () {
529
- return includeServerOutInPodLog ;
530
- }
531
-
532
- public void setIncludeServerOutInPodLog (String includeServerOutInPodLog ) {
533
- this .includeServerOutInPodLog = includeServerOutInPodLog ;
534
- }
535
-
536
- public DomainSpec withIncludeServerOutInPodLog (String includeServerOutInPodLog ) {
488
+ public DomainSpec withIncludeServerOutInPodLog (boolean includeServerOutInPodLog ) {
537
489
this .includeServerOutInPodLog = includeServerOutInPodLog ;
538
490
return this ;
539
491
}
@@ -544,26 +496,17 @@ public DomainSpec withIncludeServerOutInPodLog(String includeServerOutInPodLog)
544
496
* @return true or false
545
497
* @since 2.0
546
498
*/
547
- public boolean isDomainHomeInImage () {
548
- return domainHomeInImage ;
549
- }
550
-
551
- /** @param domainHomeInImage */
552
- public void setDomainHomeInImage (boolean domainHomeInImage ) {
553
- this .domainHomeInImage = domainHomeInImage ;
499
+ boolean isDomainHomeInImage () {
500
+ return Optional .ofNullable (domainHomeInImage ).orElse (true );
554
501
}
555
502
556
503
/**
557
- * Replicas is the desired number of managed servers running in each WebLogic cluster that is not
558
- * configured in clusters. Provided so that administrators can scale the Domain resource.
504
+ * Specifies whether the domain home is stored in the image
559
505
*
560
- * @deprecated use {@link Domain#getReplicaCount(String)} to obtain the effective setting.
561
- * @return replicas
506
+ * @param domainHomeInImage true if the domain home is in the image
562
507
*/
563
- @ SuppressWarnings ("DeprecatedIsStillUsed" )
564
- @ Deprecated
565
- public Integer getReplicas () {
566
- return replicas != null ? replicas : 0 ;
508
+ public void setDomainHomeInImage (boolean domainHomeInImage ) {
509
+ this .domainHomeInImage = domainHomeInImage ;
567
510
}
568
511
569
512
/**
@@ -572,7 +515,6 @@ public Integer getReplicas() {
572
515
*
573
516
* @param replicas replicas
574
517
*/
575
- @ SuppressWarnings ("deprecation" )
576
518
public void setReplicas (Integer replicas ) {
577
519
this .replicas = replicas ;
578
520
}
@@ -584,7 +526,6 @@ public void setReplicas(Integer replicas) {
584
526
* @param replicas replicas
585
527
* @return this
586
528
*/
587
- @ SuppressWarnings ("deprecation" )
588
529
public DomainSpec withReplicas (Integer replicas ) {
589
530
this .replicas = replicas ;
590
531
return this ;
@@ -609,11 +550,11 @@ public DomainStorage getStorage() {
609
550
}
610
551
611
552
@ Nullable
612
- public String getConfigOverrides () {
553
+ String getConfigOverrides () {
613
554
return configOverrides ;
614
555
}
615
556
616
- public void setConfigOverrides (@ Nullable String overridess ) {
557
+ void setConfigOverrides (@ Nullable String overridess ) {
617
558
this .configOverrides = overridess ;
618
559
}
619
560
@@ -627,7 +568,7 @@ private boolean hasConfigOverrideSecrets() {
627
568
}
628
569
629
570
@ Nullable
630
- public List <String > getConfigOverrideSecrets () {
571
+ List <String > getConfigOverrideSecrets () {
631
572
if (hasConfigOverrideSecrets ()) return configOverrideSecrets ;
632
573
else return Collections .emptyList ();
633
574
}
@@ -636,11 +577,6 @@ public void setConfigOverrideSecrets(@Nullable List<String> overridesSecretNames
636
577
this .configOverrideSecrets = overridesSecretNames ;
637
578
}
638
579
639
- public DomainSpec withConfigOverrideSecrets (@ Nullable List <String > overridesSecretNames ) {
640
- this .configOverrideSecrets = overridesSecretNames ;
641
- return this ;
642
- }
643
-
644
580
/**
645
581
* Returns the name of the persistent volume claim for the logs and PV-based domain.
646
582
*
@@ -770,15 +706,15 @@ private boolean hasReplicaCount(Cluster cluster) {
770
706
return cluster != null && cluster .getReplicas () != null ;
771
707
}
772
708
773
- public AdminServer getAdminServer () {
709
+ private AdminServer getAdminServer () {
774
710
return Optional .ofNullable (adminServer ).orElse (AdminServer .NULL_ADMIN_SERVER );
775
711
}
776
712
777
- public void setAdminServer (AdminServer adminServer ) {
713
+ private void setAdminServer (AdminServer adminServer ) {
778
714
this .adminServer = adminServer ;
779
715
}
780
716
781
- public Map <String , ManagedServer > getManagedServers () {
717
+ Map <String , ManagedServer > getManagedServers () {
782
718
return managedServers ;
783
719
}
784
720
0 commit comments