Skip to content

Commit c41c497

Browse files
authored
Merge pull request #617 from oracle/schema-fix4
Schema: use volumes and volumeMounts
2 parents 2711d98 + 003fb7c commit c41c497

File tree

22 files changed

+70
-1234
lines changed

22 files changed

+70
-1234
lines changed

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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-on-pv/README.md

Lines changed: 14 additions & 15 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
@@ -148,10 +146,6 @@ spec:
148146
# how to create that Secret at the end of this file)
149147
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/create-domain.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,7 @@ function createYamlFiles {
404404
sed -i -e "s:%LOG_HOME%:${logHome}:g" ${dcrOutput}
405405
sed -i -e "s:%INCLUDE_SERVER_OUT_IN_POD_LOG%:${includeServerOutInPodLog}:g" ${dcrOutput}
406406
sed -i -e "s:%DOMAIN_PVC_NAME%:${persistentVolumeClaimName}:g" ${dcrOutput}
407+
sed -i -e "s:%DOMAIN_ROOT_DIR%:${domainPVMountPath}:g" ${dcrOutput}
407408

408409
# Remove any "...yaml-e" files left over from running sed
409410
rm -f ${domainOutputDir}/*.yaml-e

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

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,20 @@ spec:
4141
# - "ADMIN_ONLY" will start up only the administration server (no managed servers will be started)
4242
# - "IF_NEEDED" will start all non-clustered servers, including the administration server and clustered servers up to the replica count
4343
serverStartPolicy: "%SERVER_START_POLICY%"
44-
# an (optional) list of environment variable to be set on the servers
45-
env:
46-
- name: JAVA_OPTIONS
47-
value: "%JAVA_OPTIONS%"
48-
- name: USER_MEM_ARGS
49-
value: "-Xms64m -Xmx256m "
44+
serverPod:
45+
# an (optional) list of environment variable to be set on the server
46+
env:
47+
- name: JAVA_OPTIONS
48+
value: "%JAVA_OPTIONS%"
49+
- name: USER_MEM_ARGS
50+
value: "-Xms64m -Xmx256m "
51+
volumes:
52+
- name: weblogic-domain-storage-volume
53+
persistentVolumeClaim:
54+
claimName: %DOMAIN_PVC_NAME%
55+
volumeMounts:
56+
- mountPath: %DOMAIN_ROOT_DIR%
57+
name: weblogic-domain-storage-volume
5058
# adminServer is used to configure the desired behavior for starting the administration server.
5159
adminServer:
5260
# serverStartState legal values are "RUNNING" or "ADMIN"
@@ -65,6 +73,3 @@ spec:
6573
replicas: %INITIAL_MANAGED_SERVER_REPLICAS%
6674
# The number of managed servers to start for unlisted clusters
6775
# replicas: 1
68-
storage:
69-
predefined:
70-
claim: %DOMAIN_PVC_NAME%

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

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import javax.annotation.Nonnull;
1313
import oracle.kubernetes.weblogic.domain.v2.Domain;
1414
import oracle.kubernetes.weblogic.domain.v2.DomainSpec;
15-
import oracle.kubernetes.weblogic.domain.v2.DomainStorage;
1615

1716
/**
1817
* Configures a domain, adding settings independently of the version of the domain representation.
@@ -128,62 +127,6 @@ public DomainConfigurator withLogHomeEnabled(boolean logHomeEnabled) {
128127
return this;
129128
}
130129

131-
/**
132-
* Configures the domain to use a persistent volume claim defined before the domain is created.
133-
*
134-
* @param claimName the name of the persistent volume claim
135-
* @return this object
136-
*/
137-
public DomainConfigurator withPredefinedClaim(String claimName) {
138-
getDomainSpec().setStorage(DomainStorage.createPredefinedClaim(claimName));
139-
return this;
140-
}
141-
142-
/**
143-
* Configures the domain to use storage in the local node.
144-
*
145-
* @param path the path to the storage
146-
* @return this object
147-
*/
148-
public DomainConfigurator withHostPathStorage(String path) {
149-
getDomainSpec().setStorage(DomainStorage.createHostPathStorage(path));
150-
return this;
151-
}
152-
153-
/**
154-
* Configures the domain to use storage on a remote server.
155-
*
156-
* @param server the server hosting the storage
157-
* @param path the path to the storage
158-
* @return this object
159-
*/
160-
public DomainConfigurator withNfsStorage(String server, String path) {
161-
getDomainSpec().setStorage(DomainStorage.createNfsStorage(server, path));
162-
return this;
163-
}
164-
165-
/**
166-
* Defines the amount of storage to allocate for the domain.
167-
*
168-
* @param size the size to allocate
169-
* @return this object
170-
*/
171-
public DomainConfigurator withStorageSize(String size) {
172-
getDomainSpec().getStorage().setStorageSize(size);
173-
return this;
174-
}
175-
176-
/**
177-
* Defines the amount of storage to allocate for the domain.
178-
*
179-
* @param policy the size to allocate
180-
* @return this object
181-
*/
182-
public DomainConfigurator withStorageReclaimPolicy(String policy) {
183-
getDomainSpec().getStorage().setStorageReclaimPolicy(policy);
184-
return this;
185-
}
186-
187130
/**
188131
* Sets the WebLogic configuration overrides configmap name for the domain
189132
*

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,15 +171,15 @@ void setContainerSecurityContext(V1SecurityContext containerSecurityContext) {
171171
serverPod.setContainerSecurityContext(containerSecurityContext);
172172
}
173173

174-
List<V1Volume> getAdditionalVolumes() {
174+
public List<V1Volume> getAdditionalVolumes() {
175175
return serverPod.getAdditionalVolumes();
176176
}
177177

178178
void addAdditionalVolume(String name, String path) {
179179
serverPod.addAdditionalVolume(name, path);
180180
}
181181

182-
List<V1VolumeMount> getAdditionalVolumeMounts() {
182+
public List<V1VolumeMount> getAdditionalVolumeMounts() {
183183
return serverPod.getAdditionalVolumeMounts();
184184
}
185185

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

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
import com.google.gson.annotations.Expose;
88
import com.google.gson.annotations.SerializedName;
99
import io.kubernetes.client.models.V1ObjectMeta;
10-
import io.kubernetes.client.models.V1PersistentVolume;
11-
import io.kubernetes.client.models.V1PersistentVolumeClaim;
1210
import io.kubernetes.client.models.V1SecretReference;
1311
import java.util.List;
1412
import java.util.Map;
@@ -26,9 +24,6 @@
2624
/** Domain represents a WebLogic domain and how it will be realized in the Kubernetes cluster. */
2725
@SuppressWarnings("deprecation")
2826
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-
3227
/** The pattern for computing the default shared logs directory. */
3328
private static final String LOG_HOME_DEFAULT_PATTERN = "/shared/logs/%s";
3429

@@ -353,42 +348,6 @@ public Map<String, String> getChannelServiceAnnotations(String channel) {
353348
return getEffectiveConfigurationFactory().getChannelServiceAnnotations(channel);
354349
}
355350

356-
/**
357-
* Returns the name of the persistent volume claim for the logs and PV-based domain.
358-
*
359-
* @return volume claim
360-
*/
361-
public String getPersistentVolumeClaimName() {
362-
return spec.getStorage() == null ? null : getConfiguredClaimName(spec.getStorage());
363-
}
364-
365-
private String getConfiguredClaimName(@Nonnull DomainStorage storage) {
366-
return Optional.ofNullable(storage.getPersistentVolumeClaimName())
367-
.orElse(String.format(PVC_NAME_PATTERN, getDomainUID()));
368-
}
369-
370-
/**
371-
* Returns the persistent volume that must be created for domain storage. May be null.
372-
*
373-
* @return a definition of the kubernetes resource to create
374-
*/
375-
public V1PersistentVolume getRequiredPersistentVolume() {
376-
return spec.getStorage() == null
377-
? null
378-
: spec.getStorage().getRequiredPersistentVolume(getDomainUID());
379-
}
380-
381-
/**
382-
* Returns the persistent volume claim that must be created for domain storage. May be null.
383-
*
384-
* @return a definition of the kubernetes resource to create
385-
*/
386-
public V1PersistentVolumeClaim getRequiredPersistentVolumeClaim() {
387-
return spec.getStorage() == null
388-
? null
389-
: spec.getStorage().getRequiredPersistentVolumeClaim(getDomainUID(), getNamespace());
390-
}
391-
392351
/**
393352
* Returns the name of the Kubernetes configmap that contains optional configuration overrides.
394353
*
@@ -407,10 +366,6 @@ public List<String> getConfigOverrideSecrets() {
407366
return spec.getConfigOverrideSecrets();
408367
}
409368

410-
private String getNamespace() {
411-
return getMetadata().getNamespace();
412-
}
413-
414369
@Override
415370
public String toString() {
416371
return new ToStringBuilder(this)

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

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -127,13 +127,6 @@ public class DomainSpec extends BaseConfiguration {
127127
"True if this domain's home is defined in the docker image for the domain. Defaults to true")
128128
private Boolean domainHomeInImage;
129129

130-
/** The definition of the storage used for this domain. */
131-
@Description(
132-
"The storage used for this domain. "
133-
+ "Defaults to a predefined claim for a PVC whose name is "
134-
+ "the domain UID followed by '-weblogic-domain-pvc'")
135-
private DomainStorage storage;
136-
137130
/**
138131
* The name of the Kubernetes configmap used for optional WebLogic configuration overrides.
139132
*
@@ -417,24 +410,6 @@ public DomainSpec withReplicas(Integer replicas) {
417410
return this;
418411
}
419412

420-
/**
421-
* Specifies the storage for the domain.
422-
*
423-
* @param storage the definition of the domain storage.
424-
*/
425-
public void setStorage(DomainStorage storage) {
426-
this.storage = storage;
427-
}
428-
429-
/**
430-
* Returns the storage for the domain.
431-
*
432-
* @return the definition of the domain storage.
433-
*/
434-
public DomainStorage getStorage() {
435-
return storage;
436-
}
437-
438413
@Nullable
439414
String getConfigOverrides() {
440415
return configOverrides;
@@ -480,7 +455,6 @@ public String toString() {
480455
.append("webLogicCredentialsSecret", webLogicCredentialsSecret)
481456
.append("image", image)
482457
.append("imagePullPolicy", imagePullPolicy)
483-
.append("storage", storage)
484458
.append("imagePullSecrets", imagePullSecrets)
485459
.append("adminServer", adminServer)
486460
.append("managedServers", managedServers)
@@ -506,7 +480,6 @@ public int hashCode() {
506480
.append(webLogicCredentialsSecret)
507481
.append(image)
508482
.append(imagePullPolicy)
509-
.append(storage)
510483
.append(imagePullSecrets)
511484
.append(adminServer)
512485
.append(managedServers)
@@ -535,7 +508,6 @@ public boolean equals(Object other) {
535508
.append(domainHomeInImage, rhs.domainHomeInImage)
536509
.append(webLogicCredentialsSecret, rhs.webLogicCredentialsSecret)
537510
.append(image, rhs.image)
538-
.append(storage, rhs.storage)
539511
.append(imagePullPolicy, rhs.imagePullPolicy)
540512
.append(imagePullSecrets, rhs.imagePullSecrets)
541513
.append(adminServer, rhs.adminServer)

0 commit comments

Comments
 (0)