Skip to content

Commit d9a3e6f

Browse files
committed
Merge branch 'develop' of https://github.com/oracle/weblogic-kubernetes-operator into feature/java-integration-tests
2 parents fcb7912 + b5d5846 commit d9a3e6f

File tree

21 files changed

+409
-35
lines changed

21 files changed

+409
-35
lines changed

kubernetes/samples/scripts/delete-weblogic-domain-resources.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,13 @@
1414

1515
script="${BASH_SOURCE[0]}"
1616
scriptDir="$( cd "$( dirname "${script}" )" && pwd )"
17-
source ${scriptDir}/internal/utility.sh
17+
source ${scriptDir}/../../internal/utility.sh
1818

1919
function usage {
2020
cat << EOF
2121
Usage:
2222
2323
$(basename $0) -d domain-uid,domain-uid,... [-s max-seconds] [-t]
24-
$(basename $0) -d all [-s max-seconds] [-t]
2524
$(basename $0) -h
2625
2726
Perform a best-effort delete of the kubernetes resources for
@@ -62,7 +61,6 @@ EOF
6261
#
6362
# Usage:
6463
# getDomainResources domainA,domainB,... outfilename
65-
# getDomainResources all outfilename
6664
#
6765
# Internal helper function
6866
#

model/src/main/java/oracle/kubernetes/weblogic/domain/AdminServerConfigurator.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,8 @@ public interface AdminServerConfigurator extends ServerConfigurator {
1616
AdminServerConfigurator withExportedNetworkAccessPoints(String... names);
1717

1818
ExportedNetworkAccessPoint configureExportedNetworkAccessPoint(String channelName);
19+
20+
AdminServerConfigurator withNodePortLabel(String name, String value);
21+
22+
AdminServerConfigurator withNodePortAnnotation(String name, String value);
1923
}

model/src/main/java/oracle/kubernetes/weblogic/domain/ClusterConfigurator.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,8 @@ ClusterConfigurator withLivenessProbeSettings(
4343
ClusterConfigurator withPodLabel(String name, String value);
4444

4545
ClusterConfigurator withPodAnnotation(String name, String value);
46+
47+
ClusterConfigurator withServiceLabel(String name, String value);
48+
49+
ClusterConfigurator withServiceAnnotation(String name, String value);
4650
}

model/src/main/java/oracle/kubernetes/weblogic/domain/DomainConfigurator.java

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ protected DomainConfigurator(Domain domain) {
3737
/**
3838
* Sets the home for the domain.
3939
*
40-
* @param home the home of the domain
40+
* @param domainHome the home of the domain
4141
* @return this object
4242
*/
4343
public DomainConfigurator withDomainHome(String domainHome) {
@@ -46,7 +46,7 @@ public DomainConfigurator withDomainHome(String domainHome) {
4646
}
4747

4848
/**
49-
* @param homeInImage
49+
* @param domainHomeInImage
5050
* @return
5151
*/
5252
public DomainConfigurator withDomainHomeInImage(boolean domainHomeInImage) {
@@ -110,6 +110,28 @@ public DomainConfigurator withDefaultImagePullSecrets(
110110
return this;
111111
}
112112

113+
/**
114+
* Sets the log home value
115+
*
116+
* @param logHome the log home value
117+
* @return this object
118+
*/
119+
public DomainConfigurator withLogHome(String logHome) {
120+
getDomainSpec().setLogHome(logHome);
121+
return this;
122+
}
123+
124+
/**
125+
* Sets the log home enabled flag
126+
*
127+
* @param logHomeEnabled true if log home is enabled, false otherwise
128+
* @return this object
129+
*/
130+
public DomainConfigurator withLogHomeEnabled(boolean logHomeEnabled) {
131+
getDomainSpec().setLogHomeEnabled(logHomeEnabled);
132+
return this;
133+
}
134+
113135
/**
114136
* Configures the domain to use a persistent volume claim defined before the domain is created.
115137
*

model/src/main/java/oracle/kubernetes/weblogic/domain/ServerConfigurator.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,8 @@ ServerConfigurator withReadinessProbeSettings(
4141
ServerConfigurator withPodLabel(String name, String value);
4242

4343
ServerConfigurator withPodAnnotation(String name, String value);
44+
45+
ServerConfigurator withServiceLabel(String name, String value);
46+
47+
ServerConfigurator withServiceAnnotation(String name, String value);
4448
}

model/src/main/java/oracle/kubernetes/weblogic/domain/v2/AdminServer.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ public String toString() {
5252
return new ToStringBuilder(this)
5353
.appendSuper(super.toString())
5454
.append("exportedNetworkAccessPoints", exportedNetworkAccessPoints)
55+
.append("nodePortLabels", nodePortLabels)
56+
.append("nodePortAnnotations", nodePortAnnotations)
5557
.toString();
5658
}
5759

@@ -66,6 +68,8 @@ public boolean equals(Object o) {
6668
return new EqualsBuilder()
6769
.appendSuper(super.equals(o))
6870
.append(exportedNetworkAccessPoints, that.exportedNetworkAccessPoints)
71+
.append(nodePortLabels, that.nodePortLabels)
72+
.append(nodePortAnnotations, that.nodePortAnnotations)
6973
.isEquals();
7074
}
7175

@@ -74,6 +78,20 @@ public int hashCode() {
7478
return new HashCodeBuilder(17, 37)
7579
.appendSuper(super.hashCode())
7680
.append(exportedNetworkAccessPoints)
81+
.append(nodePortLabels)
82+
.append(nodePortAnnotations)
7783
.toHashCode();
7884
}
85+
86+
private Map<String, String> nodePortLabels = new HashMap<>();
87+
88+
private Map<String, String> nodePortAnnotations = new HashMap<>();
89+
90+
void addNodePortLabels(String name, String value) {
91+
nodePortLabels.put(name, value);
92+
}
93+
94+
void addNodePortAnnotations(String name, String value) {
95+
nodePortAnnotations.put(name, value);
96+
}
7997
}

model/src/main/java/oracle/kubernetes/weblogic/domain/v2/BaseConfiguration.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,22 @@ void addPodAnnotations(String name, String value) {
194194
serverPod.addPodAnnotations(name, value);
195195
}
196196

197+
public Map<String, String> getServiceLabels() {
198+
return serverPod.getServiceLabels();
199+
}
200+
201+
void addServiceLabels(String name, String value) {
202+
serverPod.addServiceLabel(name, value);
203+
}
204+
205+
public Map<String, String> getServiceAnnotations() {
206+
return serverPod.getServiceAnnotations();
207+
}
208+
209+
void addServiceAnnotations(String name, String value) {
210+
serverPod.addServiceAnnotations(name, value);
211+
}
212+
197213
@Override
198214
public String toString() {
199215
return new ToStringBuilder(this)

model/src/main/java/oracle/kubernetes/weblogic/domain/v2/DomainSpec.java

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ public class DomainSpec extends BaseConfiguration {
3434
/** The pattern for computing the default persistent volume claim name. */
3535
private static final String PVC_NAME_PATTERN = "%s-weblogic-domain-pvc";
3636

37+
/** The pattern for computing the default shared logs directory. */
38+
private static final String LOG_HOME_DEFAULT_PATTERN = "/shared/logs/%s";
39+
3740
/** Domain unique identifier. Must be unique across the Kubernetes cluster. (Required) */
3841
@SerializedName("domainUID")
3942
@Expose
@@ -95,6 +98,19 @@ public class DomainSpec extends BaseConfiguration {
9598
@Expose
9699
private String logHome;
97100

101+
/**
102+
* Whether the log home is enabled.
103+
*
104+
* @since 2.0
105+
*/
106+
@SerializedName("logHomeEnabled")
107+
@Expose
108+
@Description(
109+
"Specified whether the log home folder is enabled (Not required). "
110+
+ "Defaults to true if domainHomeInImage is false. "
111+
+ "Defaults to false if domainHomeInImage is true. ")
112+
private Boolean logHomeEnabled; // Boolean object, null if unspecified
113+
98114
/** Whether to include the server .out file to the pod's stdout. Default is true. */
99115
@SerializedName("includeServerOutInPodLog")
100116
@Expose
@@ -157,7 +173,9 @@ public class DomainSpec extends BaseConfiguration {
157173
*/
158174
@SerializedName("domainHomeInImage")
159175
@Expose
160-
private boolean domainHomeInImage;
176+
@Description(
177+
"Flag indicating whether the domain home is part of the image. Default value is true. ")
178+
private boolean domainHomeInImage = true;
161179

162180
/** The definition of the storage used for this domain. */
163181
@SerializedName("storage")
@@ -461,7 +479,7 @@ public void setImagePullSecrets(@Nullable List<V1LocalObjectReference> imagePull
461479
* server .out files in.
462480
*/
463481
public String getLogHome() {
464-
return logHome;
482+
return Optional.ofNullable(logHome).orElse(String.format(LOG_HOME_DEFAULT_PATTERN, domainUID));
465483
}
466484

467485
public void setLogHome(String logHome) {
@@ -473,6 +491,29 @@ public DomainSpec withLogHome(String logHome) {
473491
return this;
474492
}
475493

494+
/**
495+
* Log home enabled
496+
*
497+
* @since 2.0
498+
* @return log home enabled
499+
*/
500+
public boolean getLogHomeEnabled() {
501+
if (logHomeEnabled == null) {
502+
return !isDomainHomeInImage();
503+
}
504+
return logHomeEnabled.booleanValue();
505+
}
506+
507+
/**
508+
* Log home enabled
509+
*
510+
* @since 2.0
511+
* @param logHomeEnabled log home enabled
512+
*/
513+
public void setLogHomeEnabled(boolean logHomeEnabled) {
514+
this.logHomeEnabled = new Boolean(logHomeEnabled);
515+
}
516+
476517
/**
477518
* Whether to include server .out to the pod's stdout
478519
*
@@ -641,6 +682,7 @@ public String toString() {
641682
.append("clusters", clusters)
642683
.append("replicas", replicas)
643684
.append("logHome", logHome)
685+
.append("logHomeEnabled", logHomeEnabled)
644686
.append("includeServerOutInPodLog", includeServerOutInPodLog)
645687
.append("configOverrides", configOverrides)
646688
.append("configOverrideSecrets", configOverrideSecrets);
@@ -669,6 +711,7 @@ public int hashCode() {
669711
.append(clusters)
670712
.append(replicas)
671713
.append(logHome)
714+
.append(logHomeEnabled)
672715
.append(includeServerOutInPodLog)
673716
.append(configOverrides)
674717
.append(configOverrideSecrets);
@@ -701,6 +744,7 @@ public boolean equals(Object other) {
701744
.append(clusters, rhs.clusters)
702745
.append(replicas, rhs.replicas)
703746
.append(logHome, rhs.logHome)
747+
.append(logHomeEnabled, rhs.logHomeEnabled)
704748
.append(includeServerOutInPodLog, rhs.includeServerOutInPodLog)
705749
.append(configOverrides, rhs.configOverrides)
706750
.append(configOverrideSecrets, rhs.configOverrideSecrets);

model/src/main/java/oracle/kubernetes/weblogic/domain/v2/DomainV2Configurator.java

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,18 @@ public AdminServerConfigurator withNodePort(int nodePort) {
136136
return this;
137137
}
138138

139+
@Override
140+
public AdminServerConfigurator withNodePortLabel(String name, String value) {
141+
adminServer.addNodePortLabels(name, value);
142+
return this;
143+
}
144+
145+
@Override
146+
public AdminServerConfigurator withNodePortAnnotation(String name, String value) {
147+
adminServer.addNodePortAnnotations(name, value);
148+
return this;
149+
}
150+
139151
@Override
140152
public AdminServerConfigurator withExportedNetworkAccessPoints(String... names) {
141153
for (String name : names) {
@@ -304,6 +316,18 @@ public ServerConfigurator withPodAnnotation(String name, String value) {
304316
server.addPodAnnotations(name, value);
305317
return this;
306318
}
319+
320+
@Override
321+
public ServerConfigurator withServiceLabel(String name, String value) {
322+
server.addServiceLabels(name, value);
323+
return this;
324+
}
325+
326+
@Override
327+
public ServerConfigurator withServiceAnnotation(String name, String value) {
328+
server.addServiceAnnotations(name, value);
329+
return this;
330+
}
307331
}
308332

309333
@Override
@@ -436,5 +460,17 @@ public ClusterConfigurator withPodAnnotation(String name, String value) {
436460
cluster.addPodAnnotations(name, value);
437461
return this;
438462
}
463+
464+
@Override
465+
public ClusterConfigurator withServiceLabel(String name, String value) {
466+
cluster.addServiceLabels(name, value);
467+
return this;
468+
}
469+
470+
@Override
471+
public ClusterConfigurator withServiceAnnotation(String name, String value) {
472+
cluster.addServiceAnnotations(name, value);
473+
return this;
474+
}
439475
}
440476
}

0 commit comments

Comments
 (0)