Skip to content

Commit 6c61b47

Browse files
authored
Merge pull request #598 from oracle/schema-fix2
Remove schema elements for domainName, asName and asPort
2 parents aeb3e2c + 5ac3253 commit 6c61b47

File tree

55 files changed

+469
-563
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+469
-563
lines changed

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -285,11 +285,6 @@ function createFiles {
285285
echo Generating ${domainPropertiesOutput}
286286

287287
cp ${domainPropertiesInput} ${domainPropertiesOutput}
288-
sed -i -e "s:%DOMAIN_NAME%:${domainName}:g" ${domainPropertiesOutput}
289-
sed -i -e "s:%ADMIN_PORT%:${adminPort}:g" ${domainPropertiesOutput}
290-
sed -i -e "s:%ADMIN_SERVER_NAME%:${adminServerName}:g" ${domainPropertiesOutput}
291-
sed -i -e "s:%MANAGED_SERVER_PORT%:${managedServerPort}:g" ${domainPropertiesOutput}
292-
sed -i -e "s:%MANAGED_SERVER_NAME_BASE%:${managedServerNameBase}:g" ${domainPropertiesOutput}
293288
sed -i -e "s:%CONFIGURED_MANAGED_SERVER_COUNT%:${configuredManagedServerCount}:g" ${domainPropertiesOutput}
294289
sed -i -e "s:%CLUSTER_NAME%:${clusterName}:g" ${domainPropertiesOutput}
295290
sed -i -e "s:%PRODUCTION_MODE_ENABLED%:${productionModeEnabled}:g" ${domainPropertiesOutput}

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

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,7 @@ metadata:
1111
labels:
1212
weblogic.resourceVersion: domain-v2
1313
weblogic.domainUID: %DOMAIN_UID%
14-
weblogic.domainName: %DOMAIN_NAME%
1514
spec:
16-
# The domainUID must be unique across the entire Kubernetes Cluster. Each WebLogic Domain must
17-
# have its own unique domainUID. This does not have to be the same as the Domain Name. It is allowed
18-
# to have multiple Domains with the same Domain Name, but they MUST have different domainUID's.
19-
# The domainUID is also used to identify the Persistent Volume that belongs to/with this Domain.
20-
domainUID: %DOMAIN_UID%
21-
# The WebLogic Domain Name
22-
domainName: %DOMAIN_NAME%
2315
# The WebLogic Domain Home
2416
domainHome: %DOMAIN_HOME%
2517
# If the domain home is in the image
@@ -32,10 +24,6 @@ spec:
3224
# how to create that Secret at the end of this file)
3325
adminSecret:
3426
name: %WEBLOGIC_CREDENTIALS_SECRET_NAME%
35-
# The name of the Admin Server
36-
asName: "%ADMIN_SERVER_NAME%"
37-
# The Admin Server's ListenPort
38-
asPort: %ADMIN_PORT%
3927
# Whether to include the server out file into the pod's stdout, default is true
4028
includeServerOutInPodLog: %INCLUDE_SERVER_OUT_IN_POD_LOG%
4129
# serverStartPolicy legal values are "NEVER", "ALWAYS", "IF_NEEDED", or "ADMIN_ONLY"
@@ -46,9 +34,9 @@ spec:
4634
serverStartPolicy: "%SERVER_START_POLICY%"
4735
# adminServer is used to configure the desired behavior for starting the administration server.
4836
adminServer:
49-
# serverStartState legal values are "RUNNING" or "ADMIN"
50-
# "RUNNING" means the listed server will be started up to "RUNNING" mode
51-
# "ADMIN" means the listed server will be start up to "ADMIN" mode
37+
# serverStartState legal values are "RUNNING" or "ADMIN"
38+
# "RUNNING" means the listed server will be started up to "RUNNING" mode
39+
# "ADMIN" means the listed server will be start up to "ADMIN" mode
5240
serverStartState: "RUNNING"
5341
# The Admin Server's NodePort
5442
%EXPOSE_ADMIN_PORT_PREFIX%nodePort: %ADMIN_NODE_PORT%

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,13 +390,10 @@ function createYamlFiles {
390390
sed -i -e "s:%WEBLOGIC_CREDENTIALS_SECRET_NAME%:${weblogicCredentialsSecretName}:g" ${dcrOutput}
391391
sed -i -e "s:%WEBLOGIC_IMAGE_PULL_SECRET_PREFIX%:${imagePullSecretPrefix}:g" ${dcrOutput}
392392
sed -i -e "s:%DOMAIN_UID%:${domainUID}:g" ${dcrOutput}
393-
sed -i -e "s:%DOMAIN_NAME%:${domainName}:g" ${dcrOutput}
394393
sed -i -e "s:%DOMAIN_HOME%:${domainHome}:g" ${dcrOutput}
395-
sed -i -e "s:%ADMIN_SERVER_NAME%:${adminServerName}:g" ${dcrOutput}
396394
sed -i -e "s:%WEBLOGIC_IMAGE%:${image}:g" ${dcrOutput}
397395
sed -i -e "s:%WEBLOGIC_IMAGE_PULL_POLICY%:${imagePullPolicy}:g" ${dcrOutput}
398396
sed -i -e "s:%WEBLOGIC_IMAGE_PULL_SECRET_NAME%:${imagePullSecretName}:g" ${dcrOutput}
399-
sed -i -e "s:%ADMIN_PORT%:${adminPort}:g" ${dcrOutput}
400397
sed -i -e "s:%INITIAL_MANAGED_SERVER_REPLICAS%:${initialManagedServerReplicas}:g" ${dcrOutput}
401398
sed -i -e "s:%EXPOSE_T3_CHANNEL_PREFIX%:${exposeAdminT3ChannelPrefix}:g" ${dcrOutput}
402399
sed -i -e "s:%CLUSTER_NAME%:${clusterName}:g" ${dcrOutput}

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

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,7 @@ metadata:
1212
labels:
1313
weblogic.resourceVersion: domain-v2
1414
weblogic.domainUID: %DOMAIN_UID%
15-
weblogic.domainName: %DOMAIN_NAME%
1615
spec:
17-
# The domainUID must be unique across the entire Kubernetes Cluster. Each WebLogic Domain must
18-
# have its own unique domainUID. This does not have to be the same as the Domain Name. It is allowed
19-
# to have multiple Domains with the same Domain Name, but they MUST have different domainUID's.
20-
# The domainUID is also used to identify the Persistent Volume that belongs to/with this Domain.
21-
domainUID: %DOMAIN_UID%
22-
# The WebLogic Domain Name
23-
domainName: %DOMAIN_NAME%
2416
# The WebLogic Domain Home
2517
domainHome: %DOMAIN_HOME%
2618
# If the domain home is in the image
@@ -36,10 +28,6 @@ spec:
3628
# how to create that Secret at the end of this file)
3729
adminSecret:
3830
name: %WEBLOGIC_CREDENTIALS_SECRET_NAME%
39-
# The name of the Admin Server
40-
asName: "%ADMIN_SERVER_NAME%"
41-
# The Admin Server's ListenPort
42-
asPort: %ADMIN_PORT%
4331
# Whether to include the server out file into the pod's stdout, default is true
4432
includeServerOutInPodLog: %INCLUDE_SERVER_OUT_IN_POD_LOG%
4533
# The in-pod name of the directory to store the domain, node manager, server logs, and server .out
@@ -61,9 +49,10 @@ spec:
6149
value: "-Xms64m -Xmx256m "
6250
# adminServer is used to configure the desired behavior for starting the administration server.
6351
adminServer:
64-
# serverStartState legal values are "RUNNING" or "ADMIN"
65-
# "RUNNING" means the listed server will be started up to "RUNNING" mode
66-
# "ADMIN" means the listed server will be start up to "ADMIN" mode
52+
# serverStartState legal values are "RUNNING" or "ADMIN"
53+
# "RUNNING" means the listed server will be started up to "RUNNING" mode
54+
# "ADMIN" means the listed server will be start up to "ADMIN" mode
55+
serverStartState: "RUNNING"
6756
# The Admin Server's NodePort
6857
%EXPOSE_ADMIN_PORT_PREFIX%nodePort: %ADMIN_NODE_PORT%
6958
# Uncomment to export the T3Channel as a service

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
@SuppressWarnings("UnusedReturnValue")
1010
public interface AdminServerConfigurator extends ServerConfigurator {
1111

12-
AdminServerConfigurator withPort(int port);
13-
1412
AdminServerConfigurator withNodePort(int nodePort);
1513

1614
AdminServerConfigurator withExportedNetworkAccessPoints(String... names);

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

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,8 @@ public DomainConfigurator withDomainHomeInImage(boolean domainHomeInImage) {
5454
return this;
5555
}
5656

57-
/**
58-
* Defines a name for the domain's admin server.
59-
*
60-
* @param adminServerName the name of the admin server
61-
*/
62-
public abstract AdminServerConfigurator configureAdminServer(String adminServerName);
57+
/** Defines a name for the domain's admin server. */
58+
public abstract AdminServerConfigurator configureAdminServer();
6359

6460
public void withDefaultReplicaCount(int replicas) {
6561
getDomainSpec().setReplicas(replicas);
@@ -246,10 +242,6 @@ protected DomainSpec getDomainSpec() {
246242
return domain.getSpec();
247243
}
248244

249-
protected String getAsName() {
250-
return domain.getAsName();
251-
}
252-
253245
public abstract DomainConfigurator withAdditionalVolume(String name, String path);
254246

255247
public abstract DomainConfigurator withAdditionalVolumeMount(String name, String path);

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

Lines changed: 15 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import io.kubernetes.client.models.V1SecretReference;
1313
import java.util.List;
1414
import java.util.Map;
15+
import java.util.Optional;
1516
import javax.annotation.Nonnull;
1617
import javax.validation.Valid;
1718
import oracle.kubernetes.json.Description;
@@ -25,6 +26,11 @@
2526
/** Domain represents a WebLogic domain and how it will be realized in the Kubernetes cluster. */
2627
@SuppressWarnings("deprecation")
2728
public class Domain {
29+
/** The pattern for computing the default persistent volume claim name. */
30+
private static final String PVC_NAME_PATTERN = "%s-weblogic-domain-pvc";
31+
32+
/** The pattern for computing the default shared logs directory. */
33+
private static final String LOG_HOME_DEFAULT_PATTERN = "/shared/logs/%s";
2834

2935
/**
3036
* APIVersion defines the versioned schema of this representation of an object. Servers should
@@ -271,44 +277,18 @@ public V1SecretReference getAdminSecret() {
271277
return spec.getAdminSecret();
272278
}
273279

274-
/**
275-
* Returns the name of the admin server.
276-
*
277-
* @return admin server name
278-
*/
279-
public String getAsName() {
280-
return spec.getAsName();
281-
}
282-
283-
/**
284-
* Returns the port used by the admin server.
285-
*
286-
* @return admin server port
287-
*/
288-
public Integer getAsPort() {
289-
return spec.getAsPort();
290-
}
291-
292280
/**
293281
* Returns the domain unique identifier.
294282
*
295283
* @return domain UID
296284
*/
297285
public String getDomainUID() {
298-
return spec.getDomainUID();
299-
}
300-
301-
/**
302-
* Returns the domain name
303-
*
304-
* @return domain name
305-
*/
306-
public String getDomainName() {
307-
return spec.getDomainName();
286+
return Optional.ofNullable(spec.getDomainUID()).orElse(getMetadata().getName());
308287
}
309288

310289
public String getLogHome() {
311-
return spec.getLogHome();
290+
return Optional.ofNullable(spec.getLogHome())
291+
.orElse(String.format(LOG_HOME_DEFAULT_PATTERN, getDomainUID()));
312292
}
313293

314294
public boolean isIncludeServerOutInPodLog() {
@@ -359,7 +339,12 @@ public Map<String, String> getChannelServiceAnnotations(String channel) {
359339
* @return volume claim
360340
*/
361341
public String getPersistentVolumeClaimName() {
362-
return spec.getPersistentVolumeClaimName();
342+
return spec.getStorage() == null ? null : getConfiguredClaimName(spec.getStorage());
343+
}
344+
345+
private String getConfiguredClaimName(@Nonnull DomainStorage storage) {
346+
return Optional.ofNullable(storage.getPersistentVolumeClaimName())
347+
.orElse(String.format(PVC_NAME_PATTERN, getDomainUID()));
363348
}
364349

365350
/**

0 commit comments

Comments
 (0)