Skip to content

Commit 2572b32

Browse files
committed
Merge remote-tracking branch 'origin/main' into release/4.0
2 parents 18cd2a2 + 7447a10 commit 2572b32

File tree

13 files changed

+850
-21
lines changed

13 files changed

+850
-21
lines changed

common/src/main/java/oracle/kubernetes/common/CommonConstants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ private CommonConstants() {
1010
}
1111

1212
public static final String COMPATIBILITY_MODE = "compat-";
13+
public static final String WLS_SHARED = "wls-shared-";
1314
public static final String API_VERSION_V9 = "weblogic.oracle/v9";
1415
public static final String API_VERSION_V8 = "weblogic.oracle/v8";
1516

common/src/main/java/oracle/kubernetes/common/utils/SchemaConversionUtils.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -589,14 +589,14 @@ private void removeNamedItems(Map<String, Object> serverPod, String kind, Predic
589589
private void addInitContainersVolumeAndMountsToServerPod(Map<String, Object> serverPod, List<Object> auxiliaryImages,
590590
List<Object> auxiliaryImageVolumes) {
591591
addEmptyDirVolume(serverPod, auxiliaryImageVolumes);
592-
List<Object> initContainers = Optional.ofNullable((List<Object>) serverPod.get(INIT_CONTAINERS))
593-
.orElse(new ArrayList<>());
592+
List<Object> initContainers = new ArrayList<>();
594593
for (Object auxiliaryImage : auxiliaryImages) {
595594
initContainers.add(
596595
createInitContainerForAuxiliaryImage((Map<String, Object>) auxiliaryImage, containerIndex.get(),
597596
auxiliaryImageVolumes));
598597
containerIndex.addAndGet(1);
599598
}
599+
initContainers.addAll(Optional.ofNullable((List<Object>) serverPod.get(INIT_CONTAINERS)).orElse(new ArrayList<>()));
600600
serverPod.put(INIT_CONTAINERS, initContainers);
601601
auxiliaryImages.forEach(ai -> addVolumeMount(serverPod, (Map<String, Object>)ai, auxiliaryImageVolumes));
602602
addAuxiliaryImageEnv(auxiliaryImages, serverPod, auxiliaryImageVolumes);

documentation/4.0/content/faq/resource-settings.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,12 @@ You can tune container memory and CPU usage
4040
by configuring Kubernetes resource requests and limits,
4141
and you can tune a WebLogic JVM heap usage
4242
using the `USER_MEM_ARGS` environment variable in your Domain YAML file.
43-
The introspector job pod uses the same CPU and memory settings as the
43+
By default, the introspector job pod uses the same CPU and memory settings as the
4444
domain's WebLogic Administration Server pod. Similarly, the operator created init containers in the
4545
introspector job pod for the [Auxiliary Images]({{< relref "/managing-domains/model-in-image/auxiliary-images" >}})
4646
based domains use the same CPU and memory settings as the domain's WebLogic Administration Server pod.
47+
Beginning with operator version 4.0.5, you can override the settings of the introspector job pod using
48+
the `domain.spec.introspector.serverPod` element.
4749
A resource request sets the minimum amount of a resource that a container requires.
4850
A resource limit is the maximum amount of a resource a container is given
4951
and prevents a container from using more than its share of a resource.
@@ -61,6 +63,8 @@ and you can override the setting for individual WebLogic Server instances using
6163
setting for member servers of a cluster using the `cluster.spec.serverPod` element.
6264
Note that the introspector job pod uses the same settings
6365
as the WebLogic Administration Server pod.
66+
Beginning with operator version 4.0.5, you can override the settings of the introspector job pod
67+
using the `domain.spec.introspector.serverPod` element.
6468

6569
Values set in the `.serverPod` stanzas for a more specific type of pod, override
6670
the same values if they are also set for a more general type of pod, and inherit

documentation/4.0/content/managing-domains/model-in-image/auxiliary-images.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,13 +284,13 @@ to use Docker to build its auxiliary image:
284284
### Automated upgrade of the `weblogic.oracle/v8` schema auxiliary images configuration
285285

286286
{{% notice note %}}
287-
The automated upgrade described in this section converts `weblogic.oracle/v8` schema auxiliary image configuration into low-level Kubernetes schema, for example, init-containers and volumes.
287+
The automated upgrade described in this section converts `weblogic.oracle/v8` schema auxiliary image configuration into low-level Kubernetes schema, for example, init containers and volumes.
288288
Instead of relying on the generated low-level schema, Oracle recommends using a simplified `weblogic.oracle/v9` schema configuration for auxiliary images, as documented in the [Configuration](#configuration) section.
289289
{{% /notice %}}
290290

291291
In operator version 4.0, we have enhanced auxiliary images to improve ease of use; also, its configuration has changed from operator 3.x releases.
292292

293-
Operator 4.0 provides a seamless upgrade of Domains with `weblogic.oracle/v8` schema auxiliary images configuration. When you create a Domain with auxiliary images using `weblogic.oracle/v8` schema in a namespace managed by the 4.0 operator, the [WebLogic Domain resource conversion webhook]({{< relref "/managing-operators/conversion-webhook.md" >}}) performs an automated upgrade of the domain resource to the `weblogic.oracle/v9` schema. The conversion webhook runtime converts the `weblogic.oracle/v8` auxiliary image configuration to the equivalent configuration using init-containers, volume and volume mounts under the `serverPod` spec in `weblogic.oracle/v9`. Similarly, when [upgrading the operator]({{< relref "/managing-operators/installation#upgrade-the-operator" >}}), Domains with `weblogic.oracle/v8` schema auxiliary images are seamlessly upgraded.
293+
Operator 4.0 provides a seamless upgrade of Domains with `weblogic.oracle/v8` schema auxiliary images configuration. When you create a Domain with auxiliary images using `weblogic.oracle/v8` schema in a namespace managed by the 4.0 operator, the [WebLogic Domain resource conversion webhook]({{< relref "/managing-operators/conversion-webhook.md" >}}) performs an automated upgrade of the domain resource to the `weblogic.oracle/v9` schema. The conversion webhook runtime converts the `weblogic.oracle/v8` auxiliary image configuration to the equivalent configuration using init containers, volume and volume mounts under the `serverPod` spec in `weblogic.oracle/v9`. Similarly, when [upgrading the operator]({{< relref "/managing-operators/installation#upgrade-the-operator" >}}), Domains with `weblogic.oracle/v8` schema auxiliary images are seamlessly upgraded.
294294

295295
The following is a sample `weblogic.oracle/v8` schema auxiliary image configuration in operator 3.x and
296296
the equivalent `weblogic.oracle/v9` schema configuration generated by the conversion webhook in operator 4.0.
@@ -344,6 +344,10 @@ spec:
344344
name: compat-ai-vol-auxiliaryimagevolume1
345345
```
346346

347+
{{% notice note %}}
348+
The conversion webhook runtime creates init containers with names prefixed with `compat-` when converting the auxiliary image configuration of the `weblogic.oracle/v8` schema. The operator generates only init containers with names starting with either `compat-` or `wls-shared-` in the introspector job pod. To alter the generated init container's name, the new name must start with either `compat-` or `wls-shared-`.
349+
{{% /notice %}}
350+
347351
### Domain upgrade tool to manually upgrade the `weblogic.oracle/v8` schema domain resource
348352

349353
To manually upgrade the domain resource from the `weblogic.oracle/v8` schema to the `weblogic.oracle/v9` schema, see [Upgrade the `weblogic.oracle/v8` schema domain resource manually]({{< relref "/managing-domains/upgrade-domain-resource#upgrade-the-weblogicoraclev8-schema-domain-resource-manually" >}}).

documentation/4.0/content/managing-domains/upgrade-domain-resource/_index.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ The Domain CustomResourceDefinition in operator version 4.0 has changed signific
1414
### Automated upgrade of `weblogic.oracle/v8` schema domain resource
1515

1616
{{% notice note %}}
17-
The automated upgrade described in this section converts `weblogic.oracle/v8` schema auxiliary image configuration into low-level Kubernetes schema, for example, init-containers and volumes.
17+
The automated upgrade described in this section converts `weblogic.oracle/v8` schema auxiliary image configuration into low-level Kubernetes schema, for example, init containers and volumes.
1818
Instead of relying on the generated low-level schema, Oracle recommends using a simplified `weblogic.oracle/v9` schema configuration for auxiliary images, as documented in the
1919
Auxiliary Images [Configuration]({{<relref "/managing-domains/model-in-image/auxiliary-images#configuration" >}}) section.
2020
{{% /notice %}}
@@ -24,7 +24,7 @@ The 4.0 operator provides a seamless upgrade of the Domain resources with the `w
2424
### Upgrade the `weblogic.oracle/v8` schema domain resource manually
2525

2626
{{% notice note %}}
27-
The manual upgrade tooling described in this section converts `weblogic.oracle/v8` schema auxiliary image configuration into low-level Kubernetes schema, for example, init-containers and volumes.
27+
The manual upgrade tooling described in this section converts `weblogic.oracle/v8` schema auxiliary image configuration into low-level Kubernetes schema, for example, init containers and volumes.
2828
Instead of relying on the generated low-level schema, Oracle recommends using a simplified `weblogic.oracle/v9` schema configuration for auxiliary images, as documented in the
2929
Auxiliary Images [Configuration]({{<relref "/managing-domains/model-in-image/auxiliary-images#configuration" >}}) section.
3030
{{% /notice %}}
@@ -69,3 +69,7 @@ In the previous example, the tool writes the upgraded file to the `/tmp` directo
6969
$ ls -ltr /tmp/domain-v9.yaml
7070
-rw-r----- 1 user dba 2818 Apr 18 23:11 /tmp/domain-v9.yaml
7171
```
72+
73+
{{% notice note %}}
74+
The manual upgrade tooling creates init containers with names prefixed with `compat-` when converting the auxiliary image configuration of the `weblogic.oracle/v8` schema. The operator generates only init containers with names starting with either `compat-` or `wls-shared-` in the introspector job pod. To alter the generated init container's name, the new name must start with either `compat-` or `wls-shared-`.
75+
{{% /notice %}}

integration-tests/src/test/java/oracle/weblogic/kubernetes/ItMiiUpdateDomainConfig.java

Lines changed: 76 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -359,23 +359,26 @@ void testMiiCheckSystemResources() {
359359
}
360360

361361
/**
362-
* Start a WebLogic domain using model-in-image with JMS/JDBC SystemResources.
363-
* Create a configmap to delete JMS/JDBC SystemResources.
362+
* Start a WebLogic domain using model-in-image.
363+
* Create 1 configmap with 2 models files, one of them to add JMS/JDBC SystemResources
364+
* and another one to delete JMS/JDBC SystemResources
364365
* Patch the domain resource with the configmap.
365366
* Update the restart version of the domain resource.
366367
* Verify rolling restart of the domain by comparing PodCreationTimestamp
367368
* for all the server pods before and after rolling restart.
368369
* Verify SystemResources are deleted from the domain.
369370
*/
370371
@Test
371-
@Order(4)
372+
@Order(5)
372373
@DisplayName("Delete SystemResources from the domain")
373374
void testMiiDeleteSystemResources() {
374375

375376
String configMapName = "deletesysrescm";
377+
final String modelFileAdd = "model.add.sysresources.yaml";
378+
final String modelFileDelete = "model.delete.sysresources.yaml";
379+
List<String> modelFiles = Arrays.asList(MODEL_DIR + "/" + modelFileAdd, MODEL_DIR + "/" + modelFileDelete);
376380
createConfigMapAndVerify(
377-
configMapName, domainUid, domainNamespace,
378-
Arrays.asList(MODEL_DIR + "/model.delete.sysresourcesbyconfigmap.yaml"));
381+
configMapName, domainUid, domainNamespace, modelFiles);
379382

380383
LinkedHashMap<String, OffsetDateTime> pods = new LinkedHashMap<>();
381384
// get the creation time of the admin server pod before patching
@@ -433,7 +436,7 @@ void testMiiDeleteSystemResources() {
433436
* Verify JMS Server logs are written on PV.
434437
*/
435438
@Test
436-
@Order(5)
439+
@Order(6)
437440
@DisplayName("Add new JDBC/JMS SystemResources to the domain")
438441
void testMiiAddSystemResources() {
439442

@@ -505,7 +508,7 @@ void testMiiAddSystemResources() {
505508
* Verify servers from the new cluster are running.
506509
*/
507510
@Test
508-
@Order(6)
511+
@Order(7)
509512
@DisplayName("Add a dynamic cluster to domain with non-zero replica count")
510513
void testMiiAddDynamicCluster() {
511514

@@ -579,7 +582,7 @@ void testMiiAddDynamicCluster() {
579582
* Check the validity of new credentials by accessing WebLogic RESTful Service
580583
*/
581584
@Test
582-
@Order(7)
585+
@Order(8)
583586
@DisplayName("Change the WebLogic Admin credential of the domain")
584587
void testMiiUpdateWebLogicCredential() {
585588
verifyUpdateWebLogicCredential(adminSvcExtHost, domainNamespace, domainUid, adminServerPodName,
@@ -601,7 +604,7 @@ void testMiiUpdateWebLogicCredential() {
601604
* Make sure JMS Connections and messages are distributed across 4 servers.
602605
*/
603606
@Test
604-
@Order(8)
607+
@Order(9)
605608
@DisplayName("Test modification to Dynamic cluster size parameters")
606609
void testMiiUpdateDynamicClusterSize() {
607610

@@ -745,6 +748,70 @@ private void buildClientOnPod() {
745748
assertEquals(0, result.exitValue(), "Client compilation fails");
746749
}
747750

751+
/**
752+
* Start a WebLogic domain using model-in-image with JMS/JDBC SystemResources.
753+
* Create a empty configmap to delete JMS/JDBC SystemResources
754+
* Patch the domain resource with the configmap.
755+
* Update the restart version of the domain resource.
756+
* Verify rolling restart of the domain by comparing PodCreationTimestamp
757+
* for all the server pods before and after rolling restart.
758+
* Verify SystemResources are deleted from the domain.
759+
*/
760+
@Test
761+
@Order(4)
762+
@DisplayName("Delete SystemResources from the domain")
763+
void testMiiDeleteSystemResourcesByEmptyConfigMap() {
764+
765+
String configMapName = "deletesysrescm";
766+
createConfigMapAndVerify(
767+
configMapName, domainUid, domainNamespace,
768+
Arrays.asList(MODEL_DIR + "/model.delete.sysresourcesbyconfigmap.yaml"));
769+
770+
LinkedHashMap<String, OffsetDateTime> pods = new LinkedHashMap<>();
771+
// get the creation time of the admin server pod before patching
772+
OffsetDateTime adminPodCreationTime = getPodCreationTime(domainNamespace,adminServerPodName);
773+
pods.put(adminServerPodName, adminPodCreationTime);
774+
// get the creation time of the managed server pods before patching
775+
for (int i = 1; i <= replicaCount; i++) {
776+
pods.put(managedServerPrefix + i, getPodCreationTime(domainNamespace, managedServerPrefix + i));
777+
}
778+
779+
StringBuffer patchStr = null;
780+
patchStr = new StringBuffer("[{");
781+
patchStr.append("\"op\": \"replace\",")
782+
.append(" \"path\": \"/spec/configuration/model/configMap\",")
783+
.append(" \"value\": \"" + configMapName + "\"")
784+
.append(" }]");
785+
logger.log(Level.INFO, "Configmap patch string: {0}", patchStr);
786+
787+
patch = new V1Patch(new String(patchStr));
788+
boolean cmPatched = assertDoesNotThrow(() ->
789+
patchDomainCustomResource(domainUid, domainNamespace, patch, "application/json-patch+json"),
790+
"patchDomainCustomResource(configMap) failed ");
791+
assertTrue(cmPatched, "patchDomainCustomResource(configMap) failed");
792+
793+
String newRestartVersion = patchDomainResourceWithNewRestartVersion(domainUid, domainNamespace);
794+
logger.log(Level.INFO, "New restart version is {0}", newRestartVersion);
795+
796+
assertTrue(verifyRollingRestartOccurred(pods, 1, domainNamespace),
797+
"Rolling restart failed");
798+
799+
// Even if pods are created, need the service to created
800+
for (int i = 1; i <= replicaCount; i++) {
801+
logger.info("Check managed server service {0} created in namespace {1}",
802+
managedServerPrefix + i, domainNamespace);
803+
checkServiceExists(managedServerPrefix + i, domainNamespace);
804+
}
805+
806+
int adminServiceNodePort
807+
= getServiceNodePort(domainNamespace, getExternalServicePodName(adminServerPodName), "default");
808+
assertNotEquals(-1, adminServiceNodePort, "admin server default node port is not valid");
809+
verifySystemResourceConfiguration(adminSvcExtHost, adminServiceNodePort,
810+
"JDBCSystemResources", "TestDataSource", "404");
811+
verifySystemResourceConfiguration(adminSvcExtHost, adminServiceNodePort,
812+
"JMSSystemResources", "TestClusterJmsModule", "404");
813+
}
814+
748815
// Run standalone JMS Client in the pod using wlthint3client.jar in classpath.
749816
// The client sends 300 messsage to a Uniform Distributed Queue.
750817
// Make sure that each destination get excatly 150 messages each.
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Copyright (c) 2023 Oracle and/or its affiliates.
2+
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
3+
resources:
4+
FileStore:
5+
TestClusterFileStore:
6+
Target: 'cluster-1'
7+
JMSServer:
8+
TestClusterJmsServer:
9+
ProductionPausedAtStartup: false
10+
ConsumptionPausedAtStartup: false
11+
Target: 'cluster-1'
12+
PersistentStore: 'TestClusterFileStore'
13+
InsertionPausedAtStartup: false
14+
MessageCompressionOptions: GZIP_DEFAULT_COMPRESSION
15+
Notes: '@@ENV:CUSTOM_ENV@@'
16+
17+
JMSSystemResource:
18+
TestClusterJmsModule:
19+
Target: 'cluster-1'
20+
SubDeployment:
21+
TestClusterSubDeployment:
22+
Target: TestClusterJmsServer
23+
JmsResource:
24+
UniformDistributedQueue:
25+
testUniformQueue:
26+
SubDeploymentName: TestClusterSubDeployment
27+
JNDIName: jms/testUniformQueue
28+
UniformDistributedTopic:
29+
testUniformTopic:
30+
SubDeploymentName: TestClusterSubDeployment
31+
ForwardingPolicy: Partitioned
32+
JNDIName: jms/testUniformTopic
33+
34+
JDBCSystemResource:
35+
TestDataSource:
36+
Target: 'cluster-1'
37+
JdbcResource:
38+
JDBCConnectionPoolParams:
39+
InitialCapacity: 0
40+
MinCapacity: 0
41+
MaxCapacity: 15
42+
JDBCDataSourceParams:
43+
GlobalTransactionsProtocol: OnePhaseCommit
44+
RowPrefetchSize: 200
45+
JNDIName: jdbc/TestDataSource
46+
JDBCDriverParams:
47+
URL: '@@SECRET:@@ENV:DOMAIN_UID@@-db-secret:url@@'
48+
PasswordEncrypted: '@@SECRET:@@ENV:DOMAIN_UID@@-db-secret:password@@'
49+
DriverName: oracle.jdbc.OracleDriver
50+
Properties:
51+
user:
52+
Value: '@@SECRET:@@ENV:DOMAIN_UID@@-db-secret:username@@'
53+
54+
WLDFSystemResource:
55+
'TestWldfModule':
56+
Description: WLDF Module for Mii domain
57+
Target: 'cluster-1'

0 commit comments

Comments
 (0)