Skip to content

Commit 003fb7c

Browse files
committed
Merge remote-tracking branch 'origin/develop' into schema-fix4
2 parents f89e995 + 2711d98 commit 003fb7c

File tree

17 files changed

+123
-132
lines changed

17 files changed

+123
-132
lines changed

kubernetes/samples/scripts/create-weblogic-domain/domain-home-in-image/README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ spec:
125125
imagePullPolicy: "Never"
126126
# Identify which Secret contains the WebLogic Admin credentials (note that there is an example of
127127
# how to create that Secret at the end of this file)
128-
adminSecret:
128+
webLogicCredentialsSecret:
129129
name: domain1-weblogic-credentials
130130
# Whether to include the server out file into the pod's stdout, default is true
131131
includeServerOutInPodLog: true
@@ -135,12 +135,13 @@ spec:
135135
# - "ADMIN_ONLY" will start up only the administration server (no managed servers will be started)
136136
# - "IF_NEEDED" will start all non-clustered servers, including the administration server and clustered servers up to the replica count
137137
serverStartPolicy: "IF_NEEDED"
138-
# an (optional) list of environment variable to be set on the servers
139-
env:
140-
- name: JAVA_OPTIONS
141-
value: "-Dweblogic.StdoutDebugEnabled=false"
142-
- name: USER_MEM_ARGS
143-
value: "-Xms64m -Xmx256m "
138+
serverPod:
139+
# an (optional) list of environment variable to be set on the servers
140+
env:
141+
- name: JAVA_OPTIONS
142+
value: "-Dweblogic.StdoutDebugEnabled=false"
143+
- name: USER_MEM_ARGS
144+
value: "-Xms64m -Xmx256m "
144145
# adminServer is used to configure the desired behavior for starting the administration server.
145146
adminServer:
146147
# serverStartState legal values are "RUNNING" or "ADMIN"

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ spec:
2222
imagePullPolicy: "Never"
2323
# Identify which Secret contains the WebLogic Admin credentials (note that there is an example of
2424
# how to create that Secret at the end of this file)
25-
adminSecret:
25+
webLogicCredentialsSecret:
2626
name: %WEBLOGIC_CREDENTIALS_SECRET_NAME%
2727
# Whether to include the server out file into the pod's stdout, default is true
2828
includeServerOutInPodLog: %INCLUDE_SERVER_OUT_IN_POD_LOG%
@@ -52,7 +52,7 @@ spec:
5252
# clusters is used to configure the desired behavior for starting member servers of a cluster.
5353
# If you use this entry, then the rules will be applied to ALL servers that are members of the named clusters.
5454
clusters:
55-
%CLUSTER_NAME%:
55+
- clusterName: %CLUSTER_NAME%
5656
serverStartState: "RUNNING"
5757
replicas: %INITIAL_MANAGED_SERVER_REPLICAS%
5858
# The number of managed servers to start from clusters not listed in clusters

kubernetes/samples/scripts/create-weblogic-domain/domain-home-on-pv/README.md

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,6 @@ spec:
131131
# to have multiple Domains with the same Domain Name, but they MUST have different domainUID's.
132132
# The domainUID is also used to identify the Persistent Volume that belongs to/with this Domain.
133133
domainUID: domain1
134-
# The WebLogic Domain Name
135-
domainName: domain1
136134
# The WebLogic Domain Home
137135
domainHome: /shared/domains/domain1
138136
# If the domain home is in the image
@@ -146,12 +144,8 @@ spec:
146144
#- name:
147145
# Identify which Secret contains the WebLogic Admin credentials (note that there is an example of
148146
# how to create that Secret at the end of this file)
149-
adminSecret:
147+
webLogicCredentialsSecret:
150148
name: domain1-weblogic-credentials
151-
# The name of the Admin Server
152-
asName: "admin-server"
153-
# The Admin Server's ListenPort
154-
asPort: 7001
155149
# Whether to include the server out file into the pod's stdout, default is true
156150
includeServerOutInPodLog: true
157151
# The in-pod name of the directory to store the domain, node manager, server logs, and server .out
@@ -165,12 +159,20 @@ spec:
165159
# - "ADMIN_ONLY" will start up only the administration server (no managed servers will be started)
166160
# - "IF_NEEDED" will start all non-clustered servers, including the administration server and clustered servers up to the replica count
167161
serverStartPolicy: "IF_NEEDED"
168-
# an (optional) list of environment variable to be set on the servers
169-
env:
170-
- name: JAVA_OPTIONS
171-
value: "-Dweblogic.StdoutDebugEnabled=false"
172-
- name: USER_MEM_ARGS
173-
value: "-Xms64m -Xmx256m "
162+
serverPod:
163+
# an (optional) list of environment variable to be set on the servers
164+
env:
165+
- name: JAVA_OPTIONS
166+
value: "-Dweblogic.StdoutDebugEnabled=false"
167+
- name: USER_MEM_ARGS
168+
value: "-Xms64m -Xmx256m "
169+
volumes:
170+
- name: weblogic-domain-storage-volume
171+
persistentVolumeClaim:
172+
claimName: domain1-weblogic-sample-pvc
173+
volumeMounts:
174+
- mountPath: /shared
175+
name: weblogic-domain-storage-volume
174176
# adminServer is used to configure the desired behavior for starting the administration server.
175177
adminServer:
176178
# serverStartState legal values are "RUNNING" or "ADMIN"
@@ -191,9 +193,6 @@ spec:
191193
replicas: 2
192194
# The number of managed servers to start for unlisted clusters
193195
# replicas: 1
194-
storage:
195-
predefined:
196-
claim: domain1-weblogic-sample-pvc
197196
```
198197

199198
### Verify the domain

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ spec:
2626
%WEBLOGIC_IMAGE_PULL_SECRET_PREFIX%- name: %WEBLOGIC_IMAGE_PULL_SECRET_NAME%
2727
# Identify which Secret contains the WebLogic Admin credentials (note that there is an example of
2828
# how to create that Secret at the end of this file)
29-
adminSecret:
29+
webLogicCredentialsSecret:
3030
name: %WEBLOGIC_CREDENTIALS_SECRET_NAME%
3131
# Whether to include the server out file into the pod's stdout, default is true
3232
includeServerOutInPodLog: %INCLUDE_SERVER_OUT_IN_POD_LOG%
@@ -69,7 +69,7 @@ spec:
6969
# clusters is used to configure the desired behavior for starting member servers of a cluster.
7070
# If you use this entry, then the rules will be applied to ALL servers that are members of the named clusters.
7171
clusters:
72-
%CLUSTER_NAME%:
72+
- clusterName: %CLUSTER_NAME%
7373
replicas: %INITIAL_MANAGED_SERVER_REPLICAS%
7474
# The number of managed servers to start for unlisted clusters
7575
# replicas: 1

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -284,12 +284,12 @@ public void setStatus(DomainStatus status) {
284284
}
285285

286286
/**
287-
* Reference to secret containing domain administrator username and password.
287+
* Reference to secret containing WebLogic startup credentials username and password.
288288
*
289-
* @return admin secret
289+
* @return credentials secret
290290
*/
291-
public V1SecretReference getAdminSecret() {
292-
return spec.getAdminSecret();
291+
public V1SecretReference getWebLogicCredentialsSecret() {
292+
return spec.getWebLogicCredentialsSecret();
293293
}
294294

295295
/**

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

Lines changed: 36 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ public class DomainSpec extends BaseConfiguration {
4545
private String domainHome;
4646

4747
/**
48-
* Reference to secret containing domain administrator username and password. Secret must contain
49-
* keys names 'username' and 'password' (Required)
48+
* Reference to secret containing WebLogic startup credentials username and password. Secret must
49+
* contain keys names 'username' and 'password' (Required)
5050
*/
51-
@Valid @NotNull private V1SecretReference adminSecret;
51+
@Valid @NotNull private V1SecretReference webLogicCredentialsSecret;
5252

5353
/**
5454
* The in-pod name of the directory to store the domain, node manager, server logs, and server
@@ -157,15 +157,15 @@ public class DomainSpec extends BaseConfiguration {
157157
* @since 2.0
158158
*/
159159
@Description("Configuration for the managed servers")
160-
private Map<String, ManagedServer> managedServers = new HashMap<>();
160+
private List<ManagedServer> managedServers = new ArrayList<>();
161161

162162
/**
163163
* The configured clusters.
164164
*
165165
* @since 2.0
166166
*/
167167
@Description("Configuration for the clusters")
168-
protected Map<String, Cluster> clusters = new HashMap<>();
168+
protected List<Cluster> clusters = new ArrayList<>();
169169

170170
/**
171171
* Adds a Cluster to the DomainSpec
@@ -174,7 +174,7 @@ public class DomainSpec extends BaseConfiguration {
174174
* @return
175175
*/
176176
public DomainSpec withCluster(Cluster cluster) {
177-
clusters.put(cluster.getClusterName(), cluster);
177+
clusters.add(cluster);
178178
return this;
179179
}
180180

@@ -257,24 +257,24 @@ public DomainSpec withImage(String image) {
257257
return this;
258258
}
259259

260-
public V1SecretReference getAdminSecret() {
261-
return adminSecret;
260+
public V1SecretReference getWebLogicCredentialsSecret() {
261+
return webLogicCredentialsSecret;
262262
}
263263

264264
@SuppressWarnings("unused")
265-
public void setAdminSecret(V1SecretReference adminSecret) {
266-
this.adminSecret = adminSecret;
265+
public void setWebLogicCredentialsSecret(V1SecretReference webLogicCredentialsSecret) {
266+
this.webLogicCredentialsSecret = webLogicCredentialsSecret;
267267
}
268268

269269
/**
270-
* Reference to secret containing domain administrator username and password. Secret must contain
271-
* keys names 'username' and 'password' (Required)
270+
* Reference to secret containing WebLogic startup credentials username and password. Secret must
271+
* contain keys names 'username' and 'password' (Required)
272272
*
273-
* @param adminSecret admin secret
273+
* @param webLogicCredentialsSecret WebLogic startup credentials secret
274274
* @return this
275275
*/
276-
public DomainSpec withAdminSecret(V1SecretReference adminSecret) {
277-
this.adminSecret = adminSecret;
276+
public DomainSpec withWebLogicCredentialsSecret(V1SecretReference webLogicCredentialsSecret) {
277+
this.webLogicCredentialsSecret = webLogicCredentialsSecret;
278278
return this;
279279
}
280280

@@ -452,7 +452,7 @@ public String toString() {
452452
.append("domainUID", domainUID)
453453
.append("domainHome", domainHome)
454454
.append("domainHomeInImage", domainHomeInImage)
455-
.append("adminSecret", adminSecret)
455+
.append("webLogicCredentialsSecret", webLogicCredentialsSecret)
456456
.append("image", image)
457457
.append("imagePullPolicy", imagePullPolicy)
458458
.append("imagePullSecrets", imagePullSecrets)
@@ -477,7 +477,7 @@ public int hashCode() {
477477
.append(domainUID)
478478
.append(domainHome)
479479
.append(domainHomeInImage)
480-
.append(adminSecret)
480+
.append(webLogicCredentialsSecret)
481481
.append(image)
482482
.append(imagePullPolicy)
483483
.append(imagePullSecrets)
@@ -506,7 +506,7 @@ public boolean equals(Object other) {
506506
.append(domainUID, rhs.domainUID)
507507
.append(domainHome, rhs.domainHome)
508508
.append(domainHomeInImage, rhs.domainHomeInImage)
509-
.append(adminSecret, rhs.adminSecret)
509+
.append(webLogicCredentialsSecret, rhs.webLogicCredentialsSecret)
510510
.append(image, rhs.image)
511511
.append(imagePullPolicy, rhs.imagePullPolicy)
512512
.append(imagePullSecrets, rhs.imagePullSecrets)
@@ -523,12 +523,22 @@ public boolean equals(Object other) {
523523
return builder.isEquals();
524524
}
525525

526-
private Server getServer(String serverName) {
527-
return managedServers.get(serverName);
526+
ManagedServer getManagedServer(String serverName) {
527+
if (serverName != null) {
528+
for (ManagedServer s : managedServers) {
529+
if (serverName.equals(s.getServerName())) return s;
530+
}
531+
}
532+
return null;
528533
}
529534

530-
private Cluster getCluster(String clusterName) {
531-
return clusters.get(clusterName);
535+
Cluster getCluster(String clusterName) {
536+
if (clusterName != null) {
537+
for (Cluster c : clusters) {
538+
if (clusterName.equals(c.getClusterName())) return c;
539+
}
540+
}
541+
return null;
532542
}
533543

534544
private int getReplicaCountFor(Cluster cluster) {
@@ -557,11 +567,11 @@ private void setAdminServer(AdminServer adminServer) {
557567
this.adminServer = adminServer;
558568
}
559569

560-
public Map<String, ManagedServer> getManagedServers() {
570+
public List<ManagedServer> getManagedServers() {
561571
return managedServers;
562572
}
563573

564-
public Map<String, Cluster> getClusters() {
574+
public List<Cluster> getClusters() {
565575
return clusters;
566576
}
567577

@@ -575,7 +585,7 @@ public ServerSpec getAdminServerSpec() {
575585
public ServerSpec getServerSpec(String serverName, String clusterName) {
576586
return new ManagedServerSpecV2Impl(
577587
DomainSpec.this,
578-
getServer(serverName),
588+
getManagedServer(serverName),
579589
getCluster(clusterName),
580590
getClusterLimit(clusterName));
581591
}
@@ -641,7 +651,7 @@ private Cluster getOrCreateCluster(String clusterName) {
641651

642652
private Cluster createClusterWithName(String clusterName) {
643653
Cluster cluster = new Cluster().withClusterName(clusterName);
644-
clusters.put(clusterName, cluster);
654+
clusters.add(cluster);
645655
return cluster;
646656
}
647657
}

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,8 @@ public ServerConfigurator configureServer(@Nonnull String serverName) {
166166
}
167167

168168
private Server getOrCreateManagedServer(@Nonnull String serverName) {
169-
ManagedServer server = getDomainSpec().getManagedServers().get(serverName);
169+
ManagedServer server = getDomainSpec().getManagedServer(serverName);
170170
if (server != null) {
171-
server.setServerName(serverName);
172171
return server;
173172
}
174173

@@ -177,7 +176,7 @@ private Server getOrCreateManagedServer(@Nonnull String serverName) {
177176

178177
private Server createManagedServer(String serverName) {
179178
ManagedServer server = new ManagedServer().withServerName(serverName);
180-
getDomainSpec().getManagedServers().put(serverName, server);
179+
getDomainSpec().getManagedServers().add(server);
181180
return server;
182181
}
183182

@@ -342,9 +341,8 @@ public ClusterConfigurator configureCluster(@Nonnull String clusterName) {
342341
}
343342

344343
private Cluster getOrCreateCluster(@Nonnull String clusterName) {
345-
Cluster cluster = getDomainSpec().getClusters().get(clusterName);
344+
Cluster cluster = getDomainSpec().getCluster(clusterName);
346345
if (cluster != null) {
347-
cluster.setClusterName(clusterName);
348346
return cluster;
349347
}
350348

@@ -353,7 +351,7 @@ private Cluster getOrCreateCluster(@Nonnull String clusterName) {
353351

354352
private Cluster createCluster(@Nonnull String clusterName) {
355353
Cluster cluster = new Cluster().withClusterName(clusterName);
356-
getDomainSpec().getClusters().put(clusterName, cluster);
354+
getDomainSpec().getClusters().add(cluster);
357355
return cluster;
358356
}
359357

model/src/test/java/oracle/kubernetes/weblogic/domain/DomainTestBase.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public abstract class DomainTestBase {
5151
protected static Domain createDomain() {
5252
return new Domain()
5353
.withMetadata(new V1ObjectMeta().namespace(NS))
54-
.withSpec(new DomainSpec().withAdminSecret(SECRET).withDomainUID(DOMAIN_UID));
54+
.withSpec(new DomainSpec().withWebLogicCredentialsSecret(SECRET).withDomainUID(DOMAIN_UID));
5555
}
5656

5757
protected abstract DomainConfigurator configureDomain(Domain domain);
@@ -66,7 +66,7 @@ protected static String getNamespace() {
6666

6767
@Test
6868
public void canGetAdminServerInfoFromDomain() {
69-
assertThat(domain.getAdminSecret(), equalTo(SECRET));
69+
assertThat(domain.getWebLogicCredentialsSecret(), equalTo(SECRET));
7070
}
7171

7272
@Test

model/src/test/resources/oracle/kubernetes/weblogic/domain/v2/domain-sample-2.yaml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,8 @@ metadata:
99
namespace: domain_ns
1010
spec:
1111
# Identify which Secret contains the WebLogic Admin credentials
12-
adminSecret:
12+
webLogicCredentialsSecret:
1313
name: admin-secret
14-
# The name of the Admin Server
15-
asName: admin
16-
# The Admin Server's ListenPort
17-
asPort: 8001
18-
# The WebLogic Domain Name
19-
20-
domainName: base_domain
2114
# The domainUID must be unique across the entire Kubernetes Cluster. Each WebLogic Domain must
2215
# have its own unique domainUID. This does not have to be the same as the Domain Name. It is allowed
2316
# to have multiple Domains with the same Domain Name, but they MUST have different domainUID's.
@@ -68,7 +61,7 @@ spec:
6861
path: /other/path
6962

7063
clusters:
71-
cluster1:
64+
- clusterName: cluster1
7265
serverPod:
7366
readinessProbe:
7467
initialDelaySeconds: 10
@@ -107,7 +100,7 @@ spec:
107100
user: weblogic
108101

109102
managedServers:
110-
server2:
103+
- serverName: server2
111104
serverPod:
112105
livenessProbe:
113106
periodSeconds: 18

0 commit comments

Comments
 (0)